Document.CustomProperties Property
Provides access to a collection of the document’s custom properties.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v19.1.Core.dll
Declaration
Property Value
Type | Description |
---|---|
DocumentCustomProperties | A DocumentCustomProperties object that stores document’s custom properties. |
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
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()
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomProperties property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.