You've already forked lazarus-ccr
fpspreadsheet: Some cleanup
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4402 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1738,8 +1738,8 @@ end;
|
|||||||
|
|
||||||
procedure TsHTMLWriter.WriteWorksheet(AStream: TStream; ASheet: TsWorksheet);
|
procedure TsHTMLWriter.WriteWorksheet(AStream: TStream; ASheet: TsWorksheet);
|
||||||
var
|
var
|
||||||
r, rFirst, rLast: Cardinal;
|
r, rFirst, rLast: LongInt;
|
||||||
c, cFirst, cLast: Cardinal;
|
c, cFirst, cLast: LongInt;
|
||||||
cell: PCell;
|
cell: PCell;
|
||||||
style, s: String;
|
style, s: String;
|
||||||
fixedLayout: Boolean;
|
fixedLayout: Boolean;
|
||||||
|
@ -50,7 +50,7 @@ procedure RichTextToHTML(AWorkbook: TsWorkbook; AFont: TsFont;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
math, lazUtf8, fasthtmlparser, StrUtils, //Strings,
|
math, lazUtf8, fasthtmlparser, //StrUtils, //Strings,
|
||||||
fpsUtils, fpsClasses;
|
fpsUtils, fpsClasses;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
@ -124,7 +124,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
TypInfo, Math, LazUTF8, fpsutils, fpsCurrency;
|
TypInfo, Math, LazUTF8, fpsCurrency;
|
||||||
|
|
||||||
|
|
||||||
function CreateNumFormatParams(ANumFormatStr: String;
|
function CreateNumFormatParams(ANumFormatStr: String;
|
||||||
|
@ -879,6 +879,7 @@ var
|
|||||||
readerClass: TsSpreadReaderClass;
|
readerClass: TsSpreadReaderClass;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
Unused(AParams);
|
||||||
readerClass := GetSpreadReaderClass(AFormatID);
|
readerClass := GetSpreadReaderClass(AFormatID);
|
||||||
|
|
||||||
if readerClass <> nil
|
if readerClass <> nil
|
||||||
@ -908,6 +909,7 @@ var
|
|||||||
writerClass: TsSpreadWriterClass;
|
writerClass: TsSpreadWriterClass;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
Unused(AParams);
|
||||||
writerClass := GetSpreadWriterClass(AFormatID);
|
writerClass := GetSpreadWriterClass(AFormatID);
|
||||||
|
|
||||||
if writerClass <> nil then
|
if writerClass <> nil then
|
||||||
@ -6949,8 +6951,6 @@ procedure TsWorkbook.WriteToFile(const AFileName: String;
|
|||||||
const AOverwriteExisting: Boolean; AParams: TsStreamParams = []);
|
const AOverwriteExisting: Boolean; AParams: TsStreamParams = []);
|
||||||
var
|
var
|
||||||
fileformats: TsSpreadFormatIDArray;
|
fileformats: TsSpreadFormatIDArray;
|
||||||
// formatID: TsSpreadFormatID;
|
|
||||||
valid: Boolean;
|
|
||||||
ext: String;
|
ext: String;
|
||||||
begin
|
begin
|
||||||
ext := ExtractFileExt(AFileName);
|
ext := ExtractFileExt(AFileName);
|
||||||
@ -7942,10 +7942,10 @@ begin
|
|||||||
for i := 0 to n-1 do
|
for i := 0 to n-1 do
|
||||||
begin
|
begin
|
||||||
sel := clipsheet.GetSelection[i];
|
sel := clipsheet.GetSelection[i];
|
||||||
selArray[i].Row1 := sel.Row1 + dr;
|
selArray[i].Row1 := LongInt(sel.Row1) + dr;
|
||||||
selArray[i].Col1 := sel.Col1 + dc;
|
selArray[i].Col1 := LongInt(sel.Col1) + dc;
|
||||||
selArray[i].Row2 := sel.Row2 + dr;
|
selArray[i].Row2 := LongInt(sel.Row2) + dr;
|
||||||
selArray[i].Col2 := sel.Col2 + dc;
|
selArray[i].Col2 := LongInt(sel.Col2) + dc;
|
||||||
end;
|
end;
|
||||||
ActiveWorksheet.SetSelection(selArray);
|
ActiveWorksheet.SetSelection(selArray);
|
||||||
// Select active cell. If not found in the file, let's use the last cell of the selections
|
// Select active cell. If not found in the file, let's use the last cell of the selections
|
||||||
|
@ -1366,8 +1366,6 @@ end;
|
|||||||
and deletes them afterwards.
|
and deletes them afterwards.
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TsWorkbookSource.CutCellsToClipboard;
|
procedure TsWorkbookSource.CutCellsToClipboard;
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
CopyCellsToClipboard;
|
CopyCellsToClipboard;
|
||||||
FWorksheet.DeleteSelection;
|
FWorksheet.DeleteSelection;
|
||||||
|
@ -2702,8 +2702,8 @@ begin
|
|||||||
// determination since only the height of the first row of the block
|
// determination since only the height of the first row of the block
|
||||||
// (containing the merge base cell) would change which is very confusing.
|
// (containing the merge base cell) would change which is very confusing.
|
||||||
exit;
|
exit;
|
||||||
cellR := CellRect(c1+FHeaderCount, ARow);
|
cellR := CellRect(LongInt(c1)+FHeaderCount, ARow);
|
||||||
cellR.Right := CellRect(c2+FHeaderCount, ARow).Right;
|
cellR.Right := CellRect(LongInt(c2)+FHeaderCount, ARow).Right;
|
||||||
end;
|
end;
|
||||||
InflateRect(cellR, -constCellPadding, -constCellPadding);
|
InflateRect(cellR, -constCellPadding, -constCellPadding);
|
||||||
|
|
||||||
|
@ -664,7 +664,6 @@ function ParseCellString_R1C1(const AStr: String; ABaseRow, ABaseCol: Cardinal;
|
|||||||
var
|
var
|
||||||
P: PChar;
|
P: PChar;
|
||||||
s: String;
|
s: String;
|
||||||
n: LongInt;
|
|
||||||
inRowCol: Integer; // 1 = in row, 2 = in col
|
inRowCol: Integer; // 1 = in row, 2 = in col
|
||||||
r, c: LongInt;
|
r, c: LongInt;
|
||||||
inBracket: Boolean;
|
inBracket: Boolean;
|
||||||
@ -927,7 +926,7 @@ begin
|
|||||||
Result := 'R' else
|
Result := 'R' else
|
||||||
Result := 'R[' + IntToStr(delta) + ']';
|
Result := 'R[' + IntToStr(delta) + ']';
|
||||||
end else
|
end else
|
||||||
Result := 'R' + IntToStr(ARow+1);
|
Result := 'R' + IntToStr(LongInt(ARow)+1);
|
||||||
|
|
||||||
if rfRelCol in AFlags then
|
if rfRelCol in AFlags then
|
||||||
begin
|
begin
|
||||||
@ -936,7 +935,7 @@ begin
|
|||||||
Result := Result + 'C' else
|
Result := Result + 'C' else
|
||||||
Result := Result + 'C[' + IntToStr(delta) + ']';
|
Result := Result + 'C[' + IntToStr(delta) + ']';
|
||||||
end else
|
end else
|
||||||
Result := Result + 'C' + IntToStr(ACol+1);
|
Result := Result + 'C' + IntToStr(LongInt(ACol)+1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1092,7 +1091,6 @@ end;
|
|||||||
function GetFormatFromFileName(const AFileName: TFileName;
|
function GetFormatFromFileName(const AFileName: TFileName;
|
||||||
out AFormatID: TsSpreadFormatID): Boolean;
|
out AFormatID: TsSpreadFormatID): Boolean;
|
||||||
var
|
var
|
||||||
suffix: String;
|
|
||||||
fileformats: TsSpreadFormatIDArray;
|
fileformats: TsSpreadFormatIDArray;
|
||||||
begin
|
begin
|
||||||
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName, ord(sfExcel8));
|
fileFormats := GetSpreadFormatsFromFileName(faRead, AFileName, ord(sfExcel8));
|
||||||
@ -1114,7 +1112,10 @@ var
|
|||||||
fmtID: TsSpreadFormatID;
|
fmtID: TsSpreadFormatID;
|
||||||
begin
|
begin
|
||||||
Result := GetFormatFromFileName(AFileName, fmtID);
|
Result := GetFormatFromFileName(AFileName, fmtID);
|
||||||
if Result and (fmtID < 0) then Result := false;
|
if fmtID > 0 then
|
||||||
|
SheetType := TsSpreadsheetFormat(fmtID)
|
||||||
|
else if Result then
|
||||||
|
Result := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<OtherUnitFiles Value="."/>
|
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
|
@ -161,7 +161,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Math,
|
Math,
|
||||||
fpsStrings, fpsRegFileFormats, fpsReaderWriter, fpsPalette, fpsNumFormat;
|
fpsStrings, fpsRegFileFormats, fpsPalette, fpsNumFormat;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ Excel record IDs }
|
{ Excel record IDs }
|
||||||
|
@ -214,7 +214,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Math,
|
Math,
|
||||||
fpsStrings, fpsRegFileFormats, fpsStreams, fpsReaderWriter, fpsPalette, fpsNumFormat;
|
fpsStrings, fpsRegFileFormats, fpsStreams, fpsPalette, fpsNumFormat;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ Excel record IDs }
|
{ Excel record IDs }
|
||||||
|
@ -264,7 +264,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Math, lconvencoding, LazFileUtils, URIParser,
|
Math, lconvencoding, LazFileUtils, URIParser,
|
||||||
fpsStrings, fpsStreams, fpsRegFileFormats, fpsReaderWriter, fpsPalette,
|
fpsStrings, fpsStreams, fpsRegFileFormats, fpsPalette,
|
||||||
fpsNumFormat, fpsExprParser, xlsEscher;
|
fpsNumFormat, fpsExprParser, xlsEscher;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
@ -90,7 +90,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
StrUtils, Math,
|
StrUtils, Math,
|
||||||
fpsStrings, fpsRegFileFormats, fpsUtils, fpsStreams, fpsNumFormat, fpsHTMLUtils;
|
fpsStrings, fpsRegFileFormats, fpsUtils, fpsNumFormat, fpsHTMLUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
FMT_OFFSET = 61;
|
FMT_OFFSET = 61;
|
||||||
@ -318,6 +318,7 @@ end;
|
|||||||
procedure TsSpreadExcelXMLWriter.WriteBlank(AStream: TStream;
|
procedure TsSpreadExcelXMLWriter.WriteBlank(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; ACell: PCell);
|
const ARow, ACol: Cardinal; ACell: PCell);
|
||||||
begin
|
begin
|
||||||
|
Unused(ARow, ACol);
|
||||||
AppendToStream(AStream, Format(CELL_INDENT +
|
AppendToStream(AStream, Format(CELL_INDENT +
|
||||||
'<Cell%s%s%s%s>' + // colIndex, style, hyperlink, merge
|
'<Cell%s%s%s%s>' + // colIndex, style, hyperlink, merge
|
||||||
'%s' + // Comment <Comment>...</Comment>
|
'%s' + // Comment <Comment>...</Comment>
|
||||||
@ -330,6 +331,7 @@ end;
|
|||||||
procedure TsSpreadExcelXMLWriter.WriteBool(AStream: TStream;
|
procedure TsSpreadExcelXMLWriter.WriteBool(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; const AValue: boolean; ACell: PCell);
|
const ARow, ACol: Cardinal; const AValue: boolean; ACell: PCell);
|
||||||
begin
|
begin
|
||||||
|
Unused(ARow, ACol);
|
||||||
AppendToStream(AStream, Format(CELL_INDENT +
|
AppendToStream(AStream, Format(CELL_INDENT +
|
||||||
'<Cell%s%s%s%s%s>' + // colIndex, style, formula, hyperlink, merge
|
'<Cell%s%s%s%s%s>' + // colIndex, style, formula, hyperlink, merge
|
||||||
'<Data ss:Type="%s">' + // data type
|
'<Data ss:Type="%s">' + // data type
|
||||||
@ -373,6 +375,7 @@ var
|
|||||||
nfp: TsNumFormatParams;
|
nfp: TsNumFormatParams;
|
||||||
fmt: PsCellFormat;
|
fmt: PsCellFormat;
|
||||||
begin
|
begin
|
||||||
|
Unused(ARow, ACol);
|
||||||
ExcelDate := AValue;
|
ExcelDate := AValue;
|
||||||
fmt := FWorkbook.GetPointerToCellFormat(ACell^.FormatIndex);
|
fmt := FWorkbook.GetPointerToCellFormat(ACell^.FormatIndex);
|
||||||
// Times have an offset of 1 day!
|
// Times have an offset of 1 day!
|
||||||
@ -404,6 +407,7 @@ end;
|
|||||||
procedure TsSpreadExcelXMLWriter.WriteError(AStream: TStream;
|
procedure TsSpreadExcelXMLWriter.WriteError(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; const AValue: TsErrorValue; ACell: PCell);
|
const ARow, ACol: Cardinal; const AValue: TsErrorValue; ACell: PCell);
|
||||||
begin
|
begin
|
||||||
|
Unused(ARow, ACol);
|
||||||
AppendToStream(AStream, Format(CELL_INDENT +
|
AppendToStream(AStream, Format(CELL_INDENT +
|
||||||
'<Cell%s%s%s%s%s>' + LF + VALUE_INDENT + // colIndex, style, formula, hyperlink, merge
|
'<Cell%s%s%s%s%s>' + LF + VALUE_INDENT + // colIndex, style, formula, hyperlink, merge
|
||||||
'<Data ss:Type="%s">' + // data type
|
'<Data ss:Type="%s">' + // data type
|
||||||
@ -489,6 +493,7 @@ end;
|
|||||||
procedure TsSpreadExcelXMLWriter.WriteNumber(AStream: TStream; const ARow, ACol: Cardinal;
|
procedure TsSpreadExcelXMLWriter.WriteNumber(AStream: TStream; const ARow, ACol: Cardinal;
|
||||||
const AValue: double; ACell: PCell);
|
const AValue: double; ACell: PCell);
|
||||||
begin
|
begin
|
||||||
|
Unused(ARow, ACol);
|
||||||
AppendToStream(AStream, Format(CELL_INDENT +
|
AppendToStream(AStream, Format(CELL_INDENT +
|
||||||
'<Cell%s%s%s%s%s>' + LF + VALUE_INDENT + // colIndex, style, formula, hyperlink, merge
|
'<Cell%s%s%s%s%s>' + LF + VALUE_INDENT + // colIndex, style, formula, hyperlink, merge
|
||||||
'<Data ss:Type="%s">' + // data type
|
'<Data ss:Type="%s">' + // data type
|
||||||
|
Reference in New Issue
Block a user