Theme.Bod圜omplexScript = "Microsoft Sans Serif" ' Specify Body and Heading fonts for Complex Script. Specify theme font types used for Complex Script and East Asian languages:ĬharacterProperties fontProperties = doc.BeginUpdateCharacters(doc.Range) įontProperties.ThemeFontComplexScript = ThemeFont.HeadingsComplexScript įontProperties.ThemeFontEastAsia = ThemeFont.BodyEastAsia ĭoc.SaveDocument("123456.docx", DocumentFormat.OpenXml) Set the created object as the Theme property value: Theme.HeadingsEastAsia = "DengXian Light" Theme.HeadingsLatin = "Segoe UI Semilight" Specify Body and Heading fonts for Complex Script. Create a new DocumentTheme object and pass it as the Theme property value, as shown in the code sample below:ĭocumentTheme theme = new DocumentTheme() You can use the Document.Theme property to specify Body and Heading fonts used in the document for Latin, Complex Script and East Asian languages. If the ThemeFontComplexScript is not specified, the CharacterPropertiesBase.FontNameComplexScript property determines the theme font. Specifies the name of the Complex Script theme font. If the ThemeFontHighAnsi is not specified, the CharacterPropertiesBase.FontNameHighAnsi property determines the theme font.ĬharacterPropertiesBase.ThemeFontComplexScript Specifies the theme font used to format High ANSI characters. If the ThemeFontEastAsia is not specified, the CharacterPropertiesBase.FontNameEastAsia property determines the theme font.ĬharacterPropertiesBase.ThemeFontHighAnsi Specifies the theme font used to format East Asian Unicode characters. If the ThemeFontAscii is not specified, CharacterPropertiesBase.FontNameAscii property determines the theme font.ĬharacterPropertiesBase.ThemeFontEastAsia Specifies the theme font used to format Unicode (U+0000–U+007F) characters. You can use the following properties to specify these fonts for a specific document range: Property Each set includes font names for different languages. A document theme contains two sets of fonts (Headings and Body). The Rich Text Editor supports theme fonts. TitleFormatting.ForeColor = Color.DarkBlueĭocument.EndUpdateCharacters(titleFormatting) ' Set the character size, font name and color ' Provide access to the character propertiesĭim titleFormatting As CharacterProperties = document.BeginUpdateCharacters(range) ' The target range is the first paragraphĭim range As DocumentRange = document.Paragraphs(0).Range TitleFormatting.ForeColor = Color.DarkBlue ĭocument.EndUpdateCharacters(titleFormatting) Set the character size, font name and color Provide access to the character propertiesĬharacterProperties titleFormatting = document.BeginUpdateCharacters(range) The target range is the first paragraphĭocumentRange range = The code sample below uses this API to modify the text color and the font type. Initiates the update session and provides access to CharacterProperties for the specified range.įinalizes the character formatting update. The following members allow you to change character formatting for a given range. Use both character and paragraph formatting for a specific document range, for instance, for the document title as shown below. RichEditControlCompatibility.DefaultFontName = "Tahoma" Īpplication.SetCompatibleTextRenderingDefault(False)ĭ = 8ĭ = "Tahoma" RichEditControlCompatibility.DefaultFontSize = 8 Specify these properties before initialization of all controls, in the Main method, as illustrated in the following code.Īpplication.SetCompatibleTextRenderingDefault(false) The static RichEditControlCompatibility.DefaultFontSize and RichEditControlCompatibility.DefaultFontName properties set the default font settings for all RichEditControl instances in the application. ' Set the default font, size and forecolor Private Sub RichEditControl1_DocumentLoaded(ByVal sender As Object, ByVal e As EventArgs) Set the default font, size and forecolor Private void RichEditControl1_DocumentLoaded(object sender, EventArgs e)
0 Comments
Leave a Reply. |