Description
Specifies the font to use when inserting text. This property is temporarily overridden by the <font> tag in the XHTML. If this property is not set, the document's default font is used.C#
public SoftArtisans.OfficeWriter.WordWriter.Font DefaultFont{ get; set; }vb.net
Public Property DefaultFont() As SoftArtisans.OfficeWriter.WordWriter.Font
Remarks
The default value is null. The font in the document's default style will be used. (This is generally Times New Roman 12 pt.)Examples
C#
//--- Create a WordApplication and open a Document WordApplication wordApp = new WordApplication(); Document doc = wordApp.Create(); //--- Create the HTMLToWord object HTMLToWord h2w = new HTMLToWord(); //--- Create the font to use when inserting HTML //--- Start by getting the "Normal" font from the Document Font font = doc.Styles[NamedStyle.BuiltIn.Normal].Font; //--- Change the font to 10 pt. Arial with red text font.FontName = "Arial"; font.FontSize = 10; font.TextColor = System.Drawing.Color.Red; //--- Set this as the default font on the HTMLToWord object h2w.InsertProperties.DefaultFont = font; //--- Insert the htmlFragment at the end of the document. h2w.InsertHTML(htmlFragment, doc, Nothing, doc);
vb.net
'--- Create a WordApplication and open a Document Dim wordApp As New WordApplication() Dim doc As Document = wordApp.Create() '--- Create the HTMLToWord object Dim h2w As New HTMLToWord() '--- Create the font to use when inserting HTML '--- Start by getting the "Normal" font from the Document Dim font as Font = doc.Styles(NamedStyle.BuiltIn.Normal).Font '-- Change the font to 10 pt. Arial with red text font.FontName = "Arial" font.FontSize = 10 font.TextColor = System.Drawing.Color.Red '--- Set this as the default font on the HTMLToWord object h2w.InsertProperties.DefaultFont = font '--- Insert the htmlFragment at the end of the document. h2w.InsertHTML(htmlFragment, doc, Nothing, doc)
