General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
All docs
V19.2
General Information
.NET Subscription
Desktop
Web
Controls and Extensions
Mainteinance Mode
Enterprise and Analytic Tools
Quality Assurance and Productivity
Frameworks and Libraries
19.2
19.1
18.2
18.1
17.2
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
DocumentCustomProperties Interface
Contains all the custom document properties for the document.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v19.2.Core.dll
Declaration
Remarks
Use the Document.CustomProperties property to obtain the DocumentCustomProperties object.
To get an individual document property, access it by name (use the DocumentCustomProperties.Item property).
The code below demonstrates how to create simple and linked custom properties. A linked custom property updates its value from the bookmark assigned to the property when the document is saved.
To display a property in a document, insert a DOCPROPERTY field.
Examples
Note
A complete sample project is available at https://github.com/DevExpress-Examples/word-processing-document-api-examples-t418535
server.CreateNewDocument();
Document document = server.Document;
document.BeginUpdate();
document.Fields.Create(document.AppendText("\nMyNumericProperty: ").End, "DOCVARIABLE CustomProperty MyNumericProperty");
document.Fields.Create(document.AppendText("\nMyStringProperty: ").End, "DOCVARIABLE CustomProperty MyStringProperty");
document.Fields.Create(document.AppendText("\nMyBooleanProperty: ").End, "DOCVARIABLE CustomProperty MyBooleanProperty");
document.EndUpdate();
document.CustomProperties["MyNumericProperty"]= 123.45;
document.CustomProperties["MyStringProperty"]="The Final Answer";
document.CustomProperties["MyBooleanProperty"]=true;
server.CalculateDocumentVariable += DocumentPropertyDisplayHelper.OnCalculateDocumentVariable;
document.Fields.Update();
server.CreateNewDocument()
Dim document As Document = server.Document
document.BeginUpdate()
document.Fields.Create(document.AppendText(vbLf & "MyNumericProperty: ").End, "DOCVARIABLE CustomProperty MyNumericProperty")
document.Fields.Create(document.AppendText(vbLf & "MyStringProperty: ").End, "DOCVARIABLE CustomProperty MyStringProperty")
document.Fields.Create(document.AppendText(vbLf & "MyBooleanProperty: ").End, "DOCVARIABLE CustomProperty MyBooleanProperty")
document.EndUpdate()
document.CustomProperties("MyNumericProperty")= 123.45
document.CustomProperties("MyStringProperty")="The Final Answer"
document.CustomProperties("MyBooleanProperty")=True
AddHandler server.CalculateDocumentVariable, AddressOf DocumentPropertyDisplayHelper.OnCalculateDocumentVariable
document.Fields.Update()
See Also
Feedback