I have Delphi (Delphi 2009) application, that uses Excel_TLB commands for writing into Excel file. I need not only write the data in the cells, but also assign custom format to the cells. It is done cell-by-cell bases and the typical code for one cell is:
FWS.Cells.Item[CurrLine, 4].Value2:='some data';
FWS.Cells.Item[CurrLine, 4].Font.Name:='Times New Roman';
FWS.Cells.Item[CurrLine, 4].Font.Size:=9;
FWS.Cells.Item[CurrLine, 4].Font.Bold:=True;
FWS.Cells.Item[CurrLine, 4].Font.Italic:=True;
FWS.Cells.Item[CurrLine, 4].HorizontalAlignment:=xlHAlignLeft;
I have approximately 6000*5 cells and such writing and formatting takes up to 1 minute of time. That is lot of time. The data writing itself is very fast, but formatting makes the most of time. I know that assignment of formats to the entire regions makes things faster, but that is not option for me. My regions are very complex and not in one bulk.
Are there options for Excel to disable some processing during formatting so, that I can speed up my formatting? I do all the work in background/invisible state, then save the file to the disk and then I open it with ShellExecute.