Skip to main content
A newer version of this page is available. .

DocumentCustomProperties Interface

Contains all the custom document properties for the document.

Namespace: DevExpress.XtraRichEdit.API.Native

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

Declaration

public interface DocumentCustomProperties

The following members return DocumentCustomProperties objects:

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.

Example

The following code illustrates how to create custom document properties and place them in the document’s storage. The DOCPROPERTY field is used to display property values in the document. Calling the FieldCollection.Update updates all property fields in the document body.

Note

If the DOCPROPERTY fields are located in the text box, header or footer, they should be updated separately. Use the Section.BeginUpdateHeader - Section.EndUpdateHeader or Section.BeginUpdateFooter - Section.EndUpdateFooter paired methods to obtain the header or footer. The TextBox.Document property allows you to retrieve the text box content and update the corresponding fields.

document.BeginUpdate()
document.AppendText("A new value of MyBookmarkProperty is obtained from here: NEWVALUE!" & vbLf)
document.Bookmarks.Create(document.FindAll("NEWVALUE!", SearchOptions.CaseSensitive)(0), "bmOne")
document.AppendText(vbLf & "MyNumericProperty: ")
document.Fields.Create(document.Range.End, "DOCPROPERTY ""MyNumericProperty""")
document.AppendText(vbLf & "MyStringProperty: ")
document.Fields.Create(document.Range.End, "DOCPROPERTY ""MyStringProperty""")
document.AppendText(vbLf & "MyBooleanProperty: ")
document.Fields.Create(document.Range.End, "DOCPROPERTY ""MyBooleanProperty""")
document.AppendText(vbLf & "MyBookmarkProperty: ")
document.Fields.Create(document.Range.End, "DOCPROPERTY ""MyBookmarkProperty""")
document.EndUpdate()

document.CustomProperties("MyNumericProperty")= 123.45
document.CustomProperties("MyStringProperty")="The Final Answer"
document.CustomProperties("MyBookmarkProperty") = document.Bookmarks(0)
document.CustomProperties("MyBooleanProperty")=True

document.Fields.Update()
See Also