TextProperties Class

Text Import Settings.When the object is serialized out as xml, its qualified name is x:textPr.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlCompositeElement
      DocumentFormat.OpenXml.Spreadsheet.TextProperties

Namespace:  DocumentFormat.OpenXml.Spreadsheet
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
<ChildElementInfoAttribute(GetType(TextFields))> _
Public Class TextProperties _
    Inherits OpenXmlCompositeElement
'Usage
Dim instance As TextProperties
[ChildElementInfoAttribute(typeof(TextFields))]
public class TextProperties : OpenXmlCompositeElement

Remarks

The following table lists the possible child types:

  • TextFields <x:textFields>

[ISO/IEC 29500-1 1st Edition]

18.13.12 textPr (Text Import Settings)

This element contains all of the text import settings.

[Example: Here's an example of the XML for a text connection:

<connection id="1" name="text data" type="6" refreshedVersion="3" background="1"
saveData="1">
<textPr prompt="0" characterSet="IBM437" sourceFile="C:\Desktop\text data.txt"
delimiter="|">
    <textFields count="5">
<textField/>
<textField type="text" position="7"/>
<textField type="text" position="28"/>
<textField position="36"/>
<textField type="text" position="41"/>
</textFields>
</textPr>
</connection>

example]

Parent Elements

connection (§18.13.1)

Child Elements

Subclause

textFields (Fields)

§18.13.11

Attributes

Description

characterSet (Character Set)

Name of the character set associated with the text file. Values for this attribute are restricted to the names and aliases listed in the IANA CHARACTER SETS listing found at http://www.iana.org/assignments/character-sets.

[Note: When reading this value, if a system does not support a particular character set, the application is allowed to decide what is the best course of fallback action. end note]

If this attribute is not present then the codePage attribute are used.

The possible values for this attribute are defined by the W3C XML Schema string datatype.

comma (Comma is Delimiter)

Flag indicating whether to treat comma characters as field delimiters.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

consecutive (Consecutive Delimiters)

Flag indicating whether consecutive delimiters should be treated as just one delimiter. If this flag is true than it's possible or even likely that some rows will return more fields than others, and these fields will always fill cells in the worksheet from left to right.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

decimal (Decimal Separator)

The decimal separator character. This and the thousands attribute are used only when data in the text file contains decimal and thousands separators that are different from those used on the computer, due to a different language setting being used.

The following table shows the results when you import text into a spreadsheet application using various separators. Numeric results are displayed in the rightmost column.

System decimal separator

System thousands separator

Text file decimal separator value

Text file thousands Separator value

Text imported

Cell value (data type)

Period

Comma

Comma

Period

123.123,45

123,123.45 (numeric)

Period

Comma

Comma

Comma

123.123,45

123.123,45 (text)

Comma

Period

Comma

Period

123,123.45

123,123.45 (numeric)

Period

Comma

Period

Comma

123 123.45

123 123.45 (text)

Period

Comma

Period

Space

123 123.45

123,123.45 (numeric)

Strings values of this attribute are expected to be one character in length.

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).

delimited (Delimited File)

true if the file is Tab or character delimited. false if the file should be parsed according to fixed length fields.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

delimiter (Custom Delimiter)

User-specified character to be treated as a field delimiter. Only single characters are supported.

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).

fileType (File Type)

Ignorable attribute with enum value that defined by ST_FileType. Determines the kind of character set to use during import.

Only one of fileType and characterSet or codePage shall be specified for a textPr.

The possible values for this attribute are defined by the ST_FileType simple type (§18.18.29).

firstRow (First Row)

Indicates at what row of the file to start the data import. All unsignedInt values are permitted, although it's possible that firstRow is higher than the number of rows in the text file, in which case no data is imported.

The possible values for this attribute are defined by the W3C XML Schema unsignedInt datatype.

prompt (Prompt for File Name)

Flag indicating whether the user wants to be prompted for the file name on refresh. If false, then the user is not prompted. If true or not present, then the user is prompted.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

qualifier (Qualifier)

Character used as the text string qualifier.

The possible values for this attribute are defined by the ST_Qualifier simple type (§18.18.61).

semicolon (Semicolon is Delimiter)

Flag indicating whether to treat semicolon characters as field delimiters.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

sourceFile (Source File Name)

Path to the text file to use to import external data. Can be expressed in URI or system-specific file path notation.

[Note: Applications can decide what forms of URI they support, and whether system-specific file path notations are supported. end note]

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).

space (Space is Delimiter)

Flag indicating whether to treat space characters as field delimiters.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

tab (Tab as Delimiter)

Flag indicating whether to treat tab characters as field delimiters. If false, then tabs will not be used as delimiters. If true or not present, then they are used as delimiters.

The possible values for this attribute are defined by the W3C XML Schema boolean datatype.

thousands (Thousands Separator)

The thousands separator character. This and the decimal attribute are used only when data in the text file contains decimal and thousands separators that are different from those used on the computer, due to a different language setting being used. Please refer to the decimal attribute description above for a Table describing the behavior.

Strings values of this attribute are expected to be one character in length.

The possible values for this attribute are defined by the ST_Xstring simple type (§22.9.2.19).

[Note: The W3C XML Schema definition of this element’s content model (CT_TextPr) is located in §A.2. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

TextProperties Members

DocumentFormat.OpenXml.Spreadsheet Namespace