Completed
Last Updated: 08 May 2023 13:06 by ADMIN
Release R2 2023
Daniel
Created on: 19 Apr 2023 09:05
Category: SpreadProcessing
Type: Bug Report
0
SpreadProcessing: Applying text format to a column, also sets the format to the next column

Applying text format to a column also sets the format to the next column.

This happens when the columns have a size different from the default and two consecutive columns with different format also have the same size. This can be worked around with a slight change in the column sizes:

int columnCount = worksheet.UsedCellRange.ColumnCount;

for(int i = 1; i < columnCount; i++)
{
    ColumnWidth colWidth = worksheet.Columns[i].GetWidth().Value;
    if(colWidth.Value != SpreadsheetDefaultValues.DefaultColumnWidth)
    {
        ColumnWidth previousColWidth = worksheet.Columns[i - 1].GetWidth().Value;

        if(colWidth.Equals(previousColWidth))
        {
            worksheet.Columns[i].SetWidth(new ColumnWidth(colWidth.Value + 1, colWidth.IsCustom));
        }
    }
}

0 comments