Hi
Is there a way to format a whole Sheet?
For example: A standard font or backgroundcolor.
This would work i guess but may be very slow
XLS.Sheet[0].Range.ItemsRef['A1:IV65536'].FontStyle := [xfsBold];
The file also would grow i guess.
... this isnt a very elegant way of doing it.
I need to format all Cells which are filled.
Format a whole Sheet
-
- Posts: 5
- Joined: Thu Aug 12, 2010 10:15 am
Re: Format a whole Sheet
procedure FormatSheet(sheetNumber: Integer);
var firstRow, lastRow, firstCol, lastCol :Integer;
begin
XlsRw.Sheets[sheetNumber].CalcDimensionsEx;
firstRow := XlsRw.Sheets[sheetNumber].FirstRow;
lastRow := XlsRw.Sheets[sheetNumber].LastRow;
firstCol := XlsRw.Sheets[sheetNumber].FirstCol;
lastCol := XlsRw.Sheets[sheetNumber].LastCol;
XlsRw.Sheets[sheetNumber].Range.Items[firstCol,firstRow,lastCol,lastRow].FontStyle := [xfsBold];
end;
Does the job!
var firstRow, lastRow, firstCol, lastCol :Integer;
begin
XlsRw.Sheets[sheetNumber].CalcDimensionsEx;
firstRow := XlsRw.Sheets[sheetNumber].FirstRow;
lastRow := XlsRw.Sheets[sheetNumber].LastRow;
firstCol := XlsRw.Sheets[sheetNumber].FirstCol;
lastCol := XlsRw.Sheets[sheetNumber].LastCol;
XlsRw.Sheets[sheetNumber].Range.Items[firstCol,firstRow,lastCol,lastRow].FontStyle := [xfsBold];
end;
Does the job!