Custom properties are used to store additional information in a document. These properties remain with a document and can be viewed by all MS Word users that open the document. Several property management servers provide data tracking capabilities to search for, sort, and track documents based on document properties.
In TX Text Control, these properties can be accessed and created using the User ╰ TX Text Control .NET Server for ASP.NET
╰ TXTextControl Namespace
╰ UserDefinedPropertyDictionary Class
An instance of the UserDefinedPropertyDictionary class contains all user-defined document properties contained in a loaded document or which will be saved in a document. class.
The UserDefinedPropertyDictionary class is used with the Load ╰ TX Text Control .NET Server for ASP.NET
╰ TXTextControl Namespace
╰ LoadSettings Class
╰ UserDefinedDocumentProperties Property
Gets a dictionary with all user-defined document properties contained in the loaded document. and Save ╰ TX Text Control .NET Server for ASP.NET
╰ TXTextControl Namespace
╰ SaveSettings Class
╰ UserDefinedDocumentProperties Property
Sets a dictionary with all user-defined document properties which will be saved in the document. properties. Each entry in the dictionary is a key/value pair, where the key is the name of the document property and the value is the document property's value.
In order to access these properties when loading a document, you will have to use the LoadSettings in the Load ╰ TX Text Control .NET Server for ASP.NET
╰ TXTextControl Namespace
╰ ServerTextControl Class
╰ Load Method
Loads text in a certain format. method.
var loadedProperties; | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) | |
{ | |
tx.Create(); | |
TXTextControl.LoadSettings loadSettings = new TXTextControl.LoadSettings(); | |
tx.Load(docFile, TXTextControl.StreamType.WordprocessingML, loadSettings); | |
if (loadSettings.UserDefinedDocumentProperties != null) | |
{ | |
loadedProperties = loadSettings.UserDefinedDocumentProperties; | |
} | |
} |
On saving the document, you will have to pass the dictionary using the SaveSettings in the Save ╰ TX Text Control .NET Server for ASP.NET
╰ TXTextControl Namespace
╰ ServerTextControl Class
╰ Save Method
Saves the complete contents of a document with the specified format. method.
TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings() | |
{ | |
UserDefinedDocumentProperties = loadedProperties | |
}; | |
tx.Save(editedFile, TXTextControl.StreamType.WordprocessingML, saveSettings); |
It is important to pass these properties explicitly when saving the document. Otherwise, the properties are not maintained during the save method.