Products Technologies Demo Docs Blog Support Company

X14 Preview: Adding MS Word Compatible Custom Properties to Documents

Custom properties can be created to store additional information about the document in the document itself. 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. Using TX Text Control X14 (Windows Forms, WPF and ASP.NET), custom properties can be set and retrieved using the SaveSettings and LoadSettings…

X14 Preview: Adding MS Word Compatible Custom Properties to Documents

Custom properties can be created to store additional information about the document in the document itself. 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.

Using TX Text Control X14 (Windows Forms, WPF and ASP.NET), custom properties can be set and retrieved using the SaveSettings and LoadSettings parameter in the Load and Save methods.

The new class UserDefinedPropertyDictionary contains all custom properties stored in a document. Supported value types are:

  • System.String
  • System.Boolean
  • System.Int32
  • System.Double

The following sample code shows how to add new custom properties to a document:

TXTextControl.UserDefinedPropertyDictionary userSettings =
    new TXTextControl.UserDefinedPropertyDictionary();

userSettings.Add("CustomPropertyString", "Custom property string");
userSettings.Add("CustomPropertyInt32", 123);
userSettings.Add("CustomPropertyBoolTrue", true);
userSettings.Add("CustomPropertyBoolFalse", false);
userSettings.Add("CustomPropertyDouble", 123.232);

TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings() {
    UserDefinedDocumentProperties = userSettings
};

textControl1.Save("test.rtf", 
                  TXTextControl.StreamType.RichTextFormat, 
                  saveSettings);

Unlimited number of custom properties can be stored in the document formats MS Word (DOC), Office Open XML (DOCX), Rich Text Format (RTF) and the internal TX Text Control format (TX).

The following code snippet shows how to load and retrieve the custom properties stored in a document:

TXTextControl.LoadSettings loadSettings = new TXTextControl.LoadSettings();

textControl1.Load("test.rtf", 
                  TXTextControl.StreamType.RichTextFormat,
                  loadSettings);

foreach (DictionaryEntry property in loadSettings.UserDefinedDocumentProperties) {
    Console.WriteLine(property.Key + ": " + property.Value.ToString());
}

Stay tuned for more information about the upcoming release X14!

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETWindows FormsWPF

TX Text Control 33.0 SP3 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 3 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…


ASP.NETWindows FormsWPF

TX Text Control 33.0 SP2 is Now Available: What's New in the Latest Version

TX Text Control 33.0 Service Pack 2 is now available, offering important updates and bug fixes for all platforms. If you use TX Text Control in your document processing applications, this service…


ActiveXASP.NETWindows Forms

Service Pack Releases: What's New in TX Text Control 33.0 SP1 and 32.0 SP5

TX Text Control 33.0 Service Pack 1 and TX Text Control 32.0 Service Pack 5 have been released, providing important updates and bug fixes across platforms. These service packs improve the…


ASP.NETWindows FormsWPF

The Wait is Over: TX Text Control for Linux is Officially Here

We are very excited to announce the release of TX Text Control 33.0 which includes the long awaited Linux version of TX Text Control. This version allows you to integrate TX Text Control into your…


ASP.NETWindows FormsWPF

Full .NET 9 Support in Text Control .NET Components for ASP.NET Core,…

.NET 9 will be launched tomorrow, November 12, at the .NET Conf 2024 with updates to cloud capabilities, security, and performance. TX Text Control .NET components are fully compatible with .NET 9…