Table of Contents

Class ExcelTextFormatFixedWidthBase

Namespace
OfficeOpenXml
Assembly
EPPlus.dll

Describes how to import a fixed width text file.

public class ExcelTextFormatFixedWidthBase : ExcelTextFileFormat
Inheritance
ExcelTextFormatFixedWidthBase
Derived
Inherited Members

Constructors

ExcelTextFormatFixedWidthBase()

public ExcelTextFormatFixedWidthBase()

Properties

Columns

The collection of column formats.

public EPPlusReadOnlyList<ExcelTextFormatColumn> Columns { get; set; }

Property Value

EPPlusReadOnlyList<ExcelTextFormatColumn>

FormatErrorStrategy

The strategy to use when writing fixed width text files.

public FixedWidthFormatErrorStrategy FormatErrorStrategy { get; set; }

Property Value

FixedWidthFormatErrorStrategy

LineLength

The length of the line to read. If set to widths, LineLength is sum of all columnLengths. If set to positions, LineLength is set to the value of the last index of columnLengths

public int LineLength { get; set; }

Property Value

int

PaddingCharacter

Padding character for Text Can be set to null to skip trimming padding characters when reading

public char PaddingCharacter { get; set; }

Property Value

char

PaddingCharacterNumeric

Padding character for numbers.

public char? PaddingCharacterNumeric { get; set; }

Property Value

char?

Methods

ClearColumnFormats()

Clear the collection of column formats.

public void ClearColumnFormats()

SetColumnDataTypes(params eDataTypes[])

Set the data types for each column.

public void SetColumnDataTypes(params eDataTypes[] dataTypes)

Parameters

dataTypes eDataTypes[]

SetColumnLengths(params int[])

Set the column length properties of fixed width text. For reading to end of line, set last index to 0 or a negative number.

public void SetColumnLengths(params int[] lengths)

Parameters

lengths int[]

SetColumnPaddingAlignmentType(params PaddingAlignmentType[])

Set the padding type for each column.

public void SetColumnPaddingAlignmentType(params PaddingAlignmentType[] paddingTypes)

Parameters

paddingTypes PaddingAlignmentType[]

SetColumnPositions(int, params int[])

Set the column start positions of fixed width text.

public void SetColumnPositions(int lineLength, params int[] positions)

Parameters

lineLength int

The Length of a line. Set to 0 or negative to read until end of line.

positions int[]

The positions where each column starts. This array requires atleast one element.

SetColumnsNames(params string[])

Set flag for each column to be used.

public void SetColumnsNames(params string[] Names)

Parameters

Names string[]

SetUseColumns(params bool[])

Set flag for each column to be used.

public void SetUseColumns(params bool[] UseColumns)

Parameters

UseColumns bool[]