Search Results for

    Show / Hide Table of Contents

    Class XlsxTarget<TInput>

    A dataflow worker with one Input port, which consumes incoming rows and writes them to a rectangular area on one sheet in an XLSX spreadsheet file. No driver installation is required (it uses the EPPlus library internally).

    Note: Use the factory methods in XlsxTargetFactory to create instances of this class.

    Also see XLSX Spreadsheet.

    Inheritance
    Object
    WorkerParent
    WorkerBase
    WorkerBase<XlsxTarget<TInput>>
    XlsxTarget<TInput>
    Implements
    IDisposeOnFinished
    Inherited Members
    WorkerBase<XlsxTarget<TInput>>.AddCompletedCallback(Func<XlsxTarget<TInput>, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerBase<XlsxTarget<TInput>>.AddRanCallback(Func<XlsxTarget<TInput>, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
    WorkerBase<XlsxTarget<TInput>>.AddStartingCallback(Func<XlsxTarget<TInput>, Task<ProgressStatus>>)
    WorkerBase.AddCompletedCallback(Func<WorkerBase, OutcomeStatus, Task<OutcomeStatus>>)
    WorkerBase.AddRanCallback(Func<WorkerBase, OutcomeStatus, WorkerParentChildrenState, Task<OutcomeStatus>>)
    WorkerBase.AddStartingCallback(Func<WorkerBase, Task<ProgressStatus>>)
    WorkerBase.DefaultIsStartable()
    WorkerBase.ErroredPortErrorsWorkerProtected
    WorkerBase.ErrorOutputs
    WorkerBase.EscalateError
    WorkerBase.Inputs
    WorkerBase.IsStartable
    WorkerBase.Outputs
    WorkerBase.Parent
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(WorkerBase, TLastWorker)
    WorkerBase.SucceededSequence<TLastWorker>(TLastWorker)
    WorkerParent.AddChildCompletedCallback(Action<WorkerBase>)
    WorkerParent.AddStartingChildrenCallback(Func<WorkerParent, Task<ProgressStatus>>)
    WorkerParent.BytesPerRowBuffer
    WorkerParent.Children
    WorkerParent.DisposeOnFinished<TDisposable>(TDisposable)
    WorkerParent.GetDownstreamFactory<TInput>()
    WorkerParent.HasChildren
    WorkerParent.IsCanceled
    WorkerParent.IsCompleted
    WorkerParent.IsCreated
    WorkerParent.IsError
    WorkerParent.IsFailed
    WorkerParent.IsFatal
    WorkerParent.IsRunning
    WorkerParent.IsSucceeded
    WorkerParent.KeepChildrenLevels
    WorkerParent.Locator
    WorkerParent.LogFactory
    WorkerParent.Logger
    WorkerParent.MaxRunningChildren
    WorkerParent.Name
    WorkerParent.RemoveChildren()
    WorkerParent.RescheduleChildren()
    WorkerParent.RunChildrenAsync(Boolean)
    WorkerParent.RunChildrenAsync()
    WorkerParent.Status
    WorkerParent.Item[String]
    WorkerParent.ToString()
    WorkerParent.WorkerSystem
    WorkerParent.DebugCommands
    WorkerParent.AggregateErrorOutputRows
    WorkerParent.AggregateOutputRows
    WorkerParent.AggregateWorkersCompleted
    WorkerParent.InstantCompleted
    WorkerParent.InstantCreated
    WorkerParent.InstantStarted
    WorkerParent.RunningDuration
    Namespace: actionETL.EPPlus
    Assembly: actionETL.dll
    Syntax
    public class XlsxTarget<TInput> : WorkerBase<XlsxTarget<TInput>>, IDisposeOnFinished where TInput : class
    Type Parameters
    Name Description
    TInput

    The type of each Input row, which also defines the default file headers and data types of the written file.

    Properties

    FileName

    The filename to write to. Cannot be set after the worker has started running.

    Note: This property is thread-safe.

    Declaration
    public string FileName { get; set; }
    Property Value
    Type Description
    String
    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    HeaderRow

    Gets or sets a value indicating whether to write a header row. If true, the header column names are taken from the column names of the incoming rows. Cannot be set after the worker has started running.

    Note: This property is thread-safe.

    Declaration
    public bool HeaderRow { get; set; }
    Property Value
    Type Description
    Boolean

    true (the default) to write a header row, false to not write one.

    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    Input

    Gets the input port for receiving rows from an upstream worker.

    Declaration
    public InputPort<TInput> Input { get; }
    Property Value
    Type Description
    InputPort<TInput>

    PasswordFunc

    Gets or sets the password function. If set, this function is called to retrieve the password string when the worker saves the XLSX file. Cannot be set after the worker has started running. It defaults to null.

    Note: This property is thread-safe.

    Declaration
    public Func<string> PasswordFunc { get; set; }
    Property Value
    Type Description
    Func<String>

    The password function, which must return the password to use, or null for no password.

    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    TemplateFileName

    Gets or sets the name of a template file, a copy of which will be used as a starting point when creating a new XLSX file. Defaults to null, i.e. do not use a template file. Cannot be set after the worker has started running.

    Use the template file to add charts, borders etc. as well as static data.

    TemplateFileName is mutually exclusive with UseExisting.

    Note: This property is thread-safe.

    Declaration
    public string TemplateFileName { get; set; }
    Property Value
    Type Description
    String
    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    WriteOption

    Gets or sets a value indicating whether to use or overwrite any existing file. Cannot be set after the worker has started running.

    Note: This property is thread-safe.

    Declaration
    public XlsxTargetWriteOption WriteOption { get; set; }
    Property Value
    Type Description
    XlsxTargetWriteOption

    The write option value.

    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    XlsxTargetCommands

    Gets or sets the commands that defines where to write, which columns to include, and their formatting, e.g.:

    XlsxTargetCommands = xtc => xtc
        .Address("'My Sheet'!B5")
        .FromNames("Category", "Subcategory")
        .Name("Date").Format("yyyy-mm-dd");

    Must be set before the worker runs, and cannot be set after the worker has started running.

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

    The Address() specifies the top left cell to export to, e.g. "B10", or a range, e.g. "A1:F15". The address can optionally include a sheet name, e.g. "'My Sheet'!A1". The default write 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: This property is thread-safe.

    Declaration
    public Action<IXlsxTargetCommand> XlsxTargetCommands { get; set; }
    Property Value
    Type Description
    Action<IXlsxTargetCommand>
    Exceptions
    Type Condition
    InvalidOperationException

    Cannot set the value after the worker has started running.

    Methods

    RunAsync()

    This method can be overridden to add custom functionality to the derived worker that runs before and after the row processing. In this case, the base class base.RunAsync() must be called for the worker to function correctly.

    Typically, this worker is used without overriding this method.

    Declaration
    protected override async Task<OutcomeStatus> RunAsync()
    Returns
    Type Description
    Task<OutcomeStatus>

    A Task describing the success or failure of the worker. An asynchronous async implementation would e.g. return OutcomeStatus.Succeeded on success, while a synchronous implementation would return OutcomeStatus.SucceededTask.

    Overrides
    WorkerParent.RunAsync()

    Implements

    IDisposeOnFinished

    See Also

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