How to Create and apply a cell format setting
Posted: Wed Mar 02, 2011 7:07 am
Hi
We have recently upgraded from ReadWriteII to ReadWriteII 4.
We are struggling to get our old format settings recreated after changing to the newer version.
We used to create a list of formats which we would then assign when writing out the cells of the spreadsheet we are creating.
So we create our formats as:
with FXLSWriter.Formats.Add do begin
Name := 'fmtHeader';
FontIndex := FXLSWriter.Fonts.AddIndex;
FXLSWriter.Fonts[FontIndex].Name := 'Arial';
FXLSWriter.Fonts[FontIndex].Size := 11;
FXLSWriter.Fonts[FontIndex].Charset := ANSI_CHARSET;
FXLSWriter.Fonts[FontIndex].Color := xcDarkBlue;
FXLSWriter.Fonts[FontIndex].Style := [];
FXLSWriter.Fonts[FontIndex].SubSuperScript := xssNone;
FXLSWriter.Fonts[FontIndex].Underline := xulNone;
HorizAlignment := chaGeneral;
VertAlignment := cvaTop;
Protection := [];
end;
Then later find the format index and use as below:
fmtHdr := FXLSWriter.Formats.IndexByName('fmtColumnHeader');
FXLSWriter.Sheets.Items[0].WriteString(ColIndex, FCurrentRow, fmtHdr , MemoText);
We cannot seem to get this to work in the new version of ReadWrite.
However we can set all the option on a cell e.g
FXLSWriter4.Sheets.Items[0].Cell[fColumn, FCurrentRow].FontName .FontSize .VertAlignment etc.
Can someone tell us whether it is still possible to keep our old manner of doing things or more or less how we would
go about changing this.
Thanks
We have recently upgraded from ReadWriteII to ReadWriteII 4.
We are struggling to get our old format settings recreated after changing to the newer version.
We used to create a list of formats which we would then assign when writing out the cells of the spreadsheet we are creating.
So we create our formats as:
with FXLSWriter.Formats.Add do begin
Name := 'fmtHeader';
FontIndex := FXLSWriter.Fonts.AddIndex;
FXLSWriter.Fonts[FontIndex].Name := 'Arial';
FXLSWriter.Fonts[FontIndex].Size := 11;
FXLSWriter.Fonts[FontIndex].Charset := ANSI_CHARSET;
FXLSWriter.Fonts[FontIndex].Color := xcDarkBlue;
FXLSWriter.Fonts[FontIndex].Style := [];
FXLSWriter.Fonts[FontIndex].SubSuperScript := xssNone;
FXLSWriter.Fonts[FontIndex].Underline := xulNone;
HorizAlignment := chaGeneral;
VertAlignment := cvaTop;
Protection := [];
end;
Then later find the format index and use as below:
fmtHdr := FXLSWriter.Formats.IndexByName('fmtColumnHeader');
FXLSWriter.Sheets.Items[0].WriteString(ColIndex, FCurrentRow, fmtHdr , MemoText);
We cannot seem to get this to work in the new version of ReadWrite.
However we can set all the option on a cell e.g
FXLSWriter4.Sheets.Items[0].Cell[fColumn, FCurrentRow].FontName .FontSize .VertAlignment etc.
Can someone tell us whether it is still possible to keep our old manner of doing things or more or less how we would
go about changing this.
Thanks