Advance Layouts For Merged Cells

To remove tiny columns, rows and merged cells from Word and Excel exports, set the LayoutOption property in the Bold Reports® ASP.NET Web Forms Report Writer. The benefits of these layouts are:

  • Overcomes the merging problem with tiny cells, rows, and columns in SSRS Excel and Word exporting.
  • Provides clear readability by eliminating the tiny columns, rows, and merge cells.
  • Allows you to perform data manipulations such as applying sorting, filters, and grouping in Excel.

How do I remove merged cells in Word exports?

To remove tiny columns, rows and merged cells from a Word document exported by the Report Writer, set the LayoutOption to TopLevel. The Report Writer then renders the Word document elements without a nested grid layout. The ParagraphSpacing is the distance value added between two elements in the document.

writer.WordOptions.LayoutOption = WordLayoutOptions.TopLevel;
writer.WordOptions.ParagraphSpacing = new BoldReports.Writer.ParagraphSpacing()
{
    Bottom = 0.5f,
    Top = 0.5f
};

A paragraph element is inserted between two tables in the exported document to overcome the Word document auto merging behavior. The table in the Word document is not a stand-alone object. If you draw two tables one after another, it will automatically get merged into a single table. To prevent this merging, add an empty paragraph between two tables.

How do I remove merged cells in Excel exports?

To remove tiny columns, rows and merged cells from an Excel document exported by the Report Writer, set the LayoutOption to IgnoreCellMerge. The layout gives clear readability and lets you perform data manipulations.

writer.ExcelOptions = new BoldReports.Writer.ExcelOptions()
{
    LayoutOption = BoldReports.Writer.ExcelLayoutOptions.IgnoreCellMerge
};

See also