TX Text Control .NET Server

LoadSettings Class

Class
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll
Inherits
  1. LoadSaveSettingsBase
  2. LoadSettings

Description

The LoadSettings class provides properties for advanced settings and information during load operations. See the TextControl.Load method for more information.

Syntax

public sealed class LoadSettings : LoadSaveSettingsBase

Examples

The following example shows how to use the LoadSettings to get the filename and the read bytes of a loaded document.

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

if (textControl1.Load(TXTextControl.StreamType.All, ls) == DialogResult.OK)
{
    MessageBox.Show(ls.LoadedFile + " has been loaded. " + ls.BytesRead.ToString() + " bytes read.");
}

The following example configures how a WordprocessingML template is loaded.

LoadSettings loadSettings = new();
textControl.Load("template.docx", StreamType.WordprocessingML, loadSettings);

Members

Constructors

ConstructorDescription
LoadSettingsNot described in the reference. public LoadSettings();

Properties

PropertyDescription
AddParagraphSpecifies whether or not a new paragraph is created before text is loaded. This property has only an effect, when a LoadSettings object is used with the Selection.Load method. By default a new paragraph is not created. When text is loaded into an existing paragraph the formatting attributes of the existing and the last loaded paragraph are merged. When this property is true, attributes are not merged and the newly created paragraph gets the attributes of the last loaded paragraph.
ApplicationFieldFormatSpecifies the format of text fields which are imported. The property's value can be one of the ApplicationFieldFormat values.
ApplicationFieldTypeNamesSpecifies an array of strings containing the type names of fields which are to be imported. This property is only taken into account, if the LoadSettings.ApplicationFieldFormat property is set to ApplicationFieldFormat.MSWord or ApplicationFieldFormat.HighEdit. For example, if the LoadSettings.ApplicationFieldFormat is set to ApplicationFieldFormat.MSWord and this array has the single string MERGEFIELD only Microsoft Word Merge Fields are loaded. If this property is null, which is the default value, all fields with the format specified through the LoadSettings.ApplicationFieldFormat are loaded.
AuthorGets the document's author. It is an empty string, if there is no author saved in the loaded document.
BytesReadGets the number of bytes read during the load operation.
ConvertedMergeBlocksNot described in the reference. public int ConvertedMergeBlocks { get; }
CreationDateGets the document's creation date. It is January 1, 0001 in the Gregorian calendar, if there is no creation date saved in the loaded document.
CreatorApplicationGets the application, which has created the document. It is an empty string, if a creator application is not saved in the loaded document.
CssFileNameGets the path and filename of the CSS file belonging to a HTML or XML document.
DefaultStreamTypeDetermines the default StreamType used in the file Open... and file Save As... dialogboxes. (Inherited from LoadSaveSettingsBase.)
DocumentAccessPermissionsSpecifies how a document can be accessed after it has been loaded. If a valid master password has been specified with the MasterPassword property, the document can be accessed without any restrictions. The property's value can be a bitwise combination of more than one of the described values.
DocumentBasePathSets a base path saved in the document that is used to resolve relative file paths. (Inherited from LoadSaveSettingsBase.)
DocumentKeywordsGets the document's keywords. The property value is null, if there are no keywords saved in the document.
DocumentPartNameSpreadsheetML only. Gets or sets the name of the part of the document to be loaded. Each SpreadsheetML document can contain multiple named worksheets. This property can be used to select a certain worksheet. The LoadSettings.GetDocumentPartNames method returns a list of all worksheet names. When this property is null, which is the deafault value, the first worksheet in loaded. When this property is an empty string, a dialog box is opened showing the names of all worksheets the document contains. The end-user can then select the worksheet to be loaded.
DocumentSubjectGets the document's subject string. It is an empty string, if there is no subject saved in the loaded document.
DocumentTitleGets the document's title. It is an empty string, if there is no title saved in the loaded document.
EmbeddedDataGets a System.Collections.Generic.Dictionary containing additional embedded data contained in a PDF document. Supported formats are specified through the EmbeddedDataFormat enumeration. Each entry in the dictionary is a key-value pair, the key is an EmbeddedDataFormat enumeration value and the value is a string with the data in the specified format. This Dictionary is filled only, if the PDFImportSettings property specifies the LoadEmbeddedData setting.
EmbeddedFilesSpecifies an array of EmbeddedFile objects which will be embedded in the saved document. Each file must be specified through a name and its data. (Inherited from LoadSaveSettingsBase.)
ImageSearchPathSets a file path that is used to search for resources like images or hypertext links. This path replaces all absolute file paths used in the document.
LastModificationDateGets the date the document is last modified. It is January 1, 0001 in the Gregorian calendar, if such a date is not saved in the loaded document.
LoadDocumentBackColorSpecifies whether or not the document background color is loaded. By default it is loaded.
LoadedFileGets the name and path of the file that has been loaded.
LoadedFormatVersionNot described in the reference. public int LoadedFormatVersion { get; }
LoadedStreamTypeGets the StreamType of the file that has been loaded.
LoadHypertextLinksSpecifies whether or not hypertext links are loaded. By default hypertext links are loaded.
LoadImagesSpecifies whether or not images are loaded. If set to false images are displayed through a rectangle and the image's name. By default images are loaded.
LoadSubTextPartsDOCX, DOC and RTF Formats only: Specifies whether or not bookmarks which extend over several characters are converted to SubTextParts. By default bookmarks are converted to DocumentTargets and when a bookmark extend over several characters, the first character is used as the target position.
MasterPasswordSpecifies a password for the document's access permissions. If the password is an empty string, accessing the document is not restricted. If a password is specified, the access permissions are given through the SaveSettings.DocumentAccessPermissions property. (Inherited from LoadSaveSettingsBase.)
PageMarginsGets the margins of the loaded document's pages. If the document does not contain margins the values are set to -1.
PageSizeGets the width and height of the loaded document's pages. If the document does not contain a page size the Width and Height is set to 0.
PDFImportSettingsSpecifies how the document structure is generated when a PDF document is imported. Adobe PDF format is a low-level output format. In most cases in contains only geometrical information about the single characters. A high-level document structure specifying paragraphs, tables, sections and styles is not available. The TXTextControl PDF import filter will reconstruct the original document according to the value of the PDFImportSettigs property.
ReportingMergeBlockFormatSpecifies how reporting merge blocks are handled when a document is saved. Reporting merge blocks can be saved in a document either through special document targets represented through DocumentTarget objects or through special subtextparts represented through SubTextPart objects. When a merge block is marked with document targets, the name of the starting marker begins with blockstart_ and the name of the ending marker begins with blockend_. When a merge block is marked through a subtextpart, its name begins with txmb_. (Inherited from LoadSaveSettingsBase.)
UserDefinedDocumentPropertiesGets a dictionary with all user-defined document properties contained in the loaded document. The property's value is an object of the type UserDefinedPropertyDictionary or null, if the document does not contain any user-defined property.
UserPasswordSpecifies the password for the user when the document is reopened. If the password is an empty string the document can be reopened by every user. (Inherited from LoadSaveSettingsBase.)
ValidateFormatNot described in the reference. public bool ValidateFormat { get; set; }

Methods

MethodDescription
GetDocumentPartNamesSpreadsheetML only. Returns the names of all document parts the specified document contains. Each SpreadsheetML document can contain multiple named worksheets.

Further Reading

  • PDF Conversion in .NET: Convert DOCX, HTML and more with C# –
  • Open Any Supported Document Without Knowing the Extension –
  • Using Custom Document Properties to Store Additional Document Information –
  • Reporting: Merging MS Word Documents with DocVariables –