Hello,
We observed that saving a workbook with rich text formatting using Aspose.Cells is very slow.
Please see the below sample code which creates 100K cells with part of the text coloured in red:
public sealed class Program
{
private static void Main(string[] args)
{
var sw = Stopwatch.StartNew();
using var workbook = new Workbook();
for (int row = 0; row < 1000; row++)
{
for (int col = 0; col < 100; col++)
{
var cell = workbook.Worksheets[0].Cells[row, col];
cell.PutValue($"Row{row}Col{col}");
cell.Characters(0, 4).Font.Color = Color.Red;
}
}
workbook.Save("test1.xlsx");
Console.WriteLine($"Total Execution Time: {sw.ElapsedMilliseconds}ms");
}
}
The sample takes 50s to execute:
Total Execution Time: 49930ms
As soon as we remove the rich text formatting line:
cell.Characters(0, 4).Font.Color = Color.Red;
the execution time is down to 641ms:
Total Execution Time: 641ms
.
What seems to be the issue? Is there any way to optimise this?