fpspreadsheet: Further reduction of hints and warnings

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3206 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-06-20 15:58:22 +00:00
parent f9aede8d35
commit d0927d2d03
12 changed files with 104 additions and 31 deletions

View File

@ -290,7 +290,6 @@ procedure TOLEStorage.WriteDirectoryEntry(AStream: TStream; AName: widestring;
EntryType, EntryColor: Byte; AIsStorage: Boolean; EntryType, EntryColor: Byte; AIsStorage: Boolean;
AFirstSecID, AStreamSize: Cardinal); AFirstSecID, AStreamSize: Cardinal);
var var
i: Integer;
EntryName: array[0..31] of WideChar; EntryName: array[0..31] of WideChar;
begin begin
{ Contents of the directory entry structure: { Contents of the directory entry structure:
@ -695,8 +694,6 @@ procedure TOLEStorage.WriteOLEFile(AFileName: string;
const AStreamName: UTF8String); const AStreamName: UTF8String);
var var
cbWritten: Cardinal; cbWritten: Cardinal;
AFileStream: TFileStream;
i, x: Cardinal;
lMode: Word; lMode: Word;
begin begin
// The behavior of LCL classes is failling to write to existing file, // The behavior of LCL classes is failling to write to existing file,

View File

@ -165,11 +165,6 @@ implementation
uses uses
TypInfo, StrUtils, fpsutils; TypInfo, StrUtils, fpsutils;
const
COMPARE_STR: array[TsCompareOperation] of string = (
'', '=', '<>', '<', '>', '<=', '>'
);
{ TsNumFormatParser } { TsNumFormatParser }

View File

@ -856,6 +856,8 @@ var
Hours, Minutes, Seconds, Days: integer; Hours, Minutes, Seconds, Days: integer;
HoursPos, MinutesPos, SecondsPos: integer; HoursPos, MinutesPos, SecondsPos: integer;
begin begin
Unused(AFormatStr);
// Format expects ISO 8601 type date string or // Format expects ISO 8601 type date string or
// time string // time string
fmt := DefaultFormatSettings; fmt := DefaultFormatSettings;
@ -1497,6 +1499,7 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
hasColor: Boolean; hasColor: Boolean;
begin begin
fmt := ''; fmt := '';
cs := '';
hasColor := false; hasColor := false;
node := ANumFormatNode.FirstChild; node := ANumFormatNode.FirstChild;
while Assigned(node) do begin while Assigned(node) do begin
@ -1666,7 +1669,7 @@ procedure TsSpreadOpenDocReader.ReadNumFormats(AStylesNode: TDOMNode);
procedure ReadTextStyle(ANumFormatNode: TDOMNode; ANumFormatName: String); procedure ReadTextStyle(ANumFormatNode: TDOMNode; ANumFormatName: String);
var var
node, childNode: TDOMNode; node, childNode: TDOMNode;
nf: TsNumberFormat; nf: TsNumberFormat = nfGeneral;
fmt: String; fmt: String;
nodeName: String; nodeName: String;
begin begin
@ -2776,6 +2779,8 @@ procedure TsSpreadOpenDocWriter.WriteToFile(const AFileName: string;
var var
FZip: TZipper; FZip: TZipper;
begin begin
Unused(AOverwriteExisting);
{ Fill the strings with the contents of the files } { Fill the strings with the contents of the files }
WriteMimetype(); WriteMimetype();
@ -2822,6 +2827,7 @@ end;
procedure TsSpreadOpenDocWriter.WriteToStream(AStream: TStream); procedure TsSpreadOpenDocWriter.WriteToStream(AStream: TStream);
begin begin
Unused(AStream);
// Not supported at the moment // Not supported at the moment
raise Exception.Create('TsSpreadOpenDocWriter.WriteToStream not supported'); raise Exception.Create('TsSpreadOpenDocWriter.WriteToStream not supported');
end; end;
@ -2829,6 +2835,8 @@ end;
procedure TsSpreadOpenDocWriter.WriteFormula(AStream: TStream; const ARow, procedure TsSpreadOpenDocWriter.WriteFormula(AStream: TStream; const ARow,
ACol: Cardinal; const AFormula: TsFormula; ACell: PCell); ACol: Cardinal; const AFormula: TsFormula; ACell: PCell);
begin begin
Unused(AStream, ARow, ACol);
Unused(AFormula, ACell);
{ // The row should already be the correct one { // The row should already be the correct one
FContent := FContent + FContent := FContent +
' <table:table-cell office:value-type="string">' + LineEnding + ' <table:table-cell office:value-type="string">' + LineEnding +
@ -2850,6 +2858,9 @@ var
lStyle: String = ''; lStyle: String = '';
lIndex: Integer; lIndex: Integer;
begin begin
Unused(AStream, ACell);
Unused(ARow, ACol);
// Write empty cell only if it has formatting // Write empty cell only if it has formatting
if ACell^.UsedFormattingFields <> [] then begin if ACell^.UsedFormattingFields <> [] then begin
lIndex := FindFormattingInList(ACell); lIndex := FindFormattingInList(ACell);
@ -3080,6 +3091,9 @@ var
lStyle: string = ''; lStyle: string = '';
lIndex: Integer; lIndex: Integer;
begin begin
Unused(AStream, ACell);
Unused(ARow, ACol);
if ACell^.UsedFormattingFields <> [] then begin if ACell^.UsedFormattingFields <> [] then begin
lIndex := FindFormattingInList(ACell); lIndex := FindFormattingInList(ACell);
lStyle := ' table:style-name="ce' + IntToStr(lIndex) + '" '; lStyle := ' table:style-name="ce' + IntToStr(lIndex) + '" ';
@ -3102,6 +3116,9 @@ var
lIndex: Integer; lIndex: Integer;
valType: String; valType: String;
begin begin
Unused(AStream, ACell);
Unused(ARow, ACol);
valType := 'float'; valType := 'float';
if ACell^.UsedFormattingFields <> [] then begin if ACell^.UsedFormattingFields <> [] then begin
lIndex := FindFormattingInList(ACell); lIndex := FindFormattingInList(ACell);
@ -3147,6 +3164,9 @@ var
lIndex: Integer; lIndex: Integer;
isTimeOnly: Boolean; isTimeOnly: Boolean;
begin begin
Unused(AStream, ACell);
Unused(ARow, ACol);
if ACell^.UsedFormattingFields <> [] then begin if ACell^.UsedFormattingFields <> [] then begin
lIndex := FindFormattingInList(ACell); lIndex := FindFormattingInList(ACell);
lStyle := 'table:style-name="ce' + IntToStr(lIndex) + '" '; lStyle := 'table:style-name="ce' + IntToStr(lIndex) + '" ';

View File

@ -476,10 +476,9 @@ type
procedure WriteFormula(ARow, ACol: Cardinal; AFormula: TsFormula); procedure WriteFormula(ARow, ACol: Cardinal; AFormula: TsFormula);
procedure WriteNumber(ARow, ACol: Cardinal; ANumber: double; procedure WriteNumber(ARow, ACol: Cardinal; ANumber: double;
AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2; AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2); overload;
ACurrencySymbol: String = ''); overload; procedure WriteNumber(ACell: PCell; ANumber: Double;
procedure WriteNumber(ACell: PCell; ANumber: Double; AFormat: TsNumberFormat = nfGeneral; AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2); overload;
ADecimals: Byte = 2; ACurrencySymbol: String = ''); overload;
procedure WriteNumber(ARow, ACol: Cardinal; ANumber: double; procedure WriteNumber(ARow, ACol: Cardinal; ANumber: double;
AFormat: TsNumberFormat; AFormatString: String); overload; AFormat: TsNumberFormat; AFormatString: String); overload;
procedure WriteNumber(ACell: PCell; ANumber: Double; procedure WriteNumber(ACell: PCell; ANumber: Double;
@ -1193,6 +1192,7 @@ end;
} }
procedure TsWorksheet.RemoveCallback(data, arg: pointer); procedure TsWorksheet.RemoveCallback(data, arg: pointer);
begin begin
Unused(arg);
{ The strings and dyn arrays must be reset to nil content manually, because { The strings and dyn arrays must be reset to nil content manually, because
FreeMem only frees the record mem, without checking its content } FreeMem only frees the record mem, without checking its content }
PCell(data).UTF8StringValue := ''; PCell(data).UTF8StringValue := '';
@ -1649,7 +1649,7 @@ begin
cctDateTime: cctDateTime:
Result := DateTimeToStrNoNaN(DateTimeValue, NumberFormat, NumberFormatStr); Result := DateTimeToStrNoNaN(DateTimeValue, NumberFormat, NumberFormatStr);
cctBool: cctBool:
Result := IfThen(BoolValue, lpTRUE, lpFALSE); Result := StrUtils.IfThen(BoolValue, lpTRUE, lpFALSE);
cctError: cctError:
case TsErrorValue(ErrorValue) of case TsErrorValue(ErrorValue) of
errEmptyIntersection : Result := lpErrEmptyIntersection; errEmptyIntersection : Result := lpErrEmptyIntersection;
@ -1912,18 +1912,15 @@ end;
@param ANumber The number to be written @param ANumber The number to be written
@param AFormat The format identifier, e.g. nfFixed (optional) @param AFormat The format identifier, e.g. nfFixed (optional)
@param ADecimals The number of decimals used for formatting (optional) @param ADecimals The number of decimals used for formatting (optional)
@param ACurrencySymbol The currency symbol in case of currency format (nfCurrency)
} }
procedure TsWorksheet.WriteNumber(ARow, ACol: Cardinal; ANumber: double; procedure TsWorksheet.WriteNumber(ARow, ACol: Cardinal; ANumber: double;
AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2; AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2);
ACurrencySymbol: String = '');
begin begin
WriteNumber(GetCell(ARow, ACol), ANumber, AFormat, ADecimals, ACurrencySymbol); WriteNumber(GetCell(ARow, ACol), ANumber, AFormat, ADecimals);
end; end;
procedure TsWorksheet.WriteNumber(ACell: PCell; ANumber: Double; procedure TsWorksheet.WriteNumber(ACell: PCell; ANumber: Double;
AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2; AFormat: TsNumberFormat = nfGeneral; ADecimals: Byte = 2);
ACurrencySymbol: String = '');
begin begin
if IsDateTimeFormat(AFormat) or IsCurrencyFormat(AFormat) then if IsDateTimeFormat(AFormat) or IsCurrencyFormat(AFormat) then
raise Exception.Create(lpInvalidNumberFormat); raise Exception.Create(lpInvalidNumberFormat);
@ -2694,6 +2691,7 @@ end;
} }
procedure TsWorkbook.RemoveWorksheetsCallback(data, arg: pointer); procedure TsWorkbook.RemoveWorksheetsCallback(data, arg: pointer);
begin begin
Unused(arg);
TsWorksheet(data).Free; TsWorksheet(data).Free;
end; end;
@ -3488,6 +3486,7 @@ end;
procedure TsCustomNumFormatList.ConvertBeforeWriting(var AFormatString: String; procedure TsCustomNumFormatList.ConvertBeforeWriting(var AFormatString: String;
var ANumFormat: TsNumberFormat); var ANumFormat: TsNumberFormat);
begin begin
Unused(AFormatString, ANumFormat);
// nothing to do here. But see, e.g., xlscommon.TsBIFFNumFormatList // nothing to do here. But see, e.g., xlscommon.TsBIFFNumFormatList
end; end;
@ -3498,7 +3497,7 @@ end;
procedure TsCustomNumFormatList.AnalyzeAndAdd(AFormatIndex: Integer; procedure TsCustomNumFormatList.AnalyzeAndAdd(AFormatIndex: Integer;
AFormatString: String); AFormatString: String);
var var
nf: TsNumberFormat; nf: TsNumberFormat = nfGeneral;
begin begin
if FindByIndex(AFormatIndex) > -1 then if FindByIndex(AFormatIndex) > -1 then
exit; exit;
@ -3717,6 +3716,7 @@ end;
procedure TsCustomSpreadReader.ReadFromStrings(AStrings: TStrings; procedure TsCustomSpreadReader.ReadFromStrings(AStrings: TStrings;
AData: TsWorkbook); AData: TsWorkbook);
begin begin
Unused(AStrings, AData);
raise Exception.Create(lpUnsupportedReadFormat); raise Exception.Create(lpUnsupportedReadFormat);
end; end;
@ -3800,6 +3800,7 @@ end;
Must be overridden by descendants. See BIFF2 } Must be overridden by descendants. See BIFF2 }
procedure TsCustomSpreadWriter.FixFormat(ACell: PCell); procedure TsCustomSpreadWriter.FixFormat(ACell: PCell);
begin begin
Unused(ACell);
// to be overridden // to be overridden
end; end;
@ -3821,6 +3822,8 @@ procedure TsCustomSpreadWriter.ListAllFormattingStylesCallback(ACell: PCell; ASt
var var
Len: Integer; Len: Integer;
begin begin
Unused(AStream);
FixFormat(ACell); FixFormat(ACell);
if ACell^.UsedFormattingFields = [] then Exit; if ACell^.UsedFormattingFields = [] then Exit;
@ -3859,6 +3862,8 @@ var
fmt: string; fmt: string;
nf: TsNumberFormat; nf: TsNumberFormat;
begin begin
Unused(AStream);
if ACell^.NumberFormat = nfGeneral then if ACell^.NumberFormat = nfGeneral then
exit; exit;
@ -4026,18 +4031,24 @@ end;
procedure TsCustomSpreadWriter.WriteToStrings(AStrings: TStrings); procedure TsCustomSpreadWriter.WriteToStrings(AStrings: TStrings);
begin begin
Unused(AStrings);
raise Exception.Create(lpUnsupportedWriteFormat); raise Exception.Create(lpUnsupportedWriteFormat);
end; end;
procedure TsCustomSpreadWriter.WriteFormula(AStream: TStream; const ARow, procedure TsCustomSpreadWriter.WriteFormula(AStream: TStream; const ARow,
ACol: Cardinal; const AFormula: TsFormula; ACell: PCell); ACol: Cardinal; const AFormula: TsFormula; ACell: PCell);
begin begin
Unused(AStream, ARow, ACol);
Unused(AFormula, ACell);
// Silently dump the formula; child classes should implement their own support // Silently dump the formula; child classes should implement their own support
end; end;
procedure TsCustomSpreadWriter.WriteRPNFormula(AStream: TStream; const ARow, procedure TsCustomSpreadWriter.WriteRPNFormula(AStream: TStream; const ARow,
ACol: Cardinal; const AFormula: TsRPNFormula; ACell: PCell); ACol: Cardinal; const AFormula: TsRPNFormula; ACell: PCell);
begin begin
Unused(AStream, ARow, ACol);
Unused(AFormula, ACell);
// Silently dump the formula; child classes should implement their own support // Silently dump the formula; child classes should implement their own support
end; end;

View File

@ -210,6 +210,7 @@ procedure TsWorksheetChartSource.LoadPropertiesFromStrings(AXInterval,
var var
lXCount, lYCount: Integer; lXCount, lYCount: Integer;
begin begin
Unused(AXTitle, AYTitle, ATitle);
ParseIntervalString(AXInterval, FXFirstCellRow, FXFirstCellCol, lXCount, FXSelectionDirection); ParseIntervalString(AXInterval, FXFirstCellRow, FXFirstCellCol, lXCount, FXSelectionDirection);
ParseIntervalString(AYInterval, FYFirstCellRow, FYFirstCellCol, lYCount, FYSelectionDirection); ParseIntervalString(AYInterval, FYFirstCellRow, FYFirstCellCol, lYCount, FYSelectionDirection);
if lXCount <> lYCount then raise Exception.Create( if lXCount <> lYCount then raise Exception.Create(

View File

@ -108,7 +108,6 @@ type
protected protected
{ Protected declarations } { Protected declarations }
procedure DefaultDrawCell(ACol, ARow: Integer; var ARect: TRect; AState: TGridDrawState); override;
procedure DoPrepareCanvas(ACol, ARow: Integer; AState: TGridDrawState); override; procedure DoPrepareCanvas(ACol, ARow: Integer; AState: TGridDrawState); override;
procedure DrawAllRows; override; procedure DrawAllRows; override;
procedure DrawCellBorders; overload; procedure DrawCellBorders; overload;
@ -146,6 +145,7 @@ type
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure BeginUpdate; procedure BeginUpdate;
procedure DefaultDrawCell(ACol, ARow: Integer; var ARect: TRect; AState: TGridDrawState); override;
procedure EditingDone; override; procedure EditingDone; override;
procedure EndUpdate; procedure EndUpdate;
procedure GetSheets(const ASheets: TStrings); procedure GetSheets(const ASheets: TStrings);
@ -540,6 +540,7 @@ end;
procedure TsCustomWorksheetGrid.ChangedCellHandler(ASender: TObject; ARow, ACol:Cardinal); procedure TsCustomWorksheetGrid.ChangedCellHandler(ASender: TObject; ARow, ACol:Cardinal);
begin begin
Unused(ASender, ARow, ACol);
if FLockCount = 0 then Invalidate; if FLockCount = 0 then Invalidate;
end; end;
@ -550,6 +551,7 @@ procedure TsCustomWorksheetGrid.ChangedFontHandler(ASender: TObject; ARow, ACol:
var var
lRow: PRow; lRow: PRow;
begin begin
Unused(ASender, ACol);
if (FWorksheet <> nil) then begin if (FWorksheet <> nil) then begin
lRow := FWorksheet.FindRow(ARow); lRow := FWorksheet.FindRow(ARow);
if lRow = nil then begin if lRow = nil then begin
@ -717,7 +719,7 @@ procedure TsCustomWorksheetGrid.DrawAllRows;
var var
cliprect: TRect; cliprect: TRect;
rgn: HRGN; rgn: HRGN;
tmp: Integer; tmp: Integer = 0;
begin begin
inherited; inherited;
@ -852,6 +854,7 @@ end;
dashed rectangle here, but the thick Excel-like rectangle. } dashed rectangle here, but the thick Excel-like rectangle. }
procedure TsCustomWorksheetGrid.DrawFocusRect(aCol, aRow: Integer; ARect: TRect); procedure TsCustomWorksheetGrid.DrawFocusRect(aCol, aRow: Integer; ARect: TRect);
begin begin
Unused(ACol, ARow, ARect);
// Nothing do to // Nothing do to
end; end;

View File

@ -122,6 +122,10 @@ function HTMLLengthStrToPts(AValue: String): Double;
function HTMLColorStrToColor(AValue: String): TsColorValue; function HTMLColorStrToColor(AValue: String): TsColorValue;
function ColorToHTMLColorStr(AValue: TsColorValue): String; function ColorToHTMLColorStr(AValue: TsColorValue): String;
procedure Unused(const A1);
procedure Unused(const A1, A2);
procedure Unused(const A1, A2, A3);
var var
ScreenPixelsPerInch: Integer = 96; ScreenPixelsPerInch: Integer = 96;
@ -191,8 +195,10 @@ begin
end; end;
function WideStringToLE(const AValue: WideString): WideString; function WideStringToLE(const AValue: WideString): WideString;
{$IFNDEF FPC}
var var
j: integer; j: integer;
{$ENDIF}
begin begin
{$IFDEF FPC} {$IFDEF FPC}
{$IFDEF FPC_LITTLE_ENDIAN} {$IFDEF FPC_LITTLE_ENDIAN}
@ -209,8 +215,10 @@ begin
end; end;
function WideStringLEToN(const AValue: WideString): WideString; function WideStringLEToN(const AValue: WideString): WideString;
{$IFNDEF FPC}
var var
j: integer; j: integer;
{$ENDIF}
begin begin
{$IFDEF FPC} {$IFDEF FPC}
{$IFDEF FPC_LITTLE_ENDIAN} {$IFDEF FPC_LITTLE_ENDIAN}
@ -1263,13 +1271,12 @@ var
ResultLen: integer; ResultLen: integer;
ResultBuffer: array[0..255] of char; ResultBuffer: array[0..255] of char;
ResultCurrent: pchar; ResultCurrent: pchar;
(* ---- not needed here ---
{$IFDEF MSWindows} {$IFDEF MSWindows}
isEnable_E_Format : Boolean; isEnable_E_Format : Boolean;
isEnable_G_Format : Boolean; isEnable_G_Format : Boolean;
eastasiainited : boolean; eastasiainited : boolean;
{$ENDIF MSWindows}
(* ---- not needed here ---
{$IFDEF MSWindows}
procedure InitEastAsia; procedure InitEastAsia;
var ALCID : LCID; var ALCID : LCID;
PriLangID , SubLangID : Word; PriLangID , SubLangID : Word;
@ -1342,7 +1349,6 @@ var
var var
Year, Month, Day, DayOfWeek, Hour, Minute, Second, MilliSecond: word; Year, Month, Day, DayOfWeek, Hour, Minute, Second, MilliSecond: word;
DT : TDateTime;
procedure StoreFormat(const FormatStr: string; Nesting: Integer; TimeFlag: Boolean); procedure StoreFormat(const FormatStr: string; Nesting: Integer; TimeFlag: Boolean);
var var
@ -1577,10 +1583,11 @@ var
end; end;
end; end;
begin begin (*
{$ifdef MSWindows} {$ifdef MSWindows}
eastasiainited:=false; eastasiainited:=false;
{$endif MSWindows} {$endif MSWindows}
*)
DecodeDateFully(DateTime, Year, Month, Day, DayOfWeek); DecodeDateFully(DateTime, Year, Month, Day, DayOfWeek);
DecodeTime(DateTime, Hour, Minute, Second, MilliSecond); DecodeTime(DateTime, Hour, Minute, Second, MilliSecond);
ResultLen := 0; ResultLen := 0;
@ -1611,5 +1618,20 @@ begin
DateTimeToString(Result, FormatStr, DateTime, FormatSettings,Options); DateTimeToString(Result, FormatStr, DateTime, FormatSettings,Options);
end; end;
{ "Borrowed" from TAChart: silence warnings of unused parameters }
{$PUSH}{$HINTS OFF}
procedure Unused(const A1);
begin
end;
procedure Unused(const A1, A2);
begin
end;
procedure Unused(const A1, A2, A3);
begin
end;
{$POP}
end. end.

View File

@ -212,6 +212,8 @@ procedure TsBIFF2NumFormatList.ConvertBeforeWriting(var AFormatString: String;
var var
parser: TsNumFormatParser; parser: TsNumFormatParser;
begin begin
Unused(ANumFormat);
if AFormatString = '' then if AFormatString = '' then
AFormatString := 'General' AFormatString := 'General'
else begin else begin
@ -401,6 +403,7 @@ end;
// Read the FORMAT record for formatting numerical data // Read the FORMAT record for formatting numerical data
procedure TsSpreadBIFF2Reader.ReadFormat(AStream: TStream); procedure TsSpreadBIFF2Reader.ReadFormat(AStream: TStream);
begin begin
Unused(AStream);
// We ignore the formats in the file, everything is known // We ignore the formats in the file, everything is known
// (Using the formats in the file would require de-localizing them). // (Using the formats in the file would require de-localizing them).
end; end;
@ -1238,6 +1241,8 @@ var
len: Integer; len: Integer;
s: ansistring; s: ansistring;
begin begin
Unused(AFormatData);
s := NumFormatList.FormatStringForWriting(AListIndex); s := NumFormatList.FormatStringForWriting(AListIndex);
len := Length(s); len := Length(s);
@ -1546,6 +1551,8 @@ var
w: Word; w: Word;
h: Single; h: Single;
begin begin
Unused(ASheet);
containsXF := false; containsXF := false;
{ BIFF record header } { BIFF record header }

View File

@ -377,6 +377,7 @@ begin
WriteStyle(AStream); WriteStyle(AStream);
// A BOUNDSHEET for each worksheet // A BOUNDSHEET for each worksheet
SetLength(Boundsheets, 0);
for i := 0 to Workbook.GetWorksheetCount - 1 do for i := 0 to Workbook.GetWorksheetCount - 1 do
begin begin
len := Length(Boundsheets); len := Length(Boundsheets);
@ -1188,6 +1189,8 @@ var
RecordType: Word; RecordType: Word;
CurStreamPos: Int64; CurStreamPos: Int64;
begin begin
Unused(AData);
// Clear existing fonts. They will be replaced by those from the file. // Clear existing fonts. They will be replaced by those from the file.
FWorkbook.RemoveAllFonts; FWorkbook.RemoveAllFonts;

View File

@ -405,6 +405,7 @@ begin
WriteStyle(AStream); WriteStyle(AStream);
// A BOUNDSHEET for each worksheet // A BOUNDSHEET for each worksheet
SetLength(Boundsheets, 0);
for i := 0 to Workbook.GetWorksheetCount - 1 do for i := 0 to Workbook.GetWorksheetCount - 1 do
begin begin
len := Length(Boundsheets); len := Length(Boundsheets);
@ -1395,6 +1396,7 @@ var
RecordType: Word; RecordType: Word;
CurStreamPos: Int64; CurStreamPos: Int64;
begin begin
Unused(AData);
// Clear existing fonts. They will be replaced by those from the file. // Clear existing fonts. They will be replaced by those from the file.
FWorkbook.RemoveAllFonts; FWorkbook.RemoveAllFonts;
if Assigned(FSharedStringTable) then FreeAndNil(FSharedStringTable); if Assigned(FSharedStringTable) then FreeAndNil(FSharedStringTable);

View File

@ -1050,6 +1050,7 @@ end;
// Read the FORMAT record for formatting numerical data // Read the FORMAT record for formatting numerical data
procedure TsSpreadBIFFReader.ReadFormat(AStream: TStream); procedure TsSpreadBIFFReader.ReadFormat(AStream: TStream);
begin begin
Unused(AStream);
// to be overridden // to be overridden
end; end;
@ -1543,6 +1544,7 @@ end;
Must be overridden because the implementation depends on BIFF version. } Must be overridden because the implementation depends on BIFF version. }
procedure TsSpreadBIFFReader.ReadStringRecord(AStream: TStream); procedure TsSpreadBIFFReader.ReadStringRecord(AStream: TStream);
begin begin
Unused(AStream);
// //
end; end;
@ -1643,6 +1645,7 @@ end;
procedure TsSpreadBIFFWriter.GetLastRowCallback(ACell: PCell; AStream: TStream); procedure TsSpreadBIFFWriter.GetLastRowCallback(ACell: PCell; AStream: TStream);
begin begin
Unused(AStream);
if ACell^.Row > FLastRow then FLastRow := ACell^.Row; if ACell^.Row > FLastRow then FLastRow := ACell^.Row;
end; end;
@ -1655,6 +1658,7 @@ end;
procedure TsSpreadBIFFWriter.GetLastColCallback(ACell: PCell; AStream: TStream); procedure TsSpreadBIFFWriter.GetLastColCallback(ACell: PCell; AStream: TStream);
begin begin
Unused(AStream);
if ACell^.Col > FLastCol then FLastCol := ACell^.Col; if ACell^.Col > FLastCol then FLastCol := ACell^.Col;
end; end;
@ -1776,6 +1780,7 @@ end;
procedure TsSpreadBIFFWriter.WriteFormat(AStream: TStream; procedure TsSpreadBIFFWriter.WriteFormat(AStream: TStream;
AFormatData: TsNumFormatData; AListIndex: Integer); AFormatData: TsNumFormatData; AListIndex: Integer);
begin begin
Unused(AStream, AFormatData, AListIndex);
// needs to be overridden // needs to be overridden
end; end;

View File

@ -312,8 +312,6 @@ FSheets[CurStr] :=
procedure TsSpreadOOXMLWriter.WriteWorksheet(CurSheet: TsWorksheet); procedure TsSpreadOOXMLWriter.WriteWorksheet(CurSheet: TsWorksheet);
var var
j, k: Integer; j, k: Integer;
CurCell: PCell;
CurRow: array of PCell;
LastColIndex: Cardinal; LastColIndex: Cardinal;
LCell: TCell; LCell: TCell;
AVLNode: TAVLTreeNode; AVLNode: TAVLTreeNode;
@ -417,8 +415,13 @@ procedure TsSpreadOOXMLWriter.WriteToFile(const AFileName: string;
const AOverwriteExisting: Boolean); const AOverwriteExisting: Boolean);
var var
lStream: TFileStream; lStream: TFileStream;
lMode: word;
begin begin
lStream:=TFileStream.Create(AFileName, fmCreate); if AOverwriteExisting
then lMode := fmCreate or fmOpenWrite
else lMode := fmCreate;
lStream:=TFileStream.Create(AFileName, lMode);
try try
WriteToStream(lStream); WriteToStream(lStream);
finally finally
@ -499,6 +502,9 @@ var
TextTooLong: boolean=false; TextTooLong: boolean=false;
ResultingValue: string; ResultingValue: string;
begin begin
Unused(AStream);
Unused(ARow, ACol, ACell);
// Office 2007-2010 (at least) support no more characters in a cell; // Office 2007-2010 (at least) support no more characters in a cell;
if Length(AValue)>MaxBytes then if Length(AValue)>MaxBytes then
begin begin
@ -538,6 +544,7 @@ var
CellPosText: String; CellPosText: String;
CellValueText: String; CellValueText: String;
begin begin
Unused(AStream, ACell);
CellPosText := TsWorksheet.CellPosToText(ARow, ACol); CellPosText := TsWorksheet.CellPosToText(ARow, ACol);
CellValueText := Format('%g', [AValue], FPointSeparatorSettings); CellValueText := Format('%g', [AValue], FPointSeparatorSettings);
FSheets[FCurSheetNum] := FSheets[FCurSheetNum] + FSheets[FCurSheetNum] := FSheets[FCurSheetNum] +