ExcelReportBuilder
OfficeIMO.Excel
Neutral, Excel-first wrapper for building stacked worksheet content.
Inheritance
- object
- ExcelReportBuilder
Usage
Explore 31 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 31
- Method ExcelReportBuilder.AdvanceRows
- Method ExcelReportBuilder.ApplyColumnSizing
- Method ExcelReportBuilder.BulletedList
- Method ExcelReportBuilder.BulletedListWithFill
- Method ExcelReportBuilder.Callout
- Method ExcelReportBuilder.Columns
- Method ExcelReportBuilder.ColumnsAdaptive
- Method ExcelReportBuilder.ColumnsAdaptiveRows
- Method ExcelReportBuilder.ConditionalColorScale
- Method ExcelReportBuilder.ConditionalDataBar
- Method ExcelReportBuilder.ConditionalIconSet
- Method ExcelReportBuilder.Finish
- Method ExcelReportBuilder.FlowColumns
- Method ExcelReportBuilder.FooterLogoFromUrlAsync
- Method ExcelReportBuilder.HeaderLogoFromUrlAsync
- Method ExcelReportBuilder.KpiRow
- Method ExcelReportBuilder.Margins
- Method ExcelReportBuilder.Orientation
- Method ExcelReportBuilder.Paragraph
- Method ExcelReportBuilder.PrintDefaults
- Method ExcelReportBuilder.PropertiesGrid
- Method ExcelReportBuilder.References
- Method ExcelReportBuilder.RepeatHeaderColumns
- Method ExcelReportBuilder.RepeatHeaderRows
- Method ExcelReportBuilder.Score
- Method ExcelReportBuilder.Section
- Method ExcelReportBuilder.SectionLegend
- Method ExcelReportBuilder.SectionWithAnchor
- Method ExcelReportBuilder.Spacer
- Method ExcelReportBuilder.Title
- Method ExcelSheet.Report
Methods
public ExcelImage AddImage(int row, int column, byte[] imageBytes, ExcelImageOptions? options = null) #Adds an image through the worksheet and returns its attached image.
Parameters
- row int
- column int
- imageBytes byte[]
- options OfficeIMO.Excel.ExcelImageOptions? = null
Returns
ExcelImagepublic ExcelImage AddImage(int row, int column, string path, ExcelImageOptions? options = null) #Adds an image through the worksheet and returns its attached image.
Parameters
- row int
- column int
- path string
- options OfficeIMO.Excel.ExcelImageOptions? = null
Returns
ExcelImagepublic ExcelImage AddImage(int row, int column, Stream stream, ExcelImageOptions? options = null) #Adds an image through the worksheet and returns its attached image.
Parameters
- row int
- column int
- stream System.IO.Stream
- options OfficeIMO.Excel.ExcelImageOptions? = null
Returns
ExcelImagepublic Task<ExcelImage> AddImageAsync(int row, int column, string path, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #Loads an image asynchronously through the worksheet and returns its attached image.
Parameters
- row int
- column int
- path string
- options OfficeIMO.Excel.ExcelImageOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ExcelImage>public Task<ExcelImage> AddImageAsync(int row, int column, Stream stream, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #Loads an image asynchronously through the worksheet and returns its attached image.
Parameters
- row int
- column int
- stream System.IO.Stream
- options OfficeIMO.Excel.ExcelImageOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ExcelImage>public Task<ExcelImage> AddImageAsync(int row, int column, Uri uri, ExcelImageOptions? options = null, CancellationToken cancellationToken = default) #Loads an image asynchronously through the worksheet and returns its attached image.
Parameters
- row int
- column int
- uri System.Uri
- options OfficeIMO.Excel.ExcelImageOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Task<ExcelImage>public ExcelTable AddTable(DataTable table, string? title = null, Action<ObjectFlattenerOptions>? configure = null, ExcelTableStyle style = TableStyleMedium9, bool autoFilter = true, bool freezeHeaderRow = true, Action<ExcelTableVisualOptions>? visuals = null) #Renders a fixed-schema DataTable as an editable Excel table without generic object flattening. The DataTable schema order is preserved unless the projection configuration selects another order.
Parameters
- table System.Data.DataTable
- Source table whose rows and schema are already materialized.
- title string? = null
- Optional section title and table name.
- configure System.Action<OfficeIMO.Data.ObjectFlattenerOptions>? = null
- Optional column selection, exclusion, ordering, header, and materialization-limit configuration. The fixed-schema overload defaults ObjectFlattenerOptions.MaxCells to ExcelReportBuilder.DefaultDataTableMaxCells instead of the lower generic object-flattening limit.
- style OfficeIMO.Excel.ExcelTableStyle = TableStyleMedium9
- Built-in Excel table style.
- autoFilter bool = true
- Whether table filter buttons are included.
- freezeHeaderRow bool = true
- Whether rows through the table header are frozen.
- visuals System.Action<OfficeIMO.Excel.ExcelTableVisualOptions>? = null
- Optional table visual configuration.
public ExcelTable AddTable<T>(IEnumerable<T?> items, string? title = null, Action<ObjectFlattenerOptions>? configure = null, ExcelTableStyle style = TableStyleMedium9, bool autoFilter = true, bool freezeHeaderRow = true, Action<ExcelTableVisualOptions>? visuals = null) #Flattens a sequence of objects into a table and renders it with a header row. Returns the editable native table.
Type Parameters
- T
Parameters
- items System.Collections.Generic.IEnumerable<T?>
- title string? = null
- configure System.Action<OfficeIMO.Data.ObjectFlattenerOptions>? = null
- style OfficeIMO.Excel.ExcelTableStyle = TableStyleMedium9
- autoFilter bool = true
- freezeHeaderRow bool = true
- visuals System.Action<OfficeIMO.Excel.ExcelTableVisualOptions>? = null
Returns
ExcelTablepublic ExcelReportBuilder AdvanceRows(int rows) #Advances the composer by an exact number of rows without applying themed spacing semantics. Useful after manual cell writes where the composer did not track row changes.
Parameters
- rows int
Returns
ExcelReportBuilderpublic ExcelReportBuilder ApplyColumnSizing(string? a1Range, Action<ExcelColumnSizingOptions> configure) #Applies clamped widths and optional wrap based on table headers for a given A1 range. The first row of the range is treated as the header row.
Parameters
- a1Range string?
- A1 range returned from AddTable (e.g., "A10:F42").
- configure System.Action<OfficeIMO.Excel.ExcelColumnSizingOptions>
- Configure sizing options and header categories.
Returns
ExcelReportBuilderpublic ExcelReportBuilder BulletedList(IEnumerable<string> items) #Writes a simple bulleted list, one item per row.
Parameters
- items System.Collections.Generic.IEnumerable<string>
Returns
ExcelReportBuilderpublic ExcelReportBuilder BulletedListWithFill(IEnumerable<string> items, OfficeColor fill) #Bulleted list with background fill per item row.
Parameters
- items System.Collections.Generic.IEnumerable<string>
- Items to write, one per row.
- fill OfficeIMO.OfficeColor
- Background color; native theme roles keep their theme slot.
Returns
ExcelReportBuilderpublic ExcelReportBuilder Callout(OfficeCalloutKind kind, string title, string body, int widthColumns = 8) #Inserts a simple callout (admonition) band consisting of a bold title row and a body row.
Parameters
- kind OfficeIMO.OfficeCalloutKind
- title string
- body string
- widthColumns int = 8
Returns
ExcelReportBuilderpublic ExcelReportBuilder Columns(int count, Action<ColumnComposer[]> configure, int columnWidth = 3, int gutter = 1, ExcelReportOverflowMode overflow = Throw) #Places N columns side-by-side starting at the current row. Each action receives a ColumnComposer scoped to its own column. The main composer advances to the maximum height used by the columns.
Parameters
- count int
- Number of columns (2–4 recommended).
- configure System.Action<OfficeIMO.Excel.ExcelReportBuilder.ColumnComposer[]>
- Callback that receives an array of ColumnComposer objects.
- columnWidth int = 3
- Width per column in grid columns (for relative positioning only).
- gutter int = 1
- Spacing between columns in grid columns.
- overflow OfficeIMO.Excel.ExcelReportOverflowMode = Throw
- Specifies how to handle content that exceeds the allocated width of a column.
Returns
ExcelReportBuilderpublic ExcelReportBuilder ColumnsAdaptive(IReadOnlyList<Action<ColumnComposer>> builders, int gutter = 1) #Places columns left-to-right starting at the current row using adaptive widths derived from each column's content. Each column is rendered at the computed base column and the next column starts at (previous end + 1 + gutter).
Parameters
- builders System.Collections.Generic.IReadOnlyList<System.Action<OfficeIMO.Excel.ExcelReportBuilder.ColumnComposer>>
- gutter int = 1
Returns
ExcelReportBuilderpublic ExcelReportBuilder ColumnsAdaptiveRows(IReadOnlyList<IReadOnlyList<Action<ColumnComposer>>> rows, int gutter = 1) #Renders multiple rows of adaptive columns. Each inner list is a left-to-right band; rows stack vertically.
Parameters
- rows System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IReadOnlyList<System.Action<OfficeIMO.Excel.ExcelReportBuilder.ColumnComposer>>>
- gutter int = 1
Returns
ExcelReportBuilderpublic ExcelReportBuilder ConditionalColorScale(string rangeA1, OfficeColor startColor, OfficeColor endColor) #Adds a conditional color scale to the given range.
Parameters
- rangeA1 string
- A1-style range to format.
- startColor OfficeIMO.OfficeColor
- Starting color; native theme roles keep their theme slot.
- endColor OfficeIMO.OfficeColor
- Ending color; native theme roles keep their theme slot.
Returns
ExcelReportBuilderpublic ExcelReportBuilder ConditionalDataBar(string rangeA1, OfficeColor color) #Adds a conditional data bar to the given range.
Parameters
- rangeA1 string
- A1-style range to format.
- color OfficeIMO.OfficeColor
- Bar color; native theme roles keep their theme slot.
Returns
ExcelReportBuilderpublic ExcelReportBuilder ConditionalIconSet(string rangeA1, ExcelIconSet set, bool showValue = true, bool reverse = false, double[]? percentThresholds = null, double[]? numberThresholds = null) #Adds an icon set conditional formatting rule to the given range.
Parameters
- rangeA1 string
- set OfficeIMO.Excel.ExcelIconSet
- showValue bool = true
- reverse bool = false
- percentThresholds double[]? = null
- numberThresholds double[]? = null
Returns
ExcelReportBuilderpublic ExcelReportBuilder Finish(bool autoFitColumns = true, bool autoFitRows = false) #Applies optional autofit operations and returns the composer.
Parameters
- autoFitColumns bool = true
- autoFitRows bool = false
Returns
ExcelReportBuilderpublic ExcelReportBuilder FlowColumns(IReadOnlyList<IReadOnlyList<Action<ColumnComposer>>> columnGroups, int columnWidth = 12, int gutter = 2) #Renders a sequence of column blocks left-to-right using a fixed number of columns per band. Each band uses ExcelReportBuilder.Columns under the hood and advances the composer by the tallest block in that band.
Parameters
- columnGroups System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IReadOnlyList<System.Action<OfficeIMO.Excel.ExcelReportBuilder.ColumnComposer>>>
- columnWidth int = 12
- gutter int = 2
Returns
ExcelReportBuilderpublic ExcelReportBuilder KpiRow(IEnumerable<ValueTuple<string, object?>> kpis, int perRow = 3, OfficeColor? labelFill = null) #Renders a compact KPI row of label/value pairs.
Parameters
- kpis System.Collections.Generic.IEnumerable<System.ValueTuple<string, object?>>
- Label/value pairs to render.
- perRow int = 3
- Number of KPIs per row.
- labelFill OfficeIMO.OfficeColor? = null
- Optional label fill; null uses the report key fill.
Returns
ExcelReportBuilderpublic ExcelReportBuilder Margins(ExcelMarginPreset preset) #Applies a margin preset.
Parameters
- preset OfficeIMO.Excel.ExcelMarginPreset
Returns
ExcelReportBuilderpublic ExcelReportBuilder Margins(OfficeLength left, OfficeLength right, OfficeLength top, OfficeLength bottom, OfficeLength? header = null, OfficeLength? footer = null) #Sets physical margins; omitted header/footer margins are 0.3 inches.
Parameters
- left OfficeIMO.OfficeLength
- right OfficeIMO.OfficeLength
- top OfficeIMO.OfficeLength
- bottom OfficeIMO.OfficeLength
- header OfficeIMO.OfficeLength? = null
- footer OfficeIMO.OfficeLength? = null
Returns
ExcelReportBuilderpublic ExcelReportBuilder Orientation(OfficePageOrientation orientation) #Sets page orientation (Portrait/Landscape).
Parameters
- orientation OfficeIMO.OfficePageOrientation
Returns
ExcelReportBuilderpublic ExcelReportBuilder Paragraph(string text, int widthColumns = 6) #Writes a paragraph-like line of text.
Parameters
- text string
- widthColumns int = 6
Returns
ExcelReportBuilderpublic ExcelReportBuilder PrintDefaults(bool showGridlines = false, uint fitToWidth = 1, uint fitToHeight = 0, string? printAreaA1 = null) #Applies sensible print defaults: gridlines off, fit to width, and optional print area.
Parameters
- showGridlines bool = false
- fitToWidth uint = 1
- fitToHeight uint = 0
- printAreaA1 string? = null
Returns
ExcelReportBuilderpublic ExcelReportBuilder PropertiesGrid(IEnumerable<ValueTuple<string, object?>> properties, int columns = 2) #Renders a compact grid of key/value pairs.
Parameters
- properties System.Collections.Generic.IEnumerable<System.ValueTuple<string, object?>>
- columns int = 2
Returns
ExcelReportBuilderpublic ExcelReportBuilder References(IEnumerable<string> urls) #Writes a simple References section with each URL as a hyperlink.
Parameters
- urls System.Collections.Generic.IEnumerable<string>
Returns
ExcelReportBuilderpublic ExcelReportBuilder RepeatHeaderColumns(int firstCol, int lastCol) #Repeats header columns when printing (1-based inclusive).
Parameters
- firstCol int
- lastCol int
Returns
ExcelReportBuilderpublic ExcelReportBuilder RepeatHeaderRows(int firstRow, int lastRow) #Repeats header rows when printing (1-based inclusive).
Parameters
- firstRow int
- lastRow int
Returns
ExcelReportBuilderpublic ExcelReportBuilder Score(string label, double value, double min = 0, double max = 10) #Writes a labeled numeric score with a data bar visualization.
Parameters
- label string
- value double
- min double = 0
- max double = 10
Returns
ExcelReportBuilderpublic ExcelReportBuilder Section(string text) #Writes a section header (bold with themed background).
Parameters
- text string
Returns
ExcelReportBuilderpublic ExcelReportBuilder SectionLegend(string? title, IReadOnlyList<string> headers, IEnumerable<IReadOnlyList<string>> rows, IDictionary<string, OfficeColor>? firstColumnFillByValue = null, OfficeColor? headerFill = null) #Renders a compact legend block with an optional title, column headers, and rows. Optionally colors the first column using a value→color mapping.
Parameters
- title string?
- Optional section title.
- headers System.Collections.Generic.IReadOnlyList<string>
- Legend column headers.
- rows System.Collections.Generic.IEnumerable<System.Collections.Generic.IReadOnlyList<string>>
- Legend row values.
- firstColumnFillByValue System.Collections.Generic.IDictionary<string, OfficeIMO.OfficeColor>? = null
- Optional first-column colors, using the dictionary's key comparer.
- headerFill OfficeIMO.OfficeColor? = null
- Optional header fill; null uses the report key fill.
Returns
ExcelReportBuilderpublic ExcelReportBuilder SectionWithAnchor(string text, string? anchorName = null, bool backToTopLink = true, string backToTopText = "↑ Top") #Inserts a section header and a back-to-top link (explicit A1 link).
Parameters
- text string
- anchorName string? = null
- backToTopLink bool = true
- backToTopText string = "↑ Top"
Returns
ExcelReportBuilderpublic ExcelReportBuilder Spacer(int rows = -1) #Adds vertical spacing by advancing the current row.
Parameters
- rows int = -1
- Number of rows to skip; when negative uses the theme default.
Returns
ExcelReportBuilderpublic ExcelReportBuilder Title(string text, string? subtitle = null) #Writes a title (bold with themed background) and optional subtitle.
Parameters
- text string
- subtitle string? = null
Returns
ExcelReportBuilderInherited Methods
Properties
public int CurrentRow { get; } #Current row where the next write occurs (1-based).
Fields
public const long DefaultDataTableMaxCells #Default maximum number of cells written by the fixed-schema DataTable overload, including the header row.
5000000