We have been noticing recently that when we attempt to do any kind of formatting in a newly created Excel worksheet, especially if the worksheet has more than 100,000 rows.
The code snippet below is an example of how we would set the right border on a collection of data... for an excel sheet of about 400,000 rows - this code takes more than 10 minutes to run. Is there some other way we can do this in a more performant way? or is this an issue that would need to be addressed with Spire?
- Code: Select all
public void SetRightBorder(int nRow, int nCol, int nHeight, int nWidth)
{
CellRange objRange = GetRange(nRow, nCol, nHeight, nWidth);
objRange.Borders[BordersLineType.EdgeRight].LineStyle = LineStyleType.Thin;
}
private CellRange GetRange(int startRow, int startColumn, int rowHeight, int columnWidth)
{
Worksheet worksheet = _currentWorksheet;
return worksheet.Range[startRow + 1, startColumn + 1, startRow + rowHeight < startRow + 1 ? startRow + 1 : startRow + rowHeight, startColumn + columnWidth < startColumn + 1 ? startColumn + 1 : startColumn + columnWidth];
}
I am using on a 64-bit machine running Windows 11 Business. The code is in a WinForms application using C#. And my region/language is United States/English (United States).
Hopefully this information helps you in figuring out my issue & thank you for your help!