.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
A newer version of this page is available. Switch to the current version.

IDocumentTheme Interface

Base interface for a document theme.

Namespace: DevExpress.XtraRichEdit.API.Native

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


public interface IDocumentTheme


The DocumentTheme class is the default implementation of the IDocumentTheme interface. Use this class to specify the theme fonts information used in the document.

The Document.Theme property returns an object implementing the IDocumentTheme interface. You can pass this object to the DocumentTheme(IDocumentTheme) constructor to clone the theme from the current document.

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

//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";

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;


//Save the result:
doc.SaveDocument("123456.docx", DocumentFormat.OpenXml);
See Also