Skip to content

Add OpenXmlTableOptions to export sheets as Excel tables - #1022

Draft
virzak wants to merge 2 commits into
mini-software:masterfrom
virzak:feature/write-tables
Draft

virzak wants to merge 2 commits into
mini-software:masterfrom
virzak:feature/write-tables

Conversation

@virzak

@virzak virzak commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Part of #975

Adds OpenXmlConfiguration.Table, which writes each exported sheet's data as an Excel table in a built-in style:

var configuration = new OpenXmlConfiguration
{
    TableStyles = TableStyles.None, // let the table style format the cells
    Table = new OpenXmlTableOptions { Name = "Welds", Style = "TableStyleMedium15", ShowFilterButton = false },
};
await exporter.ExportAsync(stream, rows, configuration: configuration);
  • The table covers the header row and the data, and the sheet-level AutoFilter is left out because a sheet can't have both. Without a header row the table gets headerRowCount="0" and generated column names.

  • Following the concerns in [Feature] - Support Tables and Table Styles during Export #975, it is opt-in and only for new sheets: InsertSheet with a table throws NotSupportedException, and so do columns placed with MiniExcelColumnIndex that leave gaps.

  • Table names default to Table1, Table2 and so on per sheet. A custom Name is used for the first sheet and gets the sheet number appended on later ones.

  • The written tables round-trip through QueryTable.

  • To format a table's header without cell styles covering the table style, TableStyles.None now applies StyleOptions.HeaderStyle alignment and wrapping (not its fill), and OpenXmlHeaderStyle.RowHeight sets the header row height.

Each exported sheet gets one table over its header and data. Inserting
into an existing workbook and columns placed with gaps are rejected,
since a table can't cover either.
@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

A table formatted by its table style still needs a wrapped, aligned
header, which TableStyles.None ignored. The fill stays out so it does
not hide the table style.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant