Message-ID: <65907775.9767.1711702345909.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9766_1308145623.1711702345909" ------=_Part_9766_1308145623.1711702345909 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html WordTemplate.ContentType

WordTemplate.ContentType

Description

=20

Sets or returns the content-type header that will be sent to the browser= with the generated Word document.

=20
C#
=20
 public System.String ContentType{ get; set; }
=20
=20
vb.net
=20
Public Property ContentType() As String
=20
=20

Remarks

ContentType must n= ot be used before=20 Open is cal= led, as the content-type of the file cannot be known until after the file i= s opened. Getting or setting ContentType before calling Open will throw an = exception.=20

Examples

=20
C#
=20

          ...
          WordTemplate WordTempl =3D new WordTemplate();
          WordTempl.Open(Page.MapPath("./BasicTemplate.doc"));
          WordTempl.SetDataSource(MyDataTable);

          //--- Set the ContentType
          //--- ContentType is application/vns.ms-word by default for
          //--- .doc files, while the default ContentType for
          //--- .docx files is
          //--- application/vnd.openxmlformats-officedocument.wordprocessin=
gml.document
          //--- and for .docm files is
          //--- application/vnd.ms-word.document.macroEnabled.12
          WordTempl.ContentType =3D "application/unknown";
          WordTempl.Process();
          WordTempl.Save(Page.Response, "BasicGenerated.doc", fal=
se);
          ...
        
=20
=20
vb.net
=20

          ...
          Dim WordTempl As New WordTemplate()
          WordTempl.Open(Page.MapPath("./BasicTemplate.doc"))
          WordTempl.SetDataSource(MyDataTable)

          '--- Set the ContentType
          '--- ContentType is application/vns.ms-word by default for
          '--- .doc files, while the default ContentType for
          '--- .docx files is
          '--- application/vnd.openxmlformats-officedocument.wordprocessing=
ml.document
          '--- and for .docm files is
          '--- application/vnd.ms-word.document.macroEnabled.12
          WordTempl.ContentType =3D "application/unknown"
          WordTempl.Process()
          WordTempl.Save(Page.Response, "BasicGenerated.doc", Fal=
se)
          ...
        
=20
------=_Part_9766_1308145623.1711702345909--