Back to Devexpress

DocumentTheme Class

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-4c835d3f.md

latest3.8 KB
Original Source

DocumentTheme Class

Represents a document theme.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public class DocumentTheme :
    IDocumentTheme
vb
Public Class DocumentTheme
    Implements IDocumentTheme

Remarks

The DocumentTheme class is the default IDocumentTheme interface implementation that represents the document theme. Use the DocumentTheme class properties to specify theme fonts for East Asian, Latin and Complex Script languages.

The code sample below shows how to create a new DocumentTheme object and pass it as the Document.Theme property value:

csharp
//Create a new DocumentTheme object:
DocumentTheme theme = new DocumentTheme();

//Specify Body and Heading fonts for Complex Script...
theme.BodyComplexScript = "Microsoft Sans Serif";
theme.HeadingsComplexScript = "Tahoma";

//...Latin...
theme.HeadingsLatin = "Segoe UI Semilight";
theme.BodyLatin = "Times New Roman";

//..and East Asian languages:
theme.HeadingsEastAsia = "DengXian Light";
theme.BodyEastAsia = "DengXian";

//Set the created object as the Theme property value:
doc.Theme = theme;

// Specify theme font types used for Complex Script and East Asian languages:
CharacterProperties fontProperties = doc.BeginUpdateCharacters(doc.Range);

fontProperties.ThemeFontComplexScript = ThemeFont.HeadingsComplexScript;
fontProperties.ThemeFontEastAsia = ThemeFont.BodyEastAsia;

doc.EndUpdateCharacters(fontProperties);

//Save the result:
doc.SaveDocument("123456.docx", DocumentFormat.Docx);
vb
'Create a new DocumentTheme object:
Dim theme As New DocumentTheme()

'Specify Body and Heading fonts for Complex Script...
theme.BodyComplexScript = "Microsoft Sans Serif"
theme.HeadingsComplexScript = "Tahoma"

'...Latin...
theme.HeadingsLatin = "Segoe UI Semilight"
theme.BodyLatin = "Times New Roman"

'..and East Asian languages:
theme.HeadingsEastAsia = "DengXian Light"
theme.BodyEastAsia = "DengXian"

'Set the created object as the Theme property value:
doc.Theme = theme

'Save the result:
doc.SaveDocument("123456.docx", DocumentFormat.Docx)

Note

Theme fonts are not used if the following properties are specified:

Implements

IDocumentTheme

Inheritance

Object DocumentTheme

See Also

DocumentTheme Members

DevExpress.XtraRichEdit.API.Native Namespace