You've already forked lazarus-ccr
fpspreadsheet: reformatting, cosmetic changes
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3945 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -3552,7 +3552,7 @@ end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Clears the list of cells and releases their memory.
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.RemoveAllCells;
|
||||
begin
|
||||
RemoveAllAvlTreeNodes(FCells, RemoveCellsCallback);
|
||||
@ -3626,7 +3626,7 @@ end;
|
||||
|
||||
@param ARow Row index of the cell to be removed
|
||||
@param ACol Column index of the cell to be removed
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.RemoveAndFreeCell(ARow, ACol: Cardinal);
|
||||
var
|
||||
cellnode: TAVLTreeNode;
|
||||
@ -4053,7 +4053,7 @@ end;
|
||||
|
||||
Note: An exception is raised if the cell already contains a formula (and is
|
||||
different from the ASharedFormulaBase cell).
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.UseSharedFormula(ARow, ACol: Cardinal;
|
||||
ASharedFormulaBase: PCell): PCell;
|
||||
begin
|
||||
@ -4080,7 +4080,7 @@ end;
|
||||
@param ACol The column of the cell
|
||||
@param AText The text to be written encoded in utf-8
|
||||
@return Pointer to cell created or used
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteUTF8Text(ARow, ACol: Cardinal; AText: ansistring): PCell;
|
||||
begin
|
||||
Result := GetCell(ARow, ACol);
|
||||
@ -4095,7 +4095,7 @@ end;
|
||||
|
||||
@param ACell Poiner to the cell
|
||||
@param AText The text to be written encoded in utf-8
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteUTF8Text(ACell: PCell; AText: ansistring);
|
||||
begin
|
||||
if ACell = nil then
|
||||
@ -4112,7 +4112,7 @@ end;
|
||||
@param ACol Cell column index
|
||||
@param ANumber Number to be written
|
||||
@return Pointer to cell created or used
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteNumber(ARow, ACol: Cardinal; ANumber: double): PCell;
|
||||
begin
|
||||
Result := GetCell(ARow, ACol);
|
||||
@ -4125,7 +4125,7 @@ end;
|
||||
@param ARow Cell row index
|
||||
@param ACol Cell column index
|
||||
@param ANumber Number to be written
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteNumber(ACell: PCell; ANumber: double);
|
||||
begin
|
||||
if ACell <> nil then begin
|
||||
@ -4145,7 +4145,7 @@ end;
|
||||
@param ADecimals Number of decimal places used for formatting (optional)
|
||||
@return Pointer to cell created or used
|
||||
@see TsNumberFormat
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteNumber(ARow, ACol: Cardinal; ANumber: double;
|
||||
ANumFormat: TsNumberFormat; ADecimals: Byte = 2): PCell;
|
||||
begin
|
||||
@ -4161,7 +4161,7 @@ end;
|
||||
@param ANumFormat Identifier for a built-in number format, e.g. nfFixed
|
||||
@param ADecimals Optional number of decimal places used for formatting
|
||||
@see TsNumberFormat
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteNumber(ACell: PCell; ANumber: Double;
|
||||
ANumFormat: TsNumberFormat; ADecimals: Byte = 2);
|
||||
var
|
||||
@ -4202,7 +4202,7 @@ end;
|
||||
@param ANumFormat Format identifier (nfCustom)
|
||||
@param ANumFormatString String of formatting codes (such as 'dd/mmm'
|
||||
@return Pointer to cell created or used
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteNumber(ARow, ACol: Cardinal; ANumber: Double;
|
||||
ANumFormat: TsNumberFormat; ANumFormatString: String): PCell;
|
||||
begin
|
||||
@ -4219,8 +4219,8 @@ end;
|
||||
@param ACell Pointer to the cell considered
|
||||
@param ANumber Number to be written
|
||||
@param ANumFormat Format identifier (nfCustom)
|
||||
@param ANumFormatString String of formatting codes (such as 'dd/mmm'
|
||||
--------------------------------------------------------------------------------}
|
||||
@param ANumFormatString String of formatting codes (such as 'dd/mmm' )
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteNumber(ACell: PCell; ANumber: Double;
|
||||
ANumFormat: TsNumberFormat; ANumFormatString: String);
|
||||
var
|
||||
@ -4268,7 +4268,7 @@ end;
|
||||
@return Pointer to the cell
|
||||
Note: Empty cells are useful when, for example, a border line extends
|
||||
along a range of cells including empty cells.
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteBlank(ARow, ACol: Cardinal): PCell;
|
||||
begin
|
||||
Result := GetCell(ARow, ACol);
|
||||
@ -4281,7 +4281,7 @@ end;
|
||||
@param ACel Pointer to the cell
|
||||
Note: Empty cells are useful when, for example, a border line extends
|
||||
along a range of cells including empty cells.
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteBlank(ACell: PCell);
|
||||
begin
|
||||
if ACell <> nil then begin
|
||||
@ -4297,7 +4297,7 @@ end;
|
||||
@param ACol The column of the cell
|
||||
@param AValue The boolean value
|
||||
@return Pointer to the cell
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteBoolValue(ARow, ACol: Cardinal; AValue: Boolean): PCell;
|
||||
begin
|
||||
Result := GetCell(ARow, ACol);
|
||||
@ -4309,7 +4309,7 @@ end;
|
||||
|
||||
@param ACell Pointer to the cell
|
||||
@param AValue The boolean value
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteBoolValue(ACell: PCell; AValue: Boolean);
|
||||
begin
|
||||
if ACell <> nil then begin
|
||||
@ -4330,7 +4330,7 @@ end;
|
||||
on the structure of the string, however, the value is written
|
||||
as a number, a date/time or a text.
|
||||
@return Pointer to the cell
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteCellValueAsString(ARow, ACol: Cardinal;
|
||||
AValue: String): PCell;
|
||||
begin
|
||||
@ -4347,7 +4347,7 @@ end;
|
||||
@param AValue Value to be written into the cell given as a string. Depending
|
||||
on the structure of the string, however, the value is written
|
||||
as a number, a date/time or a text.
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteCellValueAsString(ACell: PCell; AValue: String);
|
||||
var
|
||||
isPercent: Boolean;
|
||||
@ -4475,7 +4475,7 @@ end;
|
||||
In case of '?' the currency symbol defined in the
|
||||
workbook's FormatSettings is used.
|
||||
@return Pointer to the cell
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteCurrency(ARow, ACol: Cardinal; AValue: Double;
|
||||
ANumFormat: TsNumberFormat = nfCurrency; ADecimals: Integer = 2;
|
||||
ACurrencySymbol: String = '?'; APosCurrFormat: Integer = -1;
|
||||
@ -4502,7 +4502,7 @@ end;
|
||||
@param ACurrencySymbol String to be shown as currency, such as '$', or 'EUR'.
|
||||
In case of '?' the currency symbol defined in the
|
||||
workbook's FormatSettings is used.
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteCurrency(ACell: PCell; AValue: Double;
|
||||
ANumFormat: TsNumberFormat = nfCurrency; ADecimals: Integer = -1;
|
||||
ACurrencySymbol: String = '?'; APosCurrFormat: Integer = -1;
|
||||
@ -4544,7 +4544,7 @@ end;
|
||||
and negative number.
|
||||
Example: '"EUR" #,##0.00;("EUR" #,##0.00)'
|
||||
@return Pointer to the cell
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteCurrency(ARow, ACol: Cardinal; AValue: Double;
|
||||
ANumFormat: TsNumberFormat; ANumFormatString: String): PCell;
|
||||
begin
|
||||
@ -4563,7 +4563,7 @@ end;
|
||||
Can contain sections for different formatting of positive
|
||||
and negative number.
|
||||
Example: '"EUR" #,##0.00;("EUR" #,##0.00)'
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteCurrency(ACell: PCell; AValue: Double;
|
||||
ANumFormat: TsNumberFormat; ANumFormatString: String);
|
||||
var
|
||||
@ -4597,7 +4597,7 @@ end;
|
||||
Note: at least Excel xls does not recognize a separate datetime cell type:
|
||||
a datetime is stored as a (floating point) number, and the cell is formatted
|
||||
as a date (either built-in or a custom format).
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteDateTime(ARow, ACol: Cardinal; AValue: TDateTime;
|
||||
ANumFormat: TsNumberFormat = nfShortDateTime; ANumFormatStr: String = ''): PCell;
|
||||
begin
|
||||
@ -4617,7 +4617,7 @@ end;
|
||||
Note: at least Excel xls does not recognize a separate datetime cell type:
|
||||
a datetime is stored as a (floating point) number, and the cell is formatted
|
||||
as a date (either built-in or a custom format).
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteDateTime(ACell: PCell; AValue: TDateTime;
|
||||
ANumFormat: TsNumberFormat = nfShortDateTime; ANumFormatStr: String = '');
|
||||
var
|
||||
@ -4686,7 +4686,7 @@ end;
|
||||
Note: at least Excel xls does not recognize a separate datetime cell type:
|
||||
a datetime is stored as a (floating point) number, and the cell is formatted
|
||||
as a date (either built-in or a custom format).
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteDateTime(ARow, ACol: Cardinal; AValue: TDateTime;
|
||||
ANumFormatStr: String): PCell;
|
||||
begin
|
||||
@ -4705,7 +4705,7 @@ end;
|
||||
Note: at least Excel xls does not recognize a separate datetime cell type:
|
||||
a datetime is stored as a (floating point) number, and the cell is formatted
|
||||
as a date (either built-in or a custom format).
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.WriteDateTime(ACell: PCell; AValue: TDateTime;
|
||||
ANumFormatStr: String);
|
||||
begin
|
||||
@ -4723,7 +4723,7 @@ end;
|
||||
@return Pointer to the cell
|
||||
|
||||
@see TsNumberFormat
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorksheet.WriteDateTimeFormat(ARow, ACol: Cardinal;
|
||||
ANumFormat: TsNumberFormat; const ANumFormatString: String = ''): PCell;
|
||||
begin
|
||||
@ -6551,7 +6551,7 @@ end;
|
||||
Removes a specified row record from the worksheet and frees the occupied memory.
|
||||
This resets the its row height to default.
|
||||
Note: Cells in that row are retained.
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorksheet.RemoveRow(ARow: Cardinal);
|
||||
var
|
||||
AVLNode: TAVGLVLTreeNode;
|
||||
@ -6656,7 +6656,7 @@ end;
|
||||
Helper method called before saving the workbook. Clears the error log, and
|
||||
calculates the formulas in all worksheets if workbook option soCalcBeforeSaving
|
||||
is set.
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsWorkbook.PrepareBeforeSaving;
|
||||
var
|
||||
sheet: TsWorksheet;
|
||||
@ -7971,7 +7971,7 @@ end;
|
||||
BIFF5/BIFF8 can write only 64 colors, i.e
|
||||
AMaxPaletteCount = 64
|
||||
@return Palette index of the color closest to AColorValue
|
||||
--------------------------------------------------------------------------------}
|
||||
-------------------------------------------------------------------------------}
|
||||
function TsWorkbook.FindClosestColor(AColorValue: TsColorValue;
|
||||
AMaxPaletteCount: Integer = -1): TsColor;
|
||||
type
|
||||
|
@ -1480,8 +1480,7 @@ end;
|
||||
procedure TsSpreadBIFF2Writer.WriteBOF(AStream: TStream);
|
||||
begin
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_BOF));
|
||||
AStream.WriteWord(WordToLE($0004));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_BOF, 4);
|
||||
|
||||
{ Unused }
|
||||
AStream.WriteWord($0000);
|
||||
@ -1497,8 +1496,7 @@ end;
|
||||
procedure TsSpreadBIFF2Writer.WriteEOF(AStream: TStream);
|
||||
begin
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_EOF));
|
||||
AStream.WriteWord($0000);
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_EOF, 0);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
@ -1525,8 +1523,7 @@ begin
|
||||
Len := Length(lFontName);
|
||||
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_FONT));
|
||||
AStream.WriteWord(WordToLE(4 + 1 + Len * SizeOf(AnsiChar)));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_FONT, 4 + 1 + Len * SizeOf(AnsiChar));
|
||||
|
||||
{ Height of the font in twips = 1/20 of a point }
|
||||
AStream.WriteWord(WordToLE(round(font.Size*20)));
|
||||
@ -1612,8 +1609,7 @@ end;
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsSpreadBIFF2Writer.WriteFormatCount(AStream: TStream);
|
||||
begin
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_FORMATCOUNT));
|
||||
AStream.WriteWord(WordToLE(2));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_FORMATCOUNT, 2);
|
||||
AStream.WriteWord(WordToLE(21)); // there are 21 built-in formats
|
||||
end;
|
||||
|
||||
@ -1718,7 +1714,6 @@ procedure TsSpreadBIFF2Writer.WriteRPNTokenArraySize(AStream: TStream;
|
||||
ASize: Word);
|
||||
begin
|
||||
AStream.WriteByte(ASize);
|
||||
// AStream.WriteByte(Lo(ASize));
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
@ -1745,13 +1740,12 @@ begin
|
||||
len := Length(s);
|
||||
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_STRING));
|
||||
AStream.WriteWord(WordToLE(1 + len*SizeOf(Char)));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_STRING, 1 + len*SizeOf(ansichar));
|
||||
|
||||
{ Write string length }
|
||||
AStream.WriteByte(len);
|
||||
{ Write characters }
|
||||
AStream.WriteBuffer(s[1], len * SizeOf(Char));
|
||||
AStream.WriteBuffer(s[1], len * SizeOf(ansichar));
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
@ -1838,7 +1832,6 @@ type
|
||||
Col: Word;
|
||||
Attrib1, Attrib2, Attrib3: Byte;
|
||||
end;
|
||||
|
||||
var
|
||||
xf: Word;
|
||||
rec: TBlankRecord;
|
||||
@ -1981,8 +1974,7 @@ begin
|
||||
containsXF := false;
|
||||
|
||||
{ BIFF record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_ROW));
|
||||
AStream.WriteWord(WordToLE(IfThen(containsXF, 18, 13)));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_ROW, IfThen(containsXF, 18, 13));
|
||||
|
||||
{ Index of row }
|
||||
AStream.WriteWord(WordToLE(Word(ARowIndex)));
|
||||
|
@ -883,7 +883,9 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{ TsSpreadBIFF5Writer }
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TsSpreadBIFF5Writer }
|
||||
{------------------------------------------------------------------------------}
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Writes an Excel BIFF5 file to the disc
|
||||
@ -1003,8 +1005,7 @@ end;
|
||||
procedure TsSpreadBIFF5Writer.WriteBOF(AStream: TStream; ADataType: Word);
|
||||
begin
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_BOF));
|
||||
AStream.WriteWord(WordToLE(8));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_BOF, 8);
|
||||
|
||||
{ BIFF version. Should only be used if this BOF is for the workbook globals }
|
||||
if ADataType = INT_BOF_WORKBOOK_GLOBALS then
|
||||
@ -1042,8 +1043,7 @@ begin
|
||||
Len := Length(LatinSheetName);
|
||||
}
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_BOUNDSHEET));
|
||||
AStream.WriteWord(WordToLE(6 + 1 + Len));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_BOUNDSHEET, 6 + 1 + Len);
|
||||
|
||||
{ Absolute stream position of the BOF record of the sheet represented
|
||||
by this record }
|
||||
@ -1103,8 +1103,7 @@ end;
|
||||
procedure TsSpreadBIFF5Writer.WriteEOF(AStream: TStream);
|
||||
begin
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_EOF));
|
||||
AStream.WriteWord($0000);
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_EOF, $0000);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
@ -1127,8 +1126,7 @@ begin
|
||||
Len := Length(AFont.FontName);
|
||||
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_FONT));
|
||||
AStream.WriteWord(WordToLE(14 + 1 + Len));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_FONT, 14 + 1 + Len);
|
||||
|
||||
{ Height of the font in twips = 1/20 of a point }
|
||||
AStream.WriteWord(WordToLE(round(AFont.Size*20)));
|
||||
@ -1207,7 +1205,6 @@ begin
|
||||
if (ANumFormatData = nil) or (ANumFormatData.FormatString = '') then
|
||||
exit;
|
||||
|
||||
// s := UTF8ToAnsi(NumFormatList.FormatStringForWriting(AListIndex));
|
||||
fmtStr := NumFormatList.FormatStringForWriting(AListIndex);
|
||||
ansiFmtStr := ConvertEncoding(fmtStr, encodingUTF8, FCodePage);
|
||||
len := Length(ansiFmtStr);
|
||||
@ -1242,8 +1239,7 @@ end;
|
||||
procedure TsSpreadBIFF5Writer.WriteIndex(AStream: TStream);
|
||||
begin
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_INDEX));
|
||||
AStream.WriteWord(WordToLE(12));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_INDEX, 12);
|
||||
|
||||
{ Not used }
|
||||
AStream.WriteDWord(0);
|
||||
@ -1283,20 +1279,6 @@ begin
|
||||
exit;
|
||||
|
||||
ansiValue := ConvertEncoding(AValue, encodingUTF8, FCodePage);
|
||||
{
|
||||
case WorkBookEncoding of
|
||||
seLatin2: AnsiValue := UTF8ToCP1250(AValue);
|
||||
seCyrillic: AnsiValue := UTF8ToCP1251(AValue);
|
||||
seGreek: AnsiValue := UTF8ToCP1253(AValue);
|
||||
seTurkish: AnsiValue := UTF8ToCP1254(AValue);
|
||||
seHebrew: AnsiValue := UTF8ToCP1255(AValue);
|
||||
seArabic: AnsiValue := UTF8ToCP1256(AValue);
|
||||
else
|
||||
// Latin 1 is the default
|
||||
AnsiValue := UTF8ToCP1252(AValue);
|
||||
end;
|
||||
}
|
||||
|
||||
if AnsiValue = '' then begin
|
||||
// Bad formatted UTF8String (maybe ANSI?)
|
||||
if Length(AValue) <> 0 then begin
|
||||
@ -1355,18 +1337,16 @@ var
|
||||
s: ansistring;
|
||||
len: Integer;
|
||||
begin
|
||||
// s := UTF8ToAnsi(AString);
|
||||
s := ConvertEncoding(AString, encodingUTF8, FCodePage);
|
||||
len := Length(s);
|
||||
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_STRING));
|
||||
AStream.WriteWord(WordToLE(2 + len*SizeOf(Char)));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_STRING, 2 + len*SizeOf(ansichar));
|
||||
|
||||
{ Write string length }
|
||||
AStream.WriteWord(WordToLE(len));
|
||||
{ Write characters }
|
||||
AStream.WriteBuffer(s[1], len * SizeOf(Char));
|
||||
AStream.WriteBuffer(s[1], len * SizeOf(ansichar));
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
@ -1378,8 +1358,7 @@ end;
|
||||
procedure TsSpreadBIFF5Writer.WriteStyle(AStream: TStream);
|
||||
begin
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_STYLE));
|
||||
AStream.WriteWord(WordToLE(4));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_STYLE, 4);
|
||||
|
||||
{ Index to style XF and defines if it's a built-in or used defined style }
|
||||
AStream.WriteWord(WordToLE(MASK_STYLE_BUILT_IN));
|
||||
@ -1400,8 +1379,7 @@ var
|
||||
Options: Word;
|
||||
begin
|
||||
{ BIFF Record header }
|
||||
AStream.WriteWord(WordToLE(INT_EXCEL_ID_WINDOW2));
|
||||
AStream.WriteWord(WordToLE(10));
|
||||
WriteBiffHeader(AStream, INT_EXCEL_ID_WINDOW2, 10);
|
||||
|
||||
{ Options flags }
|
||||
Options :=
|
||||
@ -1444,7 +1422,7 @@ var
|
||||
begin
|
||||
{ BIFF record header }
|
||||
rec.RecordID := WordToLE(INT_EXCEL_ID_XF);
|
||||
rec.RecordSize := WordToLE(SizeOf(TBIFF5_XFRecord) - 2*SizeOf(Word));
|
||||
rec.RecordSize := WordToLE(SizeOf(TBIFF5_XFRecord) - SizeOf(TsBiffHeader));
|
||||
|
||||
{ Index to font record }
|
||||
rec.FontIndex := 0;
|
||||
|
@ -118,8 +118,10 @@ type
|
||||
|
||||
TsSpreadBIFF8Writer = class(TsSpreadBIFFWriter)
|
||||
private
|
||||
procedure WriteCommentsCallback(AComment: PsComment; ACommentIndex: Integer;
|
||||
AStream: TStream);
|
||||
procedure WriteCommentsEscherCallback(AComment: PsComment;
|
||||
ACommentIndex: Integer; AStream: TStream);
|
||||
procedure WriteCommentsNoteCallback(AComment: PsComment;
|
||||
ACommentIndex: Integer; AStream: TStream);
|
||||
|
||||
protected
|
||||
{ Record writing methods }
|
||||
@ -1595,14 +1597,19 @@ begin
|
||||
exit; // Remove after comments can be written correctly
|
||||
{$warning TODO: Fix writing of cell comments in BIFF8 (file is readable by OpenOffice, but not by Excel)}
|
||||
|
||||
IterateThroughComments(AStream, AWorksheet.Comments, WriteCommentsCallback);
|
||||
{ At first we have to write all Escher-related records for all comments. }
|
||||
IterateThroughComments(AStream, AWorksheet.Comments, WriteCommentsEscherCallback);
|
||||
{ The NOTE records for all comments follow subsequently. }
|
||||
IterateThroughComments(AStream, AWorksheet.Comments, WriteCommentsNoteCallback);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Helper method which stores the pointer to a cell in the FCommentsList if the
|
||||
cell contains a comment
|
||||
Helper method which writes all Escher-related records required for a cell
|
||||
comment:
|
||||
MSODRAWING - OBJ - MSODRAWING - TXT
|
||||
The NOTE records are written separately
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsSpreadBIFF8Writer.WriteCommentsCallback(AComment: PsComment;
|
||||
procedure TsSpreadBIFF8Writer.WriteCommentsEscherCallback(AComment: PsComment;
|
||||
ACommentIndex: Integer; AStream: TStream);
|
||||
begin
|
||||
if ACommentIndex = 0 then
|
||||
@ -1614,6 +1621,17 @@ begin
|
||||
WriteTXO(AStream, AComment);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Helper method for writing all NOTE records of a worksheet.
|
||||
The Escher-related records required for each cell comment already have been
|
||||
written.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsSpreadBIFF8Writer.WriteCommentsNoteCallback(AComment: PsComment;
|
||||
ACommentIndex: Integer; AStream: TStream);
|
||||
begin
|
||||
WriteNOTE(AStream, AComment, ACommentIndex+1);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Writes an Excel 8 DIMENSIONS record
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user