fpspreadsheet: Improves OpenDocument support and moved back to 0-based grid
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@688 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
87fe92f9d7
commit
7e67d5e83e
@ -38,8 +38,8 @@
|
|||||||
<Filename Value="excel2write.lpr"/>
|
<Filename Value="excel2write.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="excel2write"/>
|
<UnitName Value="excel2write"/>
|
||||||
<CursorPos X="21" Y="43"/>
|
<CursorPos X="33" Y="2"/>
|
||||||
<TopLine Value="18"/>
|
<TopLine Value="1"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="309"/>
|
<UsageCount Value="309"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
|
@ -25,16 +25,16 @@ begin
|
|||||||
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
|
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
|
||||||
|
|
||||||
// Write some number cells
|
// Write some number cells
|
||||||
MyWorksheet.WriteNumber(1, 1, 1.0);
|
MyWorksheet.WriteNumber(0, 0, 1.0);
|
||||||
MyWorksheet.WriteNumber(1, 2, 2.0);
|
MyWorksheet.WriteNumber(0, 1, 2.0);
|
||||||
MyWorksheet.WriteNumber(1, 3, 3.0);
|
MyWorksheet.WriteNumber(0, 2, 3.0);
|
||||||
MyWorksheet.WriteNumber(1, 4, 4.0);
|
MyWorksheet.WriteNumber(0, 3, 4.0);
|
||||||
|
|
||||||
// Write some string cells
|
// Write some string cells
|
||||||
MyWorksheet.WriteUTF8Text(2, 1, 'First');
|
MyWorksheet.WriteUTF8Text(1, 0, 'First');
|
||||||
MyWorksheet.WriteUTF8Text(2, 2, 'Second');
|
MyWorksheet.WriteUTF8Text(1, 1, 'Second');
|
||||||
MyWorksheet.WriteUTF8Text(2, 3, 'Third');
|
MyWorksheet.WriteUTF8Text(1, 2, 'Third');
|
||||||
MyWorksheet.WriteUTF8Text(2, 4, 'Fourth');
|
MyWorksheet.WriteUTF8Text(1, 3, 'Fourth');
|
||||||
|
|
||||||
// Save the spreadsheet to a file
|
// Save the spreadsheet to a file
|
||||||
MyWorkbook.WriteToFile(MyDir + 'test' + STR_EXCEL_EXTENSION, sfExcel2);
|
MyWorkbook.WriteToFile(MyDir + 'test' + STR_EXCEL_EXTENSION, sfExcel2);
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<Filename Value="excel5write.lpr"/>
|
<Filename Value="excel5write.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="excel5write"/>
|
<UnitName Value="excel5write"/>
|
||||||
<CursorPos X="8" Y="21"/>
|
<CursorPos X="35" Y="56"/>
|
||||||
<TopLine Value="46"/>
|
<TopLine Value="46"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="309"/>
|
<UsageCount Value="309"/>
|
||||||
|
@ -28,10 +28,10 @@ begin
|
|||||||
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
|
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
|
||||||
|
|
||||||
// Write some number cells
|
// Write some number cells
|
||||||
MyWorksheet.WriteNumber(1, 1, 1.0);
|
MyWorksheet.WriteNumber(0, 0, 1.0);
|
||||||
MyWorksheet.WriteNumber(1, 2, 2.0);
|
MyWorksheet.WriteNumber(0, 1, 2.0);
|
||||||
MyWorksheet.WriteNumber(1, 3, 3.0);
|
MyWorksheet.WriteNumber(0, 2, 3.0);
|
||||||
MyWorksheet.WriteNumber(1, 4, 4.0);
|
MyWorksheet.WriteNumber(0, 3, 4.0);
|
||||||
|
|
||||||
{ Uncommend this to test large XLS files
|
{ Uncommend this to test large XLS files
|
||||||
for i := 2 to 20 do
|
for i := 2 to 20 do
|
||||||
@ -47,22 +47,22 @@ begin
|
|||||||
// or, in RPN: A1, B1, +
|
// or, in RPN: A1, B1, +
|
||||||
SetLength(MyFormula, 3);
|
SetLength(MyFormula, 3);
|
||||||
MyFormula[0].TokenID := INT_EXCEL_TOKEN_TREFV; {A1}
|
MyFormula[0].TokenID := INT_EXCEL_TOKEN_TREFV; {A1}
|
||||||
MyFormula[0].Col := 1;
|
MyFormula[0].Col := 0;
|
||||||
MyFormula[0].Row := 1;
|
MyFormula[0].Row := 0;
|
||||||
MyFormula[1].TokenID := INT_EXCEL_TOKEN_TREFV; {B1}
|
MyFormula[1].TokenID := INT_EXCEL_TOKEN_TREFV; {B1}
|
||||||
MyFormula[1].Col := 2;
|
MyFormula[1].Col := 1;
|
||||||
MyFormula[1].Row := 1;
|
MyFormula[1].Row := 0;
|
||||||
MyFormula[2].TokenID := INT_EXCEL_TOKEN_TADD; {+}
|
MyFormula[2].TokenID := INT_EXCEL_TOKEN_TADD; {+}
|
||||||
MyWorksheet.WriteRPNFormula(1, 5, MyFormula);
|
MyWorksheet.WriteRPNFormula(0, 4, MyFormula);
|
||||||
|
|
||||||
// Creates a new worksheet
|
// Creates a new worksheet
|
||||||
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet 2');
|
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet 2');
|
||||||
|
|
||||||
// Write some string cells
|
// Write some string cells
|
||||||
MyWorksheet.WriteUTF8Text(1, 1, 'First');
|
MyWorksheet.WriteUTF8Text(0, 0, 'First');
|
||||||
MyWorksheet.WriteUTF8Text(1, 2, 'Second');
|
MyWorksheet.WriteUTF8Text(0, 1, 'Second');
|
||||||
MyWorksheet.WriteUTF8Text(1, 3, 'Third');
|
MyWorksheet.WriteUTF8Text(0, 2, 'Third');
|
||||||
MyWorksheet.WriteUTF8Text(1, 4, 'Fourth');
|
MyWorksheet.WriteUTF8Text(0, 3, 'Fourth');
|
||||||
|
|
||||||
// Save the spreadsheet to a file
|
// Save the spreadsheet to a file
|
||||||
MyWorkbook.WriteToFile(MyDir + 'test' + STR_EXCEL_EXTENSION, sfExcel5);
|
MyWorkbook.WriteToFile(MyDir + 'test' + STR_EXCEL_EXTENSION, sfExcel5);
|
||||||
|
Binary file not shown.
@ -11,7 +11,7 @@
|
|||||||
<TargetFileExt Value=".exe"/>
|
<TargetFileExt Value=".exe"/>
|
||||||
<Title Value="opendocwrite"/>
|
<Title Value="opendocwrite"/>
|
||||||
<UseAppBundle Value="False"/>
|
<UseAppBundle Value="False"/>
|
||||||
<ActiveEditorIndexAtStart Value="1"/>
|
<ActiveEditorIndexAtStart Value="6"/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<ProjectVersion Value=""/>
|
<ProjectVersion Value=""/>
|
||||||
@ -38,8 +38,8 @@
|
|||||||
<Filename Value="opendocwrite.lpr"/>
|
<Filename Value="opendocwrite.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="opendocwrite"/>
|
<UnitName Value="opendocwrite"/>
|
||||||
<CursorPos X="9" Y="30"/>
|
<CursorPos X="26" Y="35"/>
|
||||||
<TopLine Value="8"/>
|
<TopLine Value="21"/>
|
||||||
<EditorIndex Value="0"/>
|
<EditorIndex Value="0"/>
|
||||||
<UsageCount Value="309"/>
|
<UsageCount Value="309"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -68,8 +68,8 @@
|
|||||||
<Unit4>
|
<Unit4>
|
||||||
<Filename Value="..\..\xlsbiff5.pas"/>
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
<UnitName Value="xlsbiff5"/>
|
<UnitName Value="xlsbiff5"/>
|
||||||
<CursorPos X="26" Y="95"/>
|
<CursorPos X="38" Y="1059"/>
|
||||||
<TopLine Value="92"/>
|
<TopLine Value="1045"/>
|
||||||
<EditorIndex Value="6"/>
|
<EditorIndex Value="6"/>
|
||||||
<UsageCount Value="140"/>
|
<UsageCount Value="140"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -86,8 +86,8 @@
|
|||||||
<Unit6>
|
<Unit6>
|
||||||
<Filename Value="..\..\xlsbiff2.pas"/>
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
<UnitName Value="xlsbiff2"/>
|
<UnitName Value="xlsbiff2"/>
|
||||||
<CursorPos X="1" Y="16"/>
|
<CursorPos X="25" Y="216"/>
|
||||||
<TopLine Value="1"/>
|
<TopLine Value="203"/>
|
||||||
<EditorIndex Value="7"/>
|
<EditorIndex Value="7"/>
|
||||||
<UsageCount Value="139"/>
|
<UsageCount Value="139"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
@ -116,10 +116,10 @@
|
|||||||
<Unit10>
|
<Unit10>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<UnitName Value="fpspreadsheet"/>
|
<UnitName Value="fpspreadsheet"/>
|
||||||
<CursorPos X="1" Y="759"/>
|
<CursorPos X="17" Y="138"/>
|
||||||
<TopLine Value="746"/>
|
<TopLine Value="125"/>
|
||||||
<EditorIndex Value="4"/>
|
<EditorIndex Value="4"/>
|
||||||
<UsageCount Value="95"/>
|
<UsageCount Value="97"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit10>
|
</Unit10>
|
||||||
<Unit11>
|
<Unit11>
|
||||||
@ -131,10 +131,10 @@
|
|||||||
<Unit12>
|
<Unit12>
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
<Filename Value="..\..\fpsopendocument.pas"/>
|
||||||
<UnitName Value="fpsopendocument"/>
|
<UnitName Value="fpsopendocument"/>
|
||||||
<CursorPos X="7" Y="296"/>
|
<CursorPos X="88" Y="294"/>
|
||||||
<TopLine Value="275"/>
|
<TopLine Value="284"/>
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<UsageCount Value="13"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit12>
|
</Unit12>
|
||||||
<Unit13>
|
<Unit13>
|
||||||
@ -143,7 +143,7 @@
|
|||||||
<CursorPos X="1" Y="268"/>
|
<CursorPos X="1" Y="268"/>
|
||||||
<TopLine Value="253"/>
|
<TopLine Value="253"/>
|
||||||
<EditorIndex Value="3"/>
|
<EditorIndex Value="3"/>
|
||||||
<UsageCount Value="13"/>
|
<UsageCount Value="15"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit13>
|
</Unit13>
|
||||||
<Unit14>
|
<Unit14>
|
||||||
@ -151,130 +151,130 @@
|
|||||||
<CursorPos X="10" Y="154"/>
|
<CursorPos X="10" Y="154"/>
|
||||||
<TopLine Value="141"/>
|
<TopLine Value="141"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="2"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="12"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
</Unit14>
|
</Unit14>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
<Filename Value="..\..\fpsopendocument.pas"/>
|
||||||
<Caret Line="265" Column="28" TopLine="253"/>
|
<Caret Line="295" Column="1" TopLine="282"/>
|
||||||
</Position1>
|
</Position1>
|
||||||
<Position2>
|
<Position2>
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
<Filename Value="..\..\fpsopendocument.pas"/>
|
||||||
<Caret Line="313" Column="1" TopLine="301"/>
|
<Caret Line="297" Column="1" TopLine="284"/>
|
||||||
</Position2>
|
</Position2>
|
||||||
<Position3>
|
<Position3>
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="41" Column="45" TopLine="37"/>
|
|
||||||
</Position3>
|
|
||||||
<Position4>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="355" Column="5" TopLine="331"/>
|
|
||||||
</Position4>
|
|
||||||
<Position5>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="311" Column="1" TopLine="299"/>
|
|
||||||
</Position5>
|
|
||||||
<Position6>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="260" Column="28" TopLine="249"/>
|
|
||||||
</Position6>
|
|
||||||
<Position7>
|
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
|
||||||
<Caret Line="365" Column="5" TopLine="340"/>
|
|
||||||
</Position7>
|
|
||||||
<Position8>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="290" Column="5" TopLine="265"/>
|
|
||||||
</Position8>
|
|
||||||
<Position9>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="380" Column="74" TopLine="363"/>
|
|
||||||
</Position9>
|
|
||||||
<Position10>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="278" Column="1" TopLine="265"/>
|
|
||||||
</Position10>
|
|
||||||
<Position11>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="279" Column="1" TopLine="266"/>
|
|
||||||
</Position11>
|
|
||||||
<Position12>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="283" Column="1" TopLine="270"/>
|
|
||||||
</Position12>
|
|
||||||
<Position13>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="284" Column="1" TopLine="271"/>
|
|
||||||
</Position13>
|
|
||||||
<Position14>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="287" Column="1" TopLine="274"/>
|
|
||||||
</Position14>
|
|
||||||
<Position15>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="289" Column="1" TopLine="276"/>
|
|
||||||
</Position15>
|
|
||||||
<Position16>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="290" Column="18" TopLine="277"/>
|
|
||||||
</Position16>
|
|
||||||
<Position17>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="289" Column="1" TopLine="276"/>
|
|
||||||
</Position17>
|
|
||||||
<Position18>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="290" Column="1" TopLine="277"/>
|
|
||||||
</Position18>
|
|
||||||
<Position19>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="289" Column="1" TopLine="276"/>
|
|
||||||
</Position19>
|
|
||||||
<Position20>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="290" Column="1" TopLine="277"/>
|
|
||||||
</Position20>
|
|
||||||
<Position21>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="289" Column="1" TopLine="276"/>
|
|
||||||
</Position21>
|
|
||||||
<Position22>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="290" Column="1" TopLine="277"/>
|
|
||||||
</Position22>
|
|
||||||
<Position23>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="293" Column="1" TopLine="280"/>
|
|
||||||
</Position23>
|
|
||||||
<Position24>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="295" Column="1" TopLine="282"/>
|
|
||||||
</Position24>
|
|
||||||
<Position25>
|
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
|
||||||
<Caret Line="297" Column="1" TopLine="284"/>
|
|
||||||
</Position25>
|
|
||||||
<Position26>
|
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="754" Column="1" TopLine="741"/>
|
<Caret Line="754" Column="1" TopLine="741"/>
|
||||||
</Position26>
|
</Position3>
|
||||||
<Position27>
|
<Position4>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="755" Column="1" TopLine="742"/>
|
<Caret Line="755" Column="1" TopLine="742"/>
|
||||||
</Position27>
|
</Position4>
|
||||||
<Position28>
|
<Position5>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="757" Column="1" TopLine="744"/>
|
<Caret Line="757" Column="1" TopLine="744"/>
|
||||||
</Position28>
|
</Position5>
|
||||||
<Position29>
|
<Position6>
|
||||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||||
<Caret Line="759" Column="1" TopLine="746"/>
|
<Caret Line="759" Column="1" TopLine="746"/>
|
||||||
</Position29>
|
</Position6>
|
||||||
<Position30>
|
<Position7>
|
||||||
<Filename Value="..\..\fpsopendocument.pas"/>
|
<Filename Value="..\..\fpsopendocument.pas"/>
|
||||||
<Caret Line="392" Column="1" TopLine="379"/>
|
<Caret Line="392" Column="1" TopLine="379"/>
|
||||||
|
</Position7>
|
||||||
|
<Position8>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="87" Column="1" TopLine="79"/>
|
||||||
|
</Position8>
|
||||||
|
<Position9>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="211" Column="34" TopLine="196"/>
|
||||||
|
</Position9>
|
||||||
|
<Position10>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="22" Column="40" TopLine="8"/>
|
||||||
|
</Position10>
|
||||||
|
<Position11>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="48" Column="22" TopLine="35"/>
|
||||||
|
</Position11>
|
||||||
|
<Position12>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="194" Column="7" TopLine="181"/>
|
||||||
|
</Position12>
|
||||||
|
<Position13>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="329" Column="51" TopLine="316"/>
|
||||||
|
</Position13>
|
||||||
|
<Position14>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="257" Column="34" TopLine="242"/>
|
||||||
|
</Position14>
|
||||||
|
<Position15>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="286" Column="34" TopLine="271"/>
|
||||||
|
</Position15>
|
||||||
|
<Position16>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="350" Column="38" TopLine="336"/>
|
||||||
|
</Position16>
|
||||||
|
<Position17>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="207" Column="1" TopLine="196"/>
|
||||||
|
</Position17>
|
||||||
|
<Position18>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="556" Column="34" TopLine="542"/>
|
||||||
|
</Position18>
|
||||||
|
<Position19>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="50" Column="19" TopLine="37"/>
|
||||||
|
</Position19>
|
||||||
|
<Position20>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="150" Column="34" TopLine="137"/>
|
||||||
|
</Position20>
|
||||||
|
<Position21>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="153" Column="72" TopLine="137"/>
|
||||||
|
</Position21>
|
||||||
|
<Position22>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="159" Column="13" TopLine="137"/>
|
||||||
|
</Position22>
|
||||||
|
<Position23>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="187" Column="32" TopLine="174"/>
|
||||||
|
</Position23>
|
||||||
|
<Position24>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="190" Column="13" TopLine="174"/>
|
||||||
|
</Position24>
|
||||||
|
<Position25>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="193" Column="34" TopLine="174"/>
|
||||||
|
</Position25>
|
||||||
|
<Position26>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="226" Column="33" TopLine="213"/>
|
||||||
|
</Position26>
|
||||||
|
<Position27>
|
||||||
|
<Filename Value="..\..\xlsbiff2.pas"/>
|
||||||
|
<Caret Line="97" Column="16" TopLine="85"/>
|
||||||
|
</Position27>
|
||||||
|
<Position28>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="601" Column="25" TopLine="588"/>
|
||||||
|
</Position28>
|
||||||
|
<Position29>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="673" Column="34" TopLine="659"/>
|
||||||
|
</Position29>
|
||||||
|
<Position30>
|
||||||
|
<Filename Value="..\..\xlsbiff5.pas"/>
|
||||||
|
<Caret Line="700" Column="34" TopLine="686"/>
|
||||||
</Position30>
|
</Position30>
|
||||||
</JumpHistory>
|
</JumpHistory>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
@ -28,10 +28,10 @@ begin
|
|||||||
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
|
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
|
||||||
|
|
||||||
// Write some number cells
|
// Write some number cells
|
||||||
MyWorksheet.WriteNumber(1, 1, 1.0);
|
MyWorksheet.WriteNumber(0, 0, 1.0);
|
||||||
MyWorksheet.WriteNumber(1, 2, 2.0);
|
MyWorksheet.WriteNumber(0, 1, 2.0);
|
||||||
MyWorksheet.WriteNumber(1, 3, 3.0);
|
MyWorksheet.WriteNumber(0, 2, 3.0);
|
||||||
MyWorksheet.WriteNumber(1, 4, 4.0);
|
MyWorksheet.WriteNumber(0, 3, 4.0);
|
||||||
|
|
||||||
{ Uncommend this to test large XLS files
|
{ Uncommend this to test large XLS files
|
||||||
for i := 2 to 20 do
|
for i := 2 to 20 do
|
||||||
@ -57,13 +57,13 @@ begin
|
|||||||
|
|
||||||
// Creates a new worksheet
|
// Creates a new worksheet
|
||||||
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet 2');
|
MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet 2');
|
||||||
|
*)
|
||||||
|
|
||||||
// Write some string cells
|
// Write some string cells
|
||||||
MyWorksheet.WriteUTF8Text(1, 1, 'First');
|
MyWorksheet.WriteUTF8Text(1, 0, 'First');
|
||||||
MyWorksheet.WriteUTF8Text(1, 2, 'Second');
|
MyWorksheet.WriteUTF8Text(1, 1, 'Second');
|
||||||
MyWorksheet.WriteUTF8Text(1, 3, 'Third');
|
MyWorksheet.WriteUTF8Text(1, 2, 'Third');
|
||||||
MyWorksheet.WriteUTF8Text(1, 4, 'Fourth');
|
MyWorksheet.WriteUTF8Text(1, 3, 'Fourth');
|
||||||
*)
|
|
||||||
|
|
||||||
// Save the spreadsheet to a file
|
// Save the spreadsheet to a file
|
||||||
MyWorkbook.WriteToFile(MyDir + 'test', sfOpenDocument);
|
MyWorkbook.WriteToFile(MyDir + 'test', sfOpenDocument);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
cd test
|
cd test
|
||||||
zip test.ods *
|
zip -r test.ods *
|
||||||
mv test.ods ../
|
mv test.ods ../
|
||||||
cd ..
|
cd ..
|
@ -71,7 +71,7 @@ const
|
|||||||
OOXML_PATH_META = 'meta.xml';
|
OOXML_PATH_META = 'meta.xml';
|
||||||
OOXML_PATH_SETTINGS = 'settings.xml';
|
OOXML_PATH_SETTINGS = 'settings.xml';
|
||||||
OOXML_PATH_STYLES = 'styles.xml';
|
OOXML_PATH_STYLES = 'styles.xml';
|
||||||
OOXML_PATH_MIMETYPE = 'mimetype.xml';
|
OOXML_PATH_MIMETYPE = 'mimetype';
|
||||||
OPENDOC_PATH_METAINF = 'META-INF' + PathDelim;
|
OPENDOC_PATH_METAINF = 'META-INF' + PathDelim;
|
||||||
OPENDOC_PATH_METAINF_MANIFEST = 'META-INF' + PathDelim + 'manifest.xml';
|
OPENDOC_PATH_METAINF_MANIFEST = 'META-INF' + PathDelim + 'manifest.xml';
|
||||||
|
|
||||||
@ -270,27 +270,28 @@ begin
|
|||||||
FContent := FContent +
|
FContent := FContent +
|
||||||
' <table:table table:name="' + CurSheet.Name + '" table:style-name="ta1">' + LineEnding +
|
' <table:table table:name="' + CurSheet.Name + '" table:style-name="ta1">' + LineEnding +
|
||||||
' <table:table-column table:style-name="co1" table:number-columns-repeated="' +
|
' <table:table-column table:style-name="co1" table:number-columns-repeated="' +
|
||||||
IntToStr(LastColNum) + '" table:default-cell-style-name="Default"/>' + LineEnding;
|
IntToStr(LastColNum + 1) + '" table:default-cell-style-name="Default"/>' + LineEnding;
|
||||||
|
|
||||||
// The cells need to be written in order, row by row, cell by cell
|
// The cells need to be written in order, row by row, cell by cell
|
||||||
for j := 1 to CurSheet.GetLastRowNumber do
|
for j := 0 to CurSheet.GetLastRowNumber do
|
||||||
begin
|
begin
|
||||||
FContent := FContent +
|
FContent := FContent +
|
||||||
' <table:table-row table:style-name="ro1">' + LineEnding;
|
' <table:table-row table:style-name="ro1">' + LineEnding;
|
||||||
|
|
||||||
// First make an array with the cells of this row in their respective order
|
// First make an array with the cells of this row in their respective order
|
||||||
// nil pointers indicate empty cells, so it's necessary to initialize the array
|
// nil pointers indicate empty cells, so it's necessary to initialize the array
|
||||||
SetLength(CurRow, LastColNum);
|
SetLength(CurRow, LastColNum + 1);
|
||||||
for k := 0 to LastColNum - 1 do CurRow[k] := nil;
|
for k := 0 to LastColNum do CurRow[k] := nil;
|
||||||
|
|
||||||
// Now fill the array with the cells in their proper place
|
// Now fill the array with the cells in their proper place
|
||||||
for k := 0 to CurSheet.FCells.Count - 1 do
|
for k := 0 to CurSheet.FCells.Count - 1 do
|
||||||
begin
|
begin
|
||||||
CurCell := CurSheet.FCells.Items[k];
|
CurCell := CurSheet.FCells.Items[k];
|
||||||
if CurCell^.Row = j then CurRow[CurCell^.Col - 1] := CurCell;
|
if CurCell^.Row = j then CurRow[CurCell^.Col] := CurCell;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for k := 0 to LastColNum - 1 do
|
// And now write all cells from this row
|
||||||
|
for k := 0 to LastColNum do
|
||||||
begin
|
begin
|
||||||
CurCell := CurRow[k];
|
CurCell := CurRow[k];
|
||||||
|
|
||||||
@ -384,7 +385,11 @@ end;
|
|||||||
procedure TsSpreadOpenDocWriter.WriteLabel(AStream: TStream; const ARow,
|
procedure TsSpreadOpenDocWriter.WriteLabel(AStream: TStream; const ARow,
|
||||||
ACol: Word; const AValue: string);
|
ACol: Word; const AValue: string);
|
||||||
begin
|
begin
|
||||||
|
// The row should already be the correct one
|
||||||
|
FContent := FContent +
|
||||||
|
' <table:table-cell office:value-type="string">' + LineEnding +
|
||||||
|
' <text:p>' + AValue + '</text:p>' + LineEnding +
|
||||||
|
' </table:table-cell>' + LineEnding;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsSpreadOpenDocWriter.WriteNumber(AStream: TStream; const ARow,
|
procedure TsSpreadOpenDocWriter.WriteNumber(AStream: TStream; const ARow,
|
||||||
|
@ -304,9 +304,6 @@ end;
|
|||||||
}
|
}
|
||||||
function TsWorksheet.GetCell(ARow, ACol: Cardinal): PCell;
|
function TsWorksheet.GetCell(ARow, ACol: Cardinal): PCell;
|
||||||
begin
|
begin
|
||||||
// First make sure the row and col values are valid
|
|
||||||
if (ARow = 0) or (ACol = 0) then raise Exception.Create('FPSpreadsheet: Row and Col numbers cannot be zero');
|
|
||||||
|
|
||||||
Result := FindCell(ARow, ACol);
|
Result := FindCell(ARow, ACol);
|
||||||
|
|
||||||
if (Result = nil) then
|
if (Result = nil) then
|
||||||
|
@ -13,8 +13,7 @@ To ensure a properly formed file, the following order must be respected:
|
|||||||
2nd to Nth record: Any record
|
2nd to Nth record: Any record
|
||||||
Last record: EOF
|
Last record: EOF
|
||||||
|
|
||||||
The row and column numbering in BIFF files is zero-based,
|
The row and column numbering in BIFF files is zero-based.
|
||||||
while in FPSpreadsheet it is 1-based, so this needs to be considered.
|
|
||||||
|
|
||||||
Excel file format specification obtained from:
|
Excel file format specification obtained from:
|
||||||
|
|
||||||
@ -85,10 +84,6 @@ const
|
|||||||
INT_EXCEL_CHART = $0020;
|
INT_EXCEL_CHART = $0020;
|
||||||
INT_EXCEL_MACRO_SHEET = $0040;
|
INT_EXCEL_MACRO_SHEET = $0040;
|
||||||
|
|
||||||
{ Marks differences between the BIFF format and FPSpreadsheet }
|
|
||||||
INT_FPS_BIFF_ROW_DELTA = 1;
|
|
||||||
INT_FPS_BIFF_COL_DELTA = 1;
|
|
||||||
|
|
||||||
{ TsSpreadBIFF2Writer }
|
{ TsSpreadBIFF2Writer }
|
||||||
|
|
||||||
{*******************************************************************
|
{*******************************************************************
|
||||||
@ -172,8 +167,8 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(17 + RPNLength));
|
AStream.WriteWord(WordToLE(17 + RPNLength));
|
||||||
|
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
AStream.WriteWord(WordToLE(ARow - INT_FPS_BIFF_ROW_DELTA));
|
AStream.WriteWord(WordToLE(ARow));
|
||||||
AStream.WriteWord(WordToLE(ACol - INT_FPS_BIFF_COL_DELTA));
|
AStream.WriteWord(WordToLE(ACol));
|
||||||
|
|
||||||
{ BIFF2 Attributes }
|
{ BIFF2 Attributes }
|
||||||
AStream.WriteByte($0);
|
AStream.WriteByte($0);
|
||||||
@ -218,8 +213,8 @@ begin
|
|||||||
|
|
||||||
INT_EXCEL_TOKEN_TREFR, INT_EXCEL_TOKEN_TREFV, INT_EXCEL_TOKEN_TREFA:
|
INT_EXCEL_TOKEN_TREFR, INT_EXCEL_TOKEN_TREFV, INT_EXCEL_TOKEN_TREFA:
|
||||||
begin
|
begin
|
||||||
AStream.WriteWord( (AFormula[i].Row - INT_FPS_BIFF_ROW_DELTA) and MASK_EXCEL_ROW);
|
AStream.WriteWord(AFormula[i].Row and MASK_EXCEL_ROW);
|
||||||
AStream.WriteByte(AFormula[i].Col - INT_FPS_BIFF_COL_DELTA);
|
AStream.WriteByte(AFormula[i].Col);
|
||||||
Inc(RPNLength, 3);
|
Inc(RPNLength, 3);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -257,8 +252,8 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(8 + L));
|
AStream.WriteWord(WordToLE(8 + L));
|
||||||
|
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
AStream.WriteWord(WordToLE(ARow - INT_FPS_BIFF_ROW_DELTA));
|
AStream.WriteWord(WordToLE(ARow));
|
||||||
AStream.WriteWord(WordToLE(ACol - INT_FPS_BIFF_COL_DELTA));
|
AStream.WriteWord(WordToLE(ACol));
|
||||||
|
|
||||||
{ BIFF2 Attributes }
|
{ BIFF2 Attributes }
|
||||||
AStream.WriteByte($0);
|
AStream.WriteByte($0);
|
||||||
@ -286,8 +281,8 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(15));
|
AStream.WriteWord(WordToLE(15));
|
||||||
|
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
AStream.WriteWord(WordToLE(ARow - INT_FPS_BIFF_ROW_DELTA));
|
AStream.WriteWord(WordToLE(ARow));
|
||||||
AStream.WriteWord(WordToLE(ACol - INT_FPS_BIFF_COL_DELTA));
|
AStream.WriteWord(WordToLE(ACol));
|
||||||
|
|
||||||
{ BIFF2 Attributes }
|
{ BIFF2 Attributes }
|
||||||
AStream.WriteByte($0);
|
AStream.WriteByte($0);
|
||||||
@ -351,8 +346,8 @@ var
|
|||||||
AStrValue: ansistring;
|
AStrValue: ansistring;
|
||||||
begin
|
begin
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
ARow := WordLEToN(AStream.ReadWord) + INT_FPS_BIFF_ROW_DELTA;
|
ARow := WordLEToN(AStream.ReadWord);
|
||||||
ACol := WordLEToN(AStream.ReadWord) + INT_FPS_BIFF_COL_DELTA;
|
ACol := WordLEToN(AStream.ReadWord);
|
||||||
|
|
||||||
{ BIFF2 Attributes }
|
{ BIFF2 Attributes }
|
||||||
AStream.ReadByte();
|
AStream.ReadByte();
|
||||||
@ -375,8 +370,8 @@ var
|
|||||||
AValue: Double;
|
AValue: Double;
|
||||||
begin
|
begin
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
ARow := WordLEToN(AStream.ReadWord) + INT_FPS_BIFF_ROW_DELTA;
|
ARow := WordLEToN(AStream.ReadWord);
|
||||||
ACol := WordLEToN(AStream.ReadWord) + INT_FPS_BIFF_COL_DELTA;
|
ACol := WordLEToN(AStream.ReadWord);
|
||||||
|
|
||||||
{ BIFF2 Attributes }
|
{ BIFF2 Attributes }
|
||||||
AStream.ReadByte();
|
AStream.ReadByte();
|
||||||
|
@ -31,8 +31,7 @@ DIMENSIONS
|
|||||||
WINDOW2
|
WINDOW2
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
The row and column numbering in BIFF files is zero-based,
|
The row and column numbering in BIFF files is zero-based.
|
||||||
while in FPSpreadsheet it is 1-based, so this needs to be considered.
|
|
||||||
|
|
||||||
Excel file format specification obtained from:
|
Excel file format specification obtained from:
|
||||||
|
|
||||||
@ -206,10 +205,6 @@ const
|
|||||||
|
|
||||||
MASK_XF_VERT_ALIGN = $70;
|
MASK_XF_VERT_ALIGN = $70;
|
||||||
|
|
||||||
{ Marks differences between the BIFF format and FPSpreadsheet }
|
|
||||||
INT_FPS_BIFF_ROW_DELTA = 1;
|
|
||||||
INT_FPS_BIFF_COL_DELTA = 1;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Exported functions
|
Exported functions
|
||||||
}
|
}
|
||||||
@ -557,8 +552,8 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(22 + RPNLength));
|
AStream.WriteWord(WordToLE(22 + RPNLength));
|
||||||
|
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
AStream.WriteWord(WordToLE(ARow - INT_FPS_BIFF_ROW_DELTA));
|
AStream.WriteWord(WordToLE(ARow));
|
||||||
AStream.WriteWord(WordToLE(ACol - INT_FPS_BIFF_COL_DELTA));
|
AStream.WriteWord(WordToLE(ACol));
|
||||||
|
|
||||||
{ Index to XF Record }
|
{ Index to XF Record }
|
||||||
AStream.WriteWord($0000);
|
AStream.WriteWord($0000);
|
||||||
@ -603,8 +598,8 @@ begin
|
|||||||
|
|
||||||
INT_EXCEL_TOKEN_TREFR, INT_EXCEL_TOKEN_TREFV, INT_EXCEL_TOKEN_TREFA:
|
INT_EXCEL_TOKEN_TREFR, INT_EXCEL_TOKEN_TREFV, INT_EXCEL_TOKEN_TREFA:
|
||||||
begin
|
begin
|
||||||
AStream.WriteWord( (AFormula[i].Row - INT_FPS_BIFF_ROW_DELTA) and MASK_EXCEL_ROW);
|
AStream.WriteWord(AFormula[i].Row and MASK_EXCEL_ROW);
|
||||||
AStream.WriteByte(AFormula[i].Col - INT_FPS_BIFF_COL_DELTA);
|
AStream.WriteByte(AFormula[i].Col);
|
||||||
Inc(RPNLength, 3);
|
Inc(RPNLength, 3);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -674,8 +669,8 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(8 + L));
|
AStream.WriteWord(WordToLE(8 + L));
|
||||||
|
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
AStream.WriteWord(WordToLE(ARow - INT_FPS_BIFF_ROW_DELTA));
|
AStream.WriteWord(WordToLE(ARow));
|
||||||
AStream.WriteWord(WordToLE(ACol - INT_FPS_BIFF_COL_DELTA));
|
AStream.WriteWord(WordToLE(ACol));
|
||||||
|
|
||||||
{ Index to XF record }
|
{ Index to XF record }
|
||||||
AStream.WriteWord(15);
|
AStream.WriteWord(15);
|
||||||
@ -701,8 +696,8 @@ begin
|
|||||||
AStream.WriteWord(WordToLE(14));
|
AStream.WriteWord(WordToLE(14));
|
||||||
|
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
AStream.WriteWord(WordToLE(ARow - INT_FPS_BIFF_ROW_DELTA));
|
AStream.WriteWord(WordToLE(ARow));
|
||||||
AStream.WriteWord(WordToLE(ACol - INT_FPS_BIFF_COL_DELTA));
|
AStream.WriteWord(WordToLE(ACol));
|
||||||
|
|
||||||
{ Index to XF record }
|
{ Index to XF record }
|
||||||
AStream.WriteWord($0);
|
AStream.WriteWord($0);
|
||||||
@ -1060,8 +1055,8 @@ var
|
|||||||
AValue: Double;
|
AValue: Double;
|
||||||
begin
|
begin
|
||||||
{ BIFF Record data }
|
{ BIFF Record data }
|
||||||
ARow := WordLEToN(AStream.ReadWord) + INT_FPS_BIFF_ROW_DELTA;
|
ARow := WordLEToN(AStream.ReadWord);
|
||||||
ACol := WordLEToN(AStream.ReadWord) + INT_FPS_BIFF_COL_DELTA;
|
ACol := WordLEToN(AStream.ReadWord);
|
||||||
|
|
||||||
{ Index to XF record }
|
{ Index to XF record }
|
||||||
AStream.ReadWord();
|
AStream.ReadWord();
|
||||||
|
Loading…
Reference in New Issue
Block a user