Search Results for

    Show / Hide Table of Contents

    Interface IXlsxTargetCommand

    Defines mappings between incoming dataflow row columns and columns in the output XLSX spreadsheet file. Supports writing to a rectangular area on one sheet in the XLSX file. The default address is the top left cell (i.e. "A1") on the first sheet. If there is no existing sheet, a new sheet called "Sheet1" will be created.

    Note that multiple commands can be chained together, e.g.: xtc => xtc.Name("RowNumber", "A").Name("Category", "B"). Each exporting command will write to the next column from where the previous command left off. Use Address(String) to set where to start the export, and Column(String) to skip columns.

    Mapping commands that can map multiple columns ignore already mapped columns. Use Name(String, String) to map the same column multiple times.

    Note that some of the mapping commands explicitly control in which order to write columns, while others use OrderAttribute added to the row members. You can mix the two approaches.

    Also see XLSX Spreadsheet.

    Inherited Members
    IFluentInterface.GetType()
    IFluentInterface.GetHashCode()
    IFluentInterface.ToString()
    IFluentInterface.Equals(Object)
    Namespace: actionETL.EPPlus
    Assembly: actionETL.dll
    Syntax
    public interface IXlsxTargetCommand : IFluentInterface

    Methods

    Address(String)

    Sets the top left cell address to start writing to, e.g. "B5". This can optionally include a sheet name, e.g. "'My Sheet'!B5". The default write address is the top left cell (i.e. "A1") on the first sheet. Can only be called once, and must be the first command.

    Declaration
    IXlsxTargetCommand Address(string toAddress)
    Parameters
    Type Name Description
    String toAddress

    Cell address, e.g. "B5" or "'My Sheet'!B5".

    Returns
    Type Description
    IXlsxTargetCommand

    Returns IXlsxTargetCommand so that multiple commands can be chained together.

    Exceptions
    Type Condition
    ArgumentException

    toAddress - Must specify a cell address, e.g. 'B5'.

    InvalidOperationException

    Cannot call Address(String) twice.

    See Also
    Column(String)

    Column(String)

    Sets the output column for the next output command (i.e. Name(String, String), FromNames(String[]) etc.), which allows having one or more columns within the output range that are not written to. It can only include the column name, e.g. "D" or "AF", i.e. without specifying the row number. Can be called any number of times.

    Declaration
    IXlsxTargetCommand Column(string toColumnLetters)
    Parameters
    Type Name Description
    String toColumnLetters

    Column address, e.g. "B" or "AF".

    Returns
    Type Description
    IXlsxTargetCommand

    Returns IXlsxTargetCommand so that multiple commands can be chained together.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    toColumnLetters:

    - Can only contain letters A to Z.
    - Column address can be at most 3 letters, from "A" up to "XFD".
    
    See Also
    Address(String)

    Format(String)

    Sets a format on the column(s) mapped by the previous command (i.e. Name(String, String), FromNames(String[]) etc.)

    Declaration
    IXlsxTargetCommand Format(string formatString)
    Parameters
    Type Name Description
    String formatString

    The format to set, e.g. "yyyy-mm-dd".

    Use Excel format strings, see its TEXT function. Also see How to check number formats.

    Returns
    Type Description
    IXlsxTargetCommand

    Returns IXlsxTargetCommand so that multiple commands can be chained together.

    Exceptions
    Type Condition
    ArgumentNullException

    formatString

    InvalidOperationException

    Format(String) applies to the preceding column specification, which was not found.

    FromAll(String[])

    Map from all not already mapped (readable, CanRead) row input columns to XLSX target output columns, except for any specified exclusions.

    The order of the output columns can be controlled by adding OrderAttribute to the input row columns.

    If a header row is enabled, the XLSX target columns will get the same name as the row input columns.

    Use Name(String, String) overloads to include the same source column multiple times.

    Declaration
    IXlsxTargetCommand FromAll(params string[] exceptFromSchemaNodeNames)
    Parameters
    Type Name Description
    String[] exceptFromSchemaNodeNames

    Row input columns or column schema names to exclude.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    Returns
    Type Description
    IXlsxTargetCommand

    Returns IXlsxTargetCommand so that multiple commands can be chained together.

    Exceptions
    Type Condition
    ArgumentException

    exceptFromSchemaNodeNames not found.

    ArgumentException
    • Member is not readable.
    • Member is not a supported type.
    ArgumentNullException

    exceptFromSchemaNodeNames

    ArgumentNullException

    exceptFromSchemaNodeNames

    InvalidOperationException

    Found more than one member match in type.

    FromNames(String[])

    Map from specified (but not already mapped) row input columns to XLSX output columns.

    If a header row is enabled, the XLSX target columns will get the same name as the row input columns.

    Note that the output column order is defined by the order of the parameters (and not by any OrderAttribute). columns.

    Use Name(String, String) overloads to include the same source column multiple times.

    Declaration
    IXlsxTargetCommand FromNames(params string[] fromSchemaNodeNames)
    Parameters
    Type Name Description
    String[] fromSchemaNodeNames

    Row input columns or column schema names to include.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    Returns
    Type Description
    IXlsxTargetCommand

    Returns IXlsxTargetCommand so that multiple commands can be chained together.

    Exceptions
    Type Condition
    ArgumentException

    fromSchemaNodeNames not found.

    ArgumentException
    • Member is not readable.
    • Member is not a supported type.
    ArgumentNullException

    fromSchemaNodeNames

    ArgumentNullException

    fromSchemaNodeNames

    InvalidOperationException

    Found more than one member match in type.

    Name(String)

    Map from one input column to one XLSX output column.

    Declaration
    IXlsxTargetCommand Name(string columnName)
    Parameters
    Type Name Description
    String columnName

    Name of input and output column.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    Returns
    Type Description
    IXlsxTargetCommand

    Returns IXlsxTargetCommand so that multiple commands can be chained together.

    Exceptions
    Type Condition
    ArgumentException
    • columnName not found.
    • Member is not readable.
    • Member is not a supported type.
    ArgumentNullException
    • columnName
    InvalidOperationException

    Found more than one member match in type.

    Name(String, String)

    Map from one input column to one XLSX output column.

    Note that if HeaderRow is false, toColumnName is ignored. In this case, use either the Name(String) or the FromNames(String[]) commands instead.

    Declaration
    IXlsxTargetCommand Name(string fromColumnName, string toColumnName)
    Parameters
    Type Name Description
    String fromColumnName

    Name of input column.

    Column name matching is ordinal case insensitive, but a case sensitive match takes precedence over a case insensitive match.

    String toColumnName

    Name of output column.

    Returns
    Type Description
    IXlsxTargetCommand

    Returns IXlsxTargetCommand so that multiple commands can be chained together.

    Exceptions
    Type Condition
    ArgumentException
    • fromColumnName not found.
    • Member is not readable.
    • Member is not a supported type.
    ArgumentNullException
    • fromColumnName
    • toColumnName
    InvalidOperationException

    Found more than one member match in type.

    See Also

    XlsxTargetFactory
    XlsxTarget<TInput>
    OrderAttribute
    XlsxSource<TOutput>
    In This Article
    Back to top Copyright © 2023 Envobi Ltd