Format a whole Sheet

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
Steph.Schie
Posts: 5
Joined: Thu Aug 12, 2010 10:15 am

Format a whole Sheet

Post by Steph.Schie »

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.
Steph.Schie
Posts: 5
Joined: Thu Aug 12, 2010 10:15 am

Re: Format a whole Sheet

Post by Steph.Schie »

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!
Post Reply