You've already forked lazarus-ccr
fpspreadsheet: Clean up. Silence some hints.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3473 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1550,6 +1550,7 @@ var
|
|||||||
d: TDate;
|
d: TDate;
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
n: Integer;
|
n: Integer;
|
||||||
|
dow: Integer;
|
||||||
begin
|
begin
|
||||||
n := 1;
|
n := 1;
|
||||||
if NumArgs = 2 then begin
|
if NumArgs = 2 then begin
|
||||||
@ -1560,8 +1561,18 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if PopDateValue(Args, d, Result) then
|
if PopDateValue(Args, d, Result) then begin
|
||||||
Result := CreateNumberArg(DayOfWeek(d));
|
dow := DayOfWeek(d); // Sunday = 1 ... Saturday = 7
|
||||||
|
case n of
|
||||||
|
1: ;
|
||||||
|
2: if dow > 1 then dow := dow - 1 else dow := 7;
|
||||||
|
3: if dow > 1 then dow := dow - 2 else dow := 6;
|
||||||
|
else
|
||||||
|
Result := CreateErrorArg(errOverflow); // #NUM!
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Result := CreateNumberArg(dow);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function fpsYEAR(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
function fpsYEAR(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
||||||
|
@ -205,8 +205,8 @@ const
|
|||||||
OPENDOC_PATH_SETTINGS = 'settings.xml';
|
OPENDOC_PATH_SETTINGS = 'settings.xml';
|
||||||
OPENDOC_PATH_STYLES = 'styles.xml';
|
OPENDOC_PATH_STYLES = 'styles.xml';
|
||||||
OPENDOC_PATH_MIMETYPE = 'mimetype';
|
OPENDOC_PATH_MIMETYPE = 'mimetype';
|
||||||
OPENDOC_PATH_METAINF = 'META-INF' + '/';
|
{%H-}OPENDOC_PATH_METAINF = 'META-INF' + '/';
|
||||||
OPENDOC_PATH_METAINF_MANIFEST = 'META-INF' + '/' + 'manifest.xml';
|
{%H-}OPENDOC_PATH_METAINF_MANIFEST = 'META-INF' + '/' + 'manifest.xml';
|
||||||
|
|
||||||
{ OpenDocument schemas constants }
|
{ OpenDocument schemas constants }
|
||||||
SCHEMAS_XMLNS_OFFICE = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0';
|
SCHEMAS_XMLNS_OFFICE = 'urn:oasis:names:tc:opendocument:xmlns:office:1.0';
|
||||||
@ -293,47 +293,17 @@ type
|
|||||||
AutoRowHeight: Boolean;
|
AutoRowHeight: Boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
(* --- presently not used, but this may change... ---
|
||||||
|
|
||||||
{ Row data items stored in the RowList of the reader }
|
{ Row data items stored in the RowList of the reader }
|
||||||
TRowData = class
|
TRowData = class
|
||||||
Row: Integer;
|
Row: Integer;
|
||||||
RowStyleIndex: Integer; // index into FRowStyleList of reader
|
RowStyleIndex: Integer; // index into FRowStyleList of reader
|
||||||
DefaultCellStyleIndex: Integer; // Index of default row style in FCellStyleList of reader
|
DefaultCellStyleIndex: Integer; // Index of default row style in FCellStyleList of reader
|
||||||
end;
|
end;
|
||||||
(*
|
*)
|
||||||
{ Utilities }
|
|
||||||
|
|
||||||
function DecodeODSTime(ATimeStr: String; out AHours, AMinutes, ASeconds, AMilliseconds: Word): Boolean;
|
|
||||||
var
|
|
||||||
p: Integer;
|
|
||||||
val: String;
|
|
||||||
hrStr: String;
|
|
||||||
minStr: String;
|
|
||||||
secStr: String;
|
|
||||||
msecStr: String;
|
|
||||||
begin
|
|
||||||
Result := false;
|
|
||||||
ATimeStr := Uppercase(ATimeStr);
|
|
||||||
if ATimeStr = '' then
|
|
||||||
exit;
|
|
||||||
if ATimeStr[1] <> 'P' then
|
|
||||||
exit;
|
|
||||||
if (Length(ATimeStr) < 2) or (ATimeStr[2] <> 'T') then
|
|
||||||
exit;
|
|
||||||
p := 3;
|
|
||||||
val := '';
|
|
||||||
while p <= Length(ATimeStr) do begin
|
|
||||||
case ATimeStr[p] of
|
|
||||||
'0'..'9': val := val + ATimeStr[p];
|
|
||||||
'H': begin hrStr := val; val := ''; end;
|
|
||||||
'M': begin minStr := val; val := ''; end;
|
|
||||||
'S': begin secStr := val; val := ''; end;
|
|
||||||
',', '.':
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
|
||||||
*)
|
|
||||||
{ TsSpreadOpenDocNumFormatList }
|
{ TsSpreadOpenDocNumFormatList }
|
||||||
|
|
||||||
procedure TsSpreadOpenDocNumFormatList.AddBuiltinFormats;
|
procedure TsSpreadOpenDocNumFormatList.AddBuiltinFormats;
|
||||||
@ -2924,8 +2894,8 @@ var
|
|||||||
k: Integer;
|
k: Integer;
|
||||||
h, h_mm: Single; // row height in "lines" and millimeters, respectively
|
h, h_mm: Single; // row height in "lines" and millimeters, respectively
|
||||||
h1: Single;
|
h1: Single;
|
||||||
colsRepeated: Integer;
|
colsRepeated: Cardinal;
|
||||||
rowsRepeated: Integer;
|
rowsRepeated: Cardinal;
|
||||||
colsRepeatedStr: String;
|
colsRepeatedStr: String;
|
||||||
rowsRepeatedStr: String;
|
rowsRepeatedStr: String;
|
||||||
firstCol, firstRow, lastCol, lastRow: Cardinal;
|
firstCol, firstRow, lastCol, lastRow: Cardinal;
|
||||||
@ -3486,8 +3456,8 @@ var
|
|||||||
h, h_mm: Single; // row height in "lines" and millimeters, respectively
|
h, h_mm: Single; // row height in "lines" and millimeters, respectively
|
||||||
k: Integer;
|
k: Integer;
|
||||||
rowStyleData: TRowStyleData;
|
rowStyleData: TRowStyleData;
|
||||||
rowsRepeated: Integer;
|
rowsRepeated: Cardinal;
|
||||||
colsRepeated: Integer;
|
colsRepeated: Cardinal;
|
||||||
colsRepeatedStr: String;
|
colsRepeatedStr: String;
|
||||||
defFontSize: Single;
|
defFontSize: Single;
|
||||||
lastCol, lastRow: Cardinal;
|
lastCol, lastRow: Cardinal;
|
||||||
|
@ -1159,8 +1159,8 @@ function GetFileFormatName(AFormat: TsSpreadsheetFormat): String;
|
|||||||
procedure MakeLEPalette(APalette: PsPalette; APaletteSize: Integer);
|
procedure MakeLEPalette(APalette: PsPalette; APaletteSize: Integer);
|
||||||
function SameCellBorders(ACell1, ACell2: PCell): Boolean;
|
function SameCellBorders(ACell1, ACell2: PCell): Boolean;
|
||||||
|
|
||||||
procedure InitCell(var ACell: TCell); overload;
|
procedure InitCell(out ACell: TCell); overload;
|
||||||
procedure InitCell(ARow, ACol: Cardinal; var ACell: TCell); overload;
|
procedure InitCell(ARow, ACol: Cardinal; out ACell: TCell); overload;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -1185,10 +1185,8 @@ resourcestring
|
|||||||
lpInvalidNumberFormat = 'Trying to use an incompatible number format.';
|
lpInvalidNumberFormat = 'Trying to use an incompatible number format.';
|
||||||
lpInvalidDateTimeFormat = 'Trying to use an incompatible date/time format.';
|
lpInvalidDateTimeFormat = 'Trying to use an incompatible date/time format.';
|
||||||
lpNoValidNumberFormatString = 'No valid number format string.';
|
lpNoValidNumberFormatString = 'No valid number format string.';
|
||||||
lpNoValidDateTimeFormatString = 'No valid date/time format string.';
|
|
||||||
lpNoValidCellAddress = '"%s" is not a valid cell address.';
|
lpNoValidCellAddress = '"%s" is not a valid cell address.';
|
||||||
lpNoValidCellRangeAddress = '"%s" is not a valid cell range address.';
|
lpNoValidCellRangeAddress = '"%s" is not a valid cell range address.';
|
||||||
lpIllegalNumberFormat = 'Illegal number format.';
|
|
||||||
lpSpecifyNumberOfParams = 'Specify number of parameters for function %s';
|
lpSpecifyNumberOfParams = 'Specify number of parameters for function %s';
|
||||||
lpIncorrectParamCount = 'Funtion %s requires at least %d and at most %d parameters.';
|
lpIncorrectParamCount = 'Funtion %s requires at least %d and at most %d parameters.';
|
||||||
lpCircularReference = 'Circular reference found when calculating worksheet formulas';
|
lpCircularReference = 'Circular reference found when calculating worksheet formulas';
|
||||||
@ -1203,6 +1201,10 @@ resourcestring
|
|||||||
lpErrArgError = '#N/A';
|
lpErrArgError = '#N/A';
|
||||||
lpErrFormulaNotSupported = '<FORMULA?>';
|
lpErrFormulaNotSupported = '<FORMULA?>';
|
||||||
|
|
||||||
|
{%H-}lpNoValidDateTimeFormatString = 'No valid date/time format string.';
|
||||||
|
{%H-}lpIllegalNumberFormat = 'Illegal number format.';
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
{ These are reserved system colors by Microsoft
|
{ These are reserved system colors by Microsoft
|
||||||
|
|
||||||
@ -1585,7 +1587,7 @@ end;
|
|||||||
{@@
|
{@@
|
||||||
Initalizes a new cell
|
Initalizes a new cell
|
||||||
}
|
}
|
||||||
procedure InitCell(var ACell: TCell);
|
procedure InitCell(out ACell: TCell);
|
||||||
begin
|
begin
|
||||||
ACell.RPNFormulaValue := nil;
|
ACell.RPNFormulaValue := nil;
|
||||||
ACell.FormulaValue.FormulaStr := '';
|
ACell.FormulaValue.FormulaStr := '';
|
||||||
@ -1594,7 +1596,7 @@ begin
|
|||||||
FillChar(ACell, SizeOf(ACell), 0);
|
FillChar(ACell, SizeOf(ACell), 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure InitCell(ARow, ACol: Cardinal; var ACell: TCell);
|
procedure InitCell(ARow, ACol: Cardinal; out ACell: TCell);
|
||||||
begin
|
begin
|
||||||
InitCell(ACell);
|
InitCell(ACell);
|
||||||
ACell.Row := ARow;
|
ACell.Row := ARow;
|
||||||
@ -5015,6 +5017,7 @@ var
|
|||||||
SheetType: TsSpreadsheetFormat;
|
SheetType: TsSpreadsheetFormat;
|
||||||
lException: Exception;
|
lException: Exception;
|
||||||
begin
|
begin
|
||||||
|
lException := pointer(1);
|
||||||
SheetType := sfExcel8;
|
SheetType := sfExcel8;
|
||||||
while (SheetType in [sfExcel2..sfExcel8, sfOpenDocument, sfOOXML]) and (lException <> nil) do
|
while (SheetType in [sfExcel2..sfExcel8, sfOpenDocument, sfOOXML]) and (lException <> nil) do
|
||||||
begin
|
begin
|
||||||
@ -6400,7 +6403,6 @@ var
|
|||||||
i, n: Integer;
|
i, n: Integer;
|
||||||
b: TsCellBorder;
|
b: TsCellBorder;
|
||||||
equ: Boolean;
|
equ: Boolean;
|
||||||
clr: TsColor;
|
|
||||||
begin
|
begin
|
||||||
Result := -1;
|
Result := -1;
|
||||||
|
|
||||||
@ -6556,7 +6558,6 @@ procedure TsCustomSpreadWriter.CheckLimitations;
|
|||||||
var
|
var
|
||||||
lastCol, lastRow: Cardinal;
|
lastCol, lastRow: Cardinal;
|
||||||
i, n: Integer;
|
i, n: Integer;
|
||||||
fnt: TsFont;
|
|
||||||
begin
|
begin
|
||||||
Workbook.GetLastRowColIndex(lastRow, lastCol);
|
Workbook.GetLastRowColIndex(lastRow, lastCol);
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ function ParseCellString(const AStr: String; out ACellRow, ACellCol: Cardinal;
|
|||||||
// Scan letters
|
// Scan letters
|
||||||
while (i <= Length(AStr)) do begin
|
while (i <= Length(AStr)) do begin
|
||||||
if (UpCase(AStr[i]) in LETTERS) then begin
|
if (UpCase(AStr[i]) in LETTERS) then begin
|
||||||
ACellCol := ord(UpCase(AStr[i])) - ord('A') + 1 + ACellCol * 26;
|
ACellCol := Cardinal(ord(UpCase(AStr[i])) - ord('A')) + 1 + ACellCol * 26;
|
||||||
inc(i);
|
inc(i);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -478,7 +478,7 @@ function ParseCellString(const AStr: String; out ACellRow, ACellCol: Cardinal;
|
|||||||
// Scan digits
|
// Scan digits
|
||||||
while (i <= Length(AStr)) do begin
|
while (i <= Length(AStr)) do begin
|
||||||
if (AStr[i] in DIGITS) then begin
|
if (AStr[i] in DIGITS) then begin
|
||||||
ACellRow := (ord(AStr[i]) - ord('0')) + ACellRow * 10;
|
ACellRow := Cardinal(ord(AStr[i]) - ord('0')) + ACellRow * 10;
|
||||||
inc(i);
|
inc(i);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
@ -2009,9 +2009,9 @@ const
|
|||||||
|
|
||||||
procedure RGBtoHLS(const R, G, B: Byte; out H, L, S: Byte);
|
procedure RGBtoHLS(const R, G, B: Byte; out H, L, S: Byte);
|
||||||
var
|
var
|
||||||
cMax, cMin: Byte; // max and min RGB values
|
cMax, cMin: Integer; // max and min RGB values
|
||||||
Rdelta, Gdelta, Bdelta: Byte; // intermediate value: % of spread from max
|
Rdelta, Gdelta, Bdelta: Byte; // intermediate value: % of spread from max
|
||||||
diff: Byte;
|
diff: Integer;
|
||||||
begin
|
begin
|
||||||
// calculate lightness
|
// calculate lightness
|
||||||
cMax := MaxIntValue([R, G, B]);
|
cMax := MaxIntValue([R, G, B]);
|
||||||
@ -2067,7 +2067,7 @@ procedure HLStoRGB(const H, L, S: Byte; out R, G, B: Byte);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
n1, n2: Byte;
|
n1, n2: Integer;
|
||||||
begin
|
begin
|
||||||
if S = 0
|
if S = 0
|
||||||
then begin
|
then begin
|
||||||
|
@ -26,7 +26,7 @@ uses
|
|||||||
not found. }
|
not found. }
|
||||||
function TsSpreadXMLReader.GetAttrValue(ANode : TDOMNode; AAttrName : string) : string;
|
function TsSpreadXMLReader.GetAttrValue(ANode : TDOMNode; AAttrName : string) : string;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: LongWord;
|
||||||
Found: Boolean;
|
Found: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
|
@ -164,7 +164,7 @@ const
|
|||||||
INT_EXCEL_ID_LABEL = $0004;
|
INT_EXCEL_ID_LABEL = $0004;
|
||||||
INT_EXCEL_ID_ROW = $0008;
|
INT_EXCEL_ID_ROW = $0008;
|
||||||
INT_EXCEL_ID_BOF = $0009;
|
INT_EXCEL_ID_BOF = $0009;
|
||||||
INT_EXCEL_ID_INDEX = $000B;
|
{%H-}INT_EXCEL_ID_INDEX = $000B;
|
||||||
INT_EXCEL_ID_FORMAT = $001E;
|
INT_EXCEL_ID_FORMAT = $001E;
|
||||||
INT_EXCEL_ID_FORMATCOUNT= $001F;
|
INT_EXCEL_ID_FORMATCOUNT= $001F;
|
||||||
INT_EXCEL_ID_COLWIDTH = $0024;
|
INT_EXCEL_ID_COLWIDTH = $0024;
|
||||||
@ -175,8 +175,8 @@ const
|
|||||||
|
|
||||||
{ BOF record constants }
|
{ BOF record constants }
|
||||||
INT_EXCEL_SHEET = $0010;
|
INT_EXCEL_SHEET = $0010;
|
||||||
INT_EXCEL_CHART = $0020;
|
{%H-}INT_EXCEL_CHART = $0020;
|
||||||
INT_EXCEL_MACRO_SHEET = $0040;
|
{%H-}INT_EXCEL_MACRO_SHEET = $0040;
|
||||||
|
|
||||||
type
|
type
|
||||||
TBIFF2DimensionsRecord = packed record
|
TBIFF2DimensionsRecord = packed record
|
||||||
@ -585,8 +585,8 @@ begin
|
|||||||
FWorksheet.WriteBlank(cell);
|
FWorksheet.WriteBlank(cell);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
if SizeOf(Double) <> 8 then
|
{if SizeOf(Double) <> 8 then
|
||||||
raise Exception.Create('Double is not 8 bytes');
|
raise Exception.Create('Double is not 8 bytes');}
|
||||||
|
|
||||||
// Result is a number or a date/time
|
// Result is a number or a date/time
|
||||||
Move(Data[0], formulaResult, SizeOf(Data));
|
Move(Data[0], formulaResult, SizeOf(Data));
|
||||||
@ -1158,7 +1158,10 @@ begin
|
|||||||
rec.RecordID := WordToLE(INT_EXCEL_ID_DIMENSIONS);
|
rec.RecordID := WordToLE(INT_EXCEL_ID_DIMENSIONS);
|
||||||
rec.RecordSize := WordToLE(8);
|
rec.RecordSize := WordToLE(8);
|
||||||
rec.FirstRow := WordToLE(firstRow);
|
rec.FirstRow := WordToLE(firstRow);
|
||||||
rec.LastRowPlus1 := WordToLE(Min(lastRow+1, $FFFF)); // avoid WORD overflow
|
if lastRow < $FFFF then // avoid WORD overflow when adding 1
|
||||||
|
rec.LastRowPlus1 := WordToLE(lastRow+1)
|
||||||
|
else
|
||||||
|
rec.LastRowPlus1 := $FFFF;
|
||||||
rec.FirstCol := WordToLE(firstCol);
|
rec.FirstCol := WordToLE(firstCol);
|
||||||
rec.LastColPlus1 := WordToLE(lastCol+1);
|
rec.LastColPlus1 := WordToLE(lastCol+1);
|
||||||
|
|
||||||
@ -1548,7 +1551,6 @@ end;
|
|||||||
procedure TsSpreadBIFF2Writer.WriteRPNFormula(AStream: TStream;
|
procedure TsSpreadBIFF2Writer.WriteRPNFormula(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; const AFormula: TsRPNFormula; ACell: PCell);
|
const ARow, ACol: Cardinal; const AFormula: TsRPNFormula; ACell: PCell);
|
||||||
var
|
var
|
||||||
FormulaResult: double;
|
|
||||||
RPNLength: Word;
|
RPNLength: Word;
|
||||||
RecordSizePos, FinalPos: Cardinal;
|
RecordSizePos, FinalPos: Cardinal;
|
||||||
xf: Word;
|
xf: Word;
|
||||||
@ -1557,7 +1559,6 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
RPNLength := 0;
|
RPNLength := 0;
|
||||||
FormulaResult := 0.0;
|
|
||||||
|
|
||||||
xf := FindXFIndex(ACell);
|
xf := FindXFIndex(ACell);
|
||||||
if xf >= 63 then
|
if xf >= 63 then
|
||||||
|
@ -218,92 +218,92 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, fpsStreams;
|
fpsStreams;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ Excel record IDs }
|
{ Excel record IDs }
|
||||||
// see: in xlscommon
|
// see: in xlscommon
|
||||||
|
|
||||||
{ BOF record constants }
|
{ BOF record constants }
|
||||||
INT_BOF_BIFF5_VER = $0500;
|
INT_BOF_BIFF5_VER = $0500;
|
||||||
INT_BOF_WORKBOOK_GLOBALS= $0005;
|
INT_BOF_WORKBOOK_GLOBALS= $0005;
|
||||||
INT_BOF_VB_MODULE = $0006;
|
{%H-}INT_BOF_VB_MODULE = $0006;
|
||||||
INT_BOF_SHEET = $0010;
|
INT_BOF_SHEET = $0010;
|
||||||
INT_BOF_CHART = $0020;
|
{%H-}INT_BOF_CHART = $0020;
|
||||||
INT_BOF_MACRO_SHEET = $0040;
|
{%H-}INT_BOF_MACRO_SHEET = $0040;
|
||||||
INT_BOF_WORKSPACE = $0100;
|
{%H-}INT_BOF_WORKSPACE = $0100;
|
||||||
INT_BOF_BUILD_ID = $1FD2;
|
INT_BOF_BUILD_ID = $1FD2;
|
||||||
INT_BOF_BUILD_YEAR = $07CD;
|
INT_BOF_BUILD_YEAR = $07CD;
|
||||||
|
|
||||||
{ FONT record constants }
|
{ FONT record constants }
|
||||||
INT_FONT_WEIGHT_NORMAL = $0190;
|
INT_FONT_WEIGHT_NORMAL = $0190;
|
||||||
|
|
||||||
BYTE_ANSILatin1 = $00;
|
{%H-}BYTE_ANSILatin1 = $00;
|
||||||
BYTE_SYSTEM_DEFAULT = $01;
|
{%H-}BYTE_SYSTEM_DEFAULT = $01;
|
||||||
BYTE_SYMBOL = $02;
|
{%H-}BYTE_SYMBOL = $02;
|
||||||
BYTE_Apple_Roman = $4D;
|
{%H-}BYTE_Apple_Roman = $4D;
|
||||||
BYTE_ANSI_Japanese_Shift_JIS = $80;
|
{%H-}BYTE_ANSI_Japanese_Shift_JIS = $80;
|
||||||
BYTE_ANSI_Korean_Hangul = $81;
|
{%H-}BYTE_ANSI_Korean_Hangul = $81;
|
||||||
BYTE_ANSI_Korean_Johab = $81;
|
{%H-}BYTE_ANSI_Korean_Johab = $81;
|
||||||
BYTE_ANSI_Chinese_Simplified_GBK = $86;
|
{%H-}BYTE_ANSI_Chinese_Simplified_GBK = $86;
|
||||||
BYTE_ANSI_Chinese_Traditional_BIG5 = $88;
|
{%H-}BYTE_ANSI_Chinese_Traditional_BIG5 = $88;
|
||||||
BYTE_ANSI_Greek = $A1;
|
{%H-}BYTE_ANSI_Greek = $A1;
|
||||||
BYTE_ANSI_Turkish = $A2;
|
{%H-}BYTE_ANSI_Turkish = $A2;
|
||||||
BYTE_ANSI_Vietnamese = $A3;
|
{%H-}BYTE_ANSI_Vietnamese = $A3;
|
||||||
BYTE_ANSI_Hebrew = $B1;
|
{%H-}BYTE_ANSI_Hebrew = $B1;
|
||||||
BYTE_ANSI_Arabic = $B2;
|
{%H-}BYTE_ANSI_Arabic = $B2;
|
||||||
BYTE_ANSI_Baltic = $BA;
|
{%H-}BYTE_ANSI_Baltic = $BA;
|
||||||
BYTE_ANSI_Cyrillic = $CC;
|
{%H-}BYTE_ANSI_Cyrillic = $CC;
|
||||||
BYTE_ANSI_Thai = $DE;
|
{%H-}BYTE_ANSI_Thai = $DE;
|
||||||
BYTE_ANSI_Latin2 = $EE;
|
{%H-}BYTE_ANSI_Latin2 = $EE;
|
||||||
BYTE_OEM_Latin1 = $FF;
|
{%H-}BYTE_OEM_Latin1 = $FF;
|
||||||
|
|
||||||
{ FORMULA record constants }
|
{ FORMULA record constants }
|
||||||
MASK_FORMULA_RECALCULATE_ALWAYS = $0001;
|
{%H-}MASK_FORMULA_RECALCULATE_ALWAYS = $0001;
|
||||||
MASK_FORMULA_RECALCULATE_ON_OPEN = $0002;
|
{%H-}MASK_FORMULA_RECALCULATE_ON_OPEN = $0002;
|
||||||
MASK_FORMULA_SHARED_FORMULA = $0008;
|
{%H-}MASK_FORMULA_SHARED_FORMULA = $0008;
|
||||||
|
|
||||||
{ STYLE record constants }
|
{ STYLE record constants }
|
||||||
MASK_STYLE_BUILT_IN = $8000;
|
MASK_STYLE_BUILT_IN = $8000;
|
||||||
|
|
||||||
{ WINDOW1 record constants }
|
{ WINDOW1 record constants }
|
||||||
MASK_WINDOW1_OPTION_WINDOW_HIDDEN = $0001;
|
{%H-}MASK_WINDOW1_OPTION_WINDOW_HIDDEN = $0001;
|
||||||
MASK_WINDOW1_OPTION_WINDOW_MINIMISED = $0002;
|
{%H-}MASK_WINDOW1_OPTION_WINDOW_MINIMISED = $0002;
|
||||||
MASK_WINDOW1_OPTION_HORZ_SCROLL_VISIBLE = $0008;
|
{%H-}MASK_WINDOW1_OPTION_HORZ_SCROLL_VISIBLE = $0008;
|
||||||
MASK_WINDOW1_OPTION_VERT_SCROLL_VISIBLE = $0010;
|
{%H-}MASK_WINDOW1_OPTION_VERT_SCROLL_VISIBLE = $0010;
|
||||||
MASK_WINDOW1_OPTION_WORKSHEET_TAB_VISIBLE = $0020;
|
{%H-}MASK_WINDOW1_OPTION_WORKSHEET_TAB_VISIBLE = $0020;
|
||||||
|
|
||||||
{ XF substructures }
|
{ XF substructures }
|
||||||
|
|
||||||
{ XF substructures --- see xlscommon! }
|
{ XF substructures --- see xlscommon! }
|
||||||
XF_ROTATION_HORIZONTAL = 0;
|
XF_ROTATION_HORIZONTAL = 0;
|
||||||
XF_ROTATION_STACKED = 1;
|
XF_ROTATION_STACKED = 1;
|
||||||
XF_ROTATION_90DEG_CCW = 2;
|
XF_ROTATION_90DEG_CCW = 2;
|
||||||
XF_ROTATION_90DEG_CW = 3;
|
XF_ROTATION_90DEG_CW = 3;
|
||||||
|
|
||||||
{ XF CELL BORDER }
|
{ XF CELL BORDER }
|
||||||
MASK_XF_BORDER_LEFT = $00000038;
|
MASK_XF_BORDER_LEFT = $00000038;
|
||||||
MASK_XF_BORDER_RIGHT = $000001C0;
|
MASK_XF_BORDER_RIGHT = $000001C0;
|
||||||
MASK_XF_BORDER_TOP = $00000007;
|
MASK_XF_BORDER_TOP = $00000007;
|
||||||
MASK_XF_BORDER_BOTTOM = $01C00000;
|
MASK_XF_BORDER_BOTTOM = $01C00000;
|
||||||
|
|
||||||
{ XF CELL BORDER COLORS }
|
{ XF CELL BORDER COLORS }
|
||||||
MASK_XF_BORDER_LEFT_COLOR = $007F0000;
|
MASK_XF_BORDER_LEFT_COLOR = $007F0000;
|
||||||
MASK_XF_BORDER_RIGHT_COLOR = $3F800000;
|
MASK_XF_BORDER_RIGHT_COLOR = $3F800000;
|
||||||
MASK_XF_BORDER_TOP_COLOR = $0000FE00;
|
MASK_XF_BORDER_TOP_COLOR = $0000FE00;
|
||||||
MASK_XF_BORDER_BOTTOM_COLOR = $FE000000;
|
MASK_XF_BORDER_BOTTOM_COLOR = $FE000000;
|
||||||
|
|
||||||
{ XF CELL BACKGROUND }
|
{ XF CELL BACKGROUND }
|
||||||
MASK_XF_BKGR_PATTERN_COLOR = $0000007F;
|
MASK_XF_BKGR_PATTERN_COLOR = $0000007F;
|
||||||
MASK_XF_BKGR_BACKGROUND_COLOR = $00003F80;
|
{%H-}MASK_XF_BKGR_BACKGROUND_COLOR = $00003F80;
|
||||||
MASK_XF_BKGR_FILLPATTERN = $003F0000;
|
MASK_XF_BKGR_FILLPATTERN = $003F0000;
|
||||||
|
|
||||||
TEXT_ROTATIONS: Array[TsTextRotation] of Byte = (
|
TEXT_ROTATIONS: Array[TsTextRotation] of Byte = (
|
||||||
XF_ROTATION_HORIZONTAL,
|
XF_ROTATION_HORIZONTAL,
|
||||||
XF_ROTATION_90DEG_CW,
|
XF_ROTATION_90DEG_CW,
|
||||||
XF_ROTATION_90DEG_CCW,
|
XF_ROTATION_90DEG_CCW,
|
||||||
XF_ROTATION_STACKED
|
XF_ROTATION_STACKED
|
||||||
);
|
);
|
||||||
|
|
||||||
type
|
type
|
||||||
TBIFF5DimensionsRecord = packed record
|
TBIFF5DimensionsRecord = packed record
|
||||||
@ -565,7 +565,10 @@ begin
|
|||||||
rec.RecordID := WordToLE(INT_EXCEL_ID_DIMENSIONS);
|
rec.RecordID := WordToLE(INT_EXCEL_ID_DIMENSIONS);
|
||||||
rec.RecordSize := WordToLE(10);
|
rec.RecordSize := WordToLE(10);
|
||||||
rec.FirstRow := WordToLE(firstRow);
|
rec.FirstRow := WordToLE(firstRow);
|
||||||
rec.LastRowPlus1 := WordToLE(Min(lastRow+1, $FFFF)); // avoid word overflow
|
if lastRow < $FFFF then // avoid WORD overflow
|
||||||
|
rec.LastRowPlus1 := WordToLE(lastRow + 1)
|
||||||
|
else
|
||||||
|
rec.LastRowPlus1 := $FFFF;
|
||||||
rec.FirstCol := WordToLe(firstCol);
|
rec.FirstCol := WordToLe(firstCol);
|
||||||
rec.LastColPlus1 := WordToLE(lastCol+1);
|
rec.LastColPlus1 := WordToLE(lastCol+1);
|
||||||
rec.NotUsed := 0;
|
rec.NotUsed := 0;
|
||||||
@ -1166,14 +1169,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
// Border lines
|
// Border lines
|
||||||
if cbSouth in ABorders then
|
if cbSouth in ABorders then
|
||||||
dw1 := dw1 or ((ord(ABorderStyles[cbSouth].LineStyle)+1) shl 22);
|
dw1 := dw1 or ((DWord(ABorderStyles[cbSouth].LineStyle)+1) shl 22);
|
||||||
dw1 := dw1 or (ABorderStyles[cbSouth].Color shl 25); // Bottom line color
|
dw1 := dw1 or (ABorderStyles[cbSouth].Color shl 25); // Bottom line color
|
||||||
dw2 := (ABorderStyles[cbNorth].Color shl 9) or // Top line color
|
dw2 := (ABorderStyles[cbNorth].Color shl 9) or // Top line color
|
||||||
(ABorderStyles[cbWest].Color shl 16) or // Left line color
|
(ABorderStyles[cbWest].Color shl 16) or // Left line color
|
||||||
(ABorderStyles[cbEast].Color shl 23); // Right line color
|
(ABorderStyles[cbEast].Color shl 23); // Right line color
|
||||||
if cbNorth in ABorders then dw2 := dw2 or (ord(ABorderStyles[cbNorth].LineStyle)+1);
|
if cbNorth in ABorders then dw2 := dw2 or (DWord(ABorderStyles[cbNorth].LineStyle)+1);
|
||||||
if cbWest in ABorders then dw2 := dw2 or ((ord(ABorderStyles[cbWest].LineStyle)+1) shl 3);
|
if cbWest in ABorders then dw2 := dw2 or ((DWord(ABorderStyles[cbWest].LineStyle)+1) shl 3);
|
||||||
if cbEast in ABorders then dw2 := dw2 or ((ord(ABorderStyles[cbEast].LineStyle)+1) shl 6);
|
if cbEast in ABorders then dw2 := dw2 or ((DWord(ABorderStyles[cbEast].LineStyle)+1) shl 6);
|
||||||
AStream.WriteDWord(DWordToLE(dw1));
|
AStream.WriteDWord(DWordToLE(dw1));
|
||||||
AStream.WriteDWord(DWordToLE(dw2));
|
AStream.WriteDWord(DWordToLE(dw2));
|
||||||
end;
|
end;
|
||||||
|
@ -222,64 +222,64 @@ uses
|
|||||||
fpsStreams;
|
fpsStreams;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ Excel record IDs }
|
{ Excel record IDs }
|
||||||
INT_EXCEL_ID_SST = $00FC; //BIFF8 only
|
INT_EXCEL_ID_SST = $00FC; //BIFF8 only
|
||||||
INT_EXCEL_ID_LABELSST = $00FD; //BIFF8 only
|
INT_EXCEL_ID_LABELSST = $00FD; //BIFF8 only
|
||||||
INT_EXCEL_ID_FORCEFULLCALCULATION = $08A3;
|
{%H-}INT_EXCEL_ID_FORCEFULLCALCULATION = $08A3;
|
||||||
|
|
||||||
{ Cell Addresses constants }
|
{ Cell Addresses constants }
|
||||||
MASK_EXCEL_COL_BITS_BIFF8 = $00FF;
|
MASK_EXCEL_COL_BITS_BIFF8 = $00FF;
|
||||||
MASK_EXCEL_RELATIVE_COL_BIFF8 = $4000; // This is according to Microsoft documentation,
|
MASK_EXCEL_RELATIVE_COL_BIFF8 = $4000; // This is according to Microsoft documentation,
|
||||||
MASK_EXCEL_RELATIVE_ROW_BIFF8 = $8000; // but opposite to OpenOffice documentation!
|
MASK_EXCEL_RELATIVE_ROW_BIFF8 = $8000; // but opposite to OpenOffice documentation!
|
||||||
|
|
||||||
{ BOF record constants }
|
{ BOF record constants }
|
||||||
INT_BOF_BIFF8_VER = $0600;
|
INT_BOF_BIFF8_VER = $0600;
|
||||||
INT_BOF_WORKBOOK_GLOBALS= $0005;
|
INT_BOF_WORKBOOK_GLOBALS= $0005;
|
||||||
INT_BOF_VB_MODULE = $0006;
|
{%H-}INT_BOF_VB_MODULE = $0006;
|
||||||
INT_BOF_SHEET = $0010;
|
INT_BOF_SHEET = $0010;
|
||||||
INT_BOF_CHART = $0020;
|
{%H-}INT_BOF_CHART = $0020;
|
||||||
INT_BOF_MACRO_SHEET = $0040;
|
{%H-}INT_BOF_MACRO_SHEET = $0040;
|
||||||
INT_BOF_WORKSPACE = $0100;
|
{%H-}INT_BOF_WORKSPACE = $0100;
|
||||||
INT_BOF_BUILD_ID = $1FD2;
|
INT_BOF_BUILD_ID = $1FD2;
|
||||||
INT_BOF_BUILD_YEAR = $07CD;
|
INT_BOF_BUILD_YEAR = $07CD;
|
||||||
|
|
||||||
{ STYLE record constants }
|
{ STYLE record constants }
|
||||||
MASK_STYLE_BUILT_IN = $8000;
|
MASK_STYLE_BUILT_IN = $8000;
|
||||||
|
|
||||||
{ XF substructures }
|
{ XF substructures }
|
||||||
|
|
||||||
{ XF_ROTATION }
|
{ XF_ROTATION }
|
||||||
XF_ROTATION_HORIZONTAL = 0;
|
XF_ROTATION_HORIZONTAL = 0;
|
||||||
XF_ROTATION_90DEG_CCW = 90;
|
XF_ROTATION_90DEG_CCW = 90;
|
||||||
XF_ROTATION_90DEG_CW = 180;
|
XF_ROTATION_90DEG_CW = 180;
|
||||||
XF_ROTATION_STACKED = 255; // Letters stacked top to bottom, but not rotated
|
XF_ROTATION_STACKED = 255; // Letters stacked top to bottom, but not rotated
|
||||||
|
|
||||||
{ XF CELL BORDER LINE STYLES }
|
{ XF CELL BORDER LINE STYLES }
|
||||||
MASK_XF_BORDER_LEFT = $0000000F;
|
MASK_XF_BORDER_LEFT = $0000000F;
|
||||||
MASK_XF_BORDER_RIGHT = $000000F0;
|
MASK_XF_BORDER_RIGHT = $000000F0;
|
||||||
MASK_XF_BORDER_TOP = $00000F00;
|
MASK_XF_BORDER_TOP = $00000F00;
|
||||||
MASK_XF_BORDER_BOTTOM = $0000F000;
|
MASK_XF_BORDER_BOTTOM = $0000F000;
|
||||||
MASK_XF_BORDER_DIAGONAL = $01E00000;
|
MASK_XF_BORDER_DIAGONAL = $01E00000;
|
||||||
|
|
||||||
MASK_XF_BORDER_SHOW_DIAGONAL_DOWN = $40000000;
|
MASK_XF_BORDER_SHOW_DIAGONAL_DOWN = $40000000;
|
||||||
MASK_XF_BORDER_SHOW_DIAGONAL_UP = $80000000;
|
MASK_XF_BORDER_SHOW_DIAGONAL_UP = $80000000;
|
||||||
|
|
||||||
{ XF CELL BORDER COLORS }
|
{ XF CELL BORDER COLORS }
|
||||||
MASK_XF_BORDER_LEFT_COLOR = $007F0000;
|
MASK_XF_BORDER_LEFT_COLOR = $007F0000;
|
||||||
MASK_XF_BORDER_RIGHT_COLOR = $3F800000;
|
MASK_XF_BORDER_RIGHT_COLOR = $3F800000;
|
||||||
MASK_XF_BORDER_TOP_COLOR = $0000007F;
|
MASK_XF_BORDER_TOP_COLOR = $0000007F;
|
||||||
MASK_XF_BORDER_BOTTOM_COLOR = $00003F80;
|
MASK_XF_BORDER_BOTTOM_COLOR = $00003F80;
|
||||||
MASK_XF_BORDER_DIAGONAL_COLOR = $001FC000;
|
MASK_XF_BORDER_DIAGONAL_COLOR = $001FC000;
|
||||||
|
|
||||||
{ XF CELL BACKGROUND PATTERN }
|
{ XF CELL BACKGROUND PATTERN }
|
||||||
MASK_XF_BACKGROUND_PATTERN = $FC000000;
|
MASK_XF_BACKGROUND_PATTERN = $FC000000;
|
||||||
|
|
||||||
TEXT_ROTATIONS: Array[TsTextRotation] of Byte = (
|
TEXT_ROTATIONS: Array[TsTextRotation] of Byte = (
|
||||||
XF_ROTATION_HORIZONTAL,
|
XF_ROTATION_HORIZONTAL,
|
||||||
XF_ROTATION_90DEG_CW,
|
XF_ROTATION_90DEG_CW,
|
||||||
XF_ROTATION_90DEG_CCW,
|
XF_ROTATION_90DEG_CCW,
|
||||||
XF_ROTATION_STACKED
|
XF_ROTATION_STACKED
|
||||||
);
|
);
|
||||||
|
|
||||||
type
|
type
|
||||||
TBIFF8DimensionsRecord = packed record
|
TBIFF8DimensionsRecord = packed record
|
||||||
@ -794,6 +794,9 @@ procedure TsSpreadBIFF8Writer.WriteFormula(AStream: TStream; const ARow,
|
|||||||
RPNLength: Word;
|
RPNLength: Word;
|
||||||
TokenArraySizePos, RecordSizePos, FinalPos: Int64;}
|
TokenArraySizePos, RecordSizePos, FinalPos: Int64;}
|
||||||
begin
|
begin
|
||||||
|
Unused(AStream);
|
||||||
|
Unused(ARow, ACol);
|
||||||
|
Unused(AFormula, ACell);
|
||||||
(*
|
(*
|
||||||
if (ARow >= FLimitations.MaxRows) or (ACol >= FLimitations.MaxCols) then
|
if (ARow >= FLimitations.MaxRows) or (ACol >= FLimitations.MaxCols) then
|
||||||
exit;
|
exit;
|
||||||
@ -1220,13 +1223,13 @@ begin
|
|||||||
|
|
||||||
// Border line styles
|
// Border line styles
|
||||||
if cbWest in ABorders then
|
if cbWest in ABorders then
|
||||||
XFBorderDWord1 := XFBorderDWord1 or (ord(ABorderStyles[cbWest].LineStyle)+1);
|
XFBorderDWord1 := XFBorderDWord1 or (DWord(ABorderStyles[cbWest].LineStyle)+1);
|
||||||
if cbEast in ABorders then
|
if cbEast in ABorders then
|
||||||
XFBorderDWord1 := XFBorderDWord1 or ((ord(ABorderStyles[cbEast].LineStyle)+1) shl 4);
|
XFBorderDWord1 := XFBorderDWord1 or ((DWord(ABorderStyles[cbEast].LineStyle)+1) shl 4);
|
||||||
if cbNorth in ABorders then
|
if cbNorth in ABorders then
|
||||||
XFBorderDWord1 := XFBorderDWord1 or ((ord(ABorderStyles[cbNorth].LineStyle)+1) shl 8);
|
XFBorderDWord1 := XFBorderDWord1 or ((DWord(ABorderStyles[cbNorth].LineStyle)+1) shl 8);
|
||||||
if cbSouth in ABorders then
|
if cbSouth in ABorders then
|
||||||
XFBorderDWord1 := XFBorderDWord1 or ((ord(ABorderStyles[cbSouth].LineStyle)+1) shl 12);
|
XFBorderDWord1 := XFBorderDWord1 or ((DWord(ABorderStyles[cbSouth].LineStyle)+1) shl 12);
|
||||||
if cbDiagDown in ABorders then
|
if cbDiagDown in ABorders then
|
||||||
XFBorderDWord1 := XFBorderDWord1 or $40000000;
|
XFBorderDWord1 := XFBorderDWord1 or $40000000;
|
||||||
if cbDiagUp in ABorders then
|
if cbDiagUp in ABorders then
|
||||||
@ -1240,7 +1243,7 @@ begin
|
|||||||
|
|
||||||
// Diagonal line style
|
// Diagonal line style
|
||||||
if (ABorders + [cbDiagUp, cbDiagDown] <> []) then
|
if (ABorders + [cbDiagUp, cbDiagDown] <> []) then
|
||||||
XFBorderDWord2 := XFBorderDWord2 or ((ord(ABorderStyles[cbDiagUp].LineStyle)+1) shl 21);
|
XFBorderDWord2 := XFBorderDWord2 or ((DWord(ABorderStyles[cbDiagUp].LineStyle)+1) shl 21);
|
||||||
// In BIFF8 both diagonals have the same color - we use the color of the up-diagonal.
|
// In BIFF8 both diagonals have the same color - we use the color of the up-diagonal.
|
||||||
|
|
||||||
// Add a background, if desired
|
// Add a background, if desired
|
||||||
|
@ -11,11 +11,13 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, DateUtils,
|
Classes, SysUtils, DateUtils,
|
||||||
|
(*
|
||||||
{$ifdef USE_NEW_OLE}
|
{$ifdef USE_NEW_OLE}
|
||||||
fpolebasic,
|
fpolebasic,
|
||||||
{$else}
|
{$else}
|
||||||
fpolestorage,
|
fpolestorage,
|
||||||
{$endif}
|
{$endif}
|
||||||
|
*)
|
||||||
fpspreadsheet, fpsutils, lconvencoding;
|
fpspreadsheet, fpsutils, lconvencoding;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -530,7 +532,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, Variants, fpsStreams, fpsNumFormatParser;
|
Math, Variants, fpsNumFormatParser;
|
||||||
|
|
||||||
{ Helper table for rpn formulas:
|
{ Helper table for rpn formulas:
|
||||||
Assignment of FormulaElementKinds (fekXXXX) to EXCEL_TOKEN IDs. }
|
Assignment of FormulaElementKinds (fekXXXX) to EXCEL_TOKEN IDs. }
|
||||||
@ -1210,8 +1212,10 @@ begin
|
|||||||
3: FWorksheet.WriteBlank(cell);
|
3: FWorksheet.WriteBlank(cell);
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
|
{
|
||||||
if SizeOf(Double) <> 8 then
|
if SizeOf(Double) <> 8 then
|
||||||
raise Exception.Create('Double is not 8 bytes');
|
raise Exception.Create('Double is not 8 bytes');
|
||||||
|
}
|
||||||
|
|
||||||
// Result is a number or a date/time
|
// Result is a number or a date/time
|
||||||
Move(Data[0], ResultFormula, SizeOf(Data));
|
Move(Data[0], ResultFormula, SizeOf(Data));
|
||||||
|
@ -170,45 +170,45 @@ uses
|
|||||||
|
|
||||||
const
|
const
|
||||||
{ OOXML general XML constants }
|
{ OOXML general XML constants }
|
||||||
XML_HEADER = '<?xml version="1.0" encoding="utf-8" ?>';
|
XML_HEADER = '<?xml version="1.0" encoding="utf-8" ?>';
|
||||||
|
|
||||||
{ OOXML Directory structure constants }
|
{ OOXML Directory structure constants }
|
||||||
// Note: directory separators are always / because the .xlsx is a zip file which
|
// Note: directory separators are always / because the .xlsx is a zip file which
|
||||||
// requires / instead of \, even on Windows; see
|
// requires / instead of \, even on Windows; see
|
||||||
// http://www.pkware.com/documents/casestudies/APPNOTE.TXT
|
// http://www.pkware.com/documents/casestudies/APPNOTE.TXT
|
||||||
// 4.4.17.1 All slashes MUST be forward slashes '/' as opposed to backwards slashes '\'
|
// 4.4.17.1 All slashes MUST be forward slashes '/' as opposed to backwards slashes '\'
|
||||||
OOXML_PATH_TYPES = '[Content_Types].xml';
|
OOXML_PATH_TYPES = '[Content_Types].xml';
|
||||||
OOXML_PATH_RELS = '_rels/';
|
{%H-}OOXML_PATH_RELS = '_rels/';
|
||||||
OOXML_PATH_RELS_RELS = '_rels/.rels';
|
OOXML_PATH_RELS_RELS = '_rels/.rels';
|
||||||
OOXML_PATH_XL = 'xl/';
|
{%H-}OOXML_PATH_XL = 'xl/';
|
||||||
OOXML_PATH_XL_RELS = 'xl/_rels/';
|
{%H-}OOXML_PATH_XL_RELS = 'xl/_rels/';
|
||||||
OOXML_PATH_XL_RELS_RELS = 'xl/_rels/workbook.xml.rels';
|
OOXML_PATH_XL_RELS_RELS = 'xl/_rels/workbook.xml.rels';
|
||||||
OOXML_PATH_XL_WORKBOOK = 'xl/workbook.xml';
|
OOXML_PATH_XL_WORKBOOK = 'xl/workbook.xml';
|
||||||
OOXML_PATH_XL_STYLES = 'xl/styles.xml';
|
OOXML_PATH_XL_STYLES = 'xl/styles.xml';
|
||||||
OOXML_PATH_XL_STRINGS = 'xl/sharedStrings.xml';
|
OOXML_PATH_XL_STRINGS = 'xl/sharedStrings.xml';
|
||||||
OOXML_PATH_XL_WORKSHEETS = 'xl/worksheets/';
|
OOXML_PATH_XL_WORKSHEETS = 'xl/worksheets/';
|
||||||
OOXML_PATH_XL_THEME = 'xl/theme/theme1.xml';
|
OOXML_PATH_XL_THEME = 'xl/theme/theme1.xml';
|
||||||
|
|
||||||
{ OOXML schemas constants }
|
{ OOXML schemas constants }
|
||||||
SCHEMAS_TYPES = 'http://schemas.openxmlformats.org/package/2006/content-types';
|
SCHEMAS_TYPES = 'http://schemas.openxmlformats.org/package/2006/content-types';
|
||||||
SCHEMAS_RELS = 'http://schemas.openxmlformats.org/package/2006/relationships';
|
SCHEMAS_RELS = 'http://schemas.openxmlformats.org/package/2006/relationships';
|
||||||
SCHEMAS_DOC_RELS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
|
SCHEMAS_DOC_RELS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
|
||||||
SCHEMAS_DOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument';
|
SCHEMAS_DOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument';
|
||||||
SCHEMAS_WORKSHEET = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet';
|
SCHEMAS_WORKSHEET = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet';
|
||||||
SCHEMAS_STYLES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles';
|
SCHEMAS_STYLES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles';
|
||||||
SCHEMAS_STRINGS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings';
|
SCHEMAS_STRINGS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings';
|
||||||
SCHEMAS_SPREADML = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
|
SCHEMAS_SPREADML = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
|
||||||
|
|
||||||
{ OOXML mime types constants }
|
{ OOXML mime types constants }
|
||||||
MIME_XML = 'application/xml';
|
{%H-}MIME_XML = 'application/xml';
|
||||||
MIME_RELS = 'application/vnd.openxmlformats-package.relationships+xml';
|
MIME_RELS = 'application/vnd.openxmlformats-package.relationships+xml';
|
||||||
MIME_SPREADML = 'application/vnd.openxmlformats-officedocument.spreadsheetml';
|
MIME_SPREADML = 'application/vnd.openxmlformats-officedocument.spreadsheetml';
|
||||||
MIME_SHEET = MIME_SPREADML + '.sheet.main+xml';
|
MIME_SHEET = MIME_SPREADML + '.sheet.main+xml';
|
||||||
MIME_WORKSHEET = MIME_SPREADML + '.worksheet+xml';
|
MIME_WORKSHEET = MIME_SPREADML + '.worksheet+xml';
|
||||||
MIME_STYLES = MIME_SPREADML + '.styles+xml';
|
MIME_STYLES = MIME_SPREADML + '.styles+xml';
|
||||||
MIME_STRINGS = MIME_SPREADML + '.sharedStrings+xml';
|
MIME_STRINGS = MIME_SPREADML + '.sharedStrings+xml';
|
||||||
|
|
||||||
LAST_PALETTE_COLOR = $3F; // 63
|
LAST_PALETTE_COLOR = $3F; // 63
|
||||||
|
|
||||||
var
|
var
|
||||||
// the palette of the 64 default colors as "big-endian color" values
|
// the palette of the 64 default colors as "big-endian color" values
|
||||||
@ -1166,13 +1166,14 @@ procedure TsSpreadOOXMLReader.ReadSheetList(ANode: TDOMNode; AList: TStrings);
|
|||||||
var
|
var
|
||||||
node: TDOMNode;
|
node: TDOMNode;
|
||||||
sheetName: String;
|
sheetName: String;
|
||||||
sheetId: String;
|
//sheetId: String;
|
||||||
begin
|
begin
|
||||||
node := ANode.FirstChild;
|
node := ANode.FirstChild;
|
||||||
while node <> nil do begin
|
while node <> nil do begin
|
||||||
sheetName := GetAttrValue(node, 'name');
|
sheetName := GetAttrValue(node, 'name');
|
||||||
sheetId := GetAttrValue(node, 'sheetId');
|
//sheetId := GetAttrValue(node, 'sheetId');
|
||||||
AList.AddObject(sheetName, pointer(PtrInt(StrToInt(sheetId))));
|
AList.Add(sheetName);
|
||||||
|
// AList.AddObject(sheetName, pointer(PtrInt(StrToInt(sheetId))));
|
||||||
node := node.NextSibling;
|
node := node.NextSibling;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1560,10 +1561,13 @@ end;
|
|||||||
"FormattingStyles" which correspond to the section cellXfs of the styles.xml
|
"FormattingStyles" which correspond to the section cellXfs of the styles.xml
|
||||||
file. }
|
file. }
|
||||||
function TsSpreadOOXMLWriter.GetStyleIndex(ACell: PCell): Cardinal;
|
function TsSpreadOOXMLWriter.GetStyleIndex(ACell: PCell): Cardinal;
|
||||||
|
var
|
||||||
|
idx: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FindFormattingInList(ACell);
|
idx := FindFormattingInList(ACell);
|
||||||
if Result = -1 then
|
if idx = -1 then
|
||||||
Result := 0;
|
idx := 0;
|
||||||
|
Result := idx;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Creates a list of all border styles found in the workbook.
|
{ Creates a list of all border styles found in the workbook.
|
||||||
|
Reference in New Issue
Block a user