Settings
TextFormatProvider allows you export a RadFixedDocument to plain text. Additionally, the export settings provide modification options. This article outlines the available settings.
Through the TextFormatProviderSettings class you could specify the following export settings:
LinesSeparator: Determines the string used to separate the lines in the document. The default value is Environment.NewLine.
PagesSeparator: Determines the string, which will be used to separate the pages in the document. The default value is "----------- Page{0} ------------".
Create TextFormatProviderSettings
The constructor of the TextFormatProviderSettings class has two overloads:
TextFormatProviderSettings(): Initializes a new instance of the class and sets the default values for its properties.
TextFormatProviderSettings(string linesSeparator, string pagesSeparator): Initializes a new instance of the class and sets the specified values for its properties.
Example 1 shows how to create and specify a particular setting.
Example 1: Create TextFormatProviderSettings
TextFormatProviderSettings settings = new TextFormatProviderSettings("/r/n", "Page {0}");
Using TextFormatProviderSettings
The Export() method of TextFormatProvider allows you to pass a TextFormatProviderSettings instance. Example 2 illustrates how to apply the settings created in Example 1, when exporting a RadFixedDocument to string.
Example 2: Apply TextFormatProviderSettings
RadFixedDocument document = CreateRadFixedDocument();
TextFormatProvider provider = new TextFormatProvider();
string text = provider.Export(document, settings);