fpspreadsheet: Improved format detection when reading biff files. Unit test without errors due to biff now again. Fix compilation error of other formats due to new NumFormatList.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3048 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-05-15 12:53:56 +00:00
parent 5cdd884f56
commit dae7caff9c
8 changed files with 337 additions and 206 deletions

View File

@ -107,7 +107,7 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="57">
<Units Count="59">
<Unit0>
<Filename Value="fpsgrid.lpr"/>
<IsPartOfProject Value="True"/>
@ -139,9 +139,12 @@
<UnitName Value="fpspreadsheet"/>
<EditorIndex Value="3"/>
<WindowIndex Value="0"/>
<TopLine Value="2539"/>
<CursorPos X="19" Y="2550"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="100"/>
<Bookmarks Count="1">
<Item0 X="13" Y="2613" ID="1"/>
</Bookmarks>
<Loaded Value="True"/>
</Unit2>
<Unit3>
@ -149,8 +152,8 @@
<UnitName Value="fpspreadsheetgrid"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/>
<TopLine Value="525"/>
<CursorPos X="30" Y="533"/>
<TopLine Value="1774"/>
<CursorPos X="26" Y="1785"/>
<UsageCount Value="100"/>
<Loaded Value="True"/>
</Unit3>
@ -160,7 +163,7 @@
<WindowIndex Value="0"/>
<TopLine Value="25"/>
<CursorPos X="4" Y="44"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit4>
<Unit5>
<Filename Value="c:\lazarus27\fpc\2.2.4\source\packages\winunits-base\src\activex.pp"/>
@ -168,7 +171,7 @@
<WindowIndex Value="0"/>
<TopLine Value="49"/>
<CursorPos X="10" Y="24"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit5>
<Unit6>
<Filename Value="c:\lazarus27\fpc\2.2.4\source\packages\fcl-base\src\avl_tree.pp"/>
@ -176,7 +179,7 @@
<WindowIndex Value="0"/>
<TopLine Value="37"/>
<CursorPos X="14" Y="83"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit6>
<Unit7>
<Filename Value="c:\Lazarus\lcl\grids.pas"/>
@ -184,14 +187,14 @@
<WindowIndex Value="0"/>
<TopLine Value="1516"/>
<CursorPos X="28" Y="1534"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit7>
<Unit8>
<Filename Value="c:\Lazarus\lcl\include\customform.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="2021"/>
<CursorPos X="1" Y="2041"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit8>
<Unit9>
<Filename Value="..\..\fpsallformats.pas"/>
@ -199,7 +202,7 @@
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="62" Y="13"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit9>
<Unit10>
<Filename Value="..\..\wikitable.pas"/>
@ -207,7 +210,7 @@
<WindowIndex Value="0"/>
<TopLine Value="48"/>
<CursorPos X="41" Y="60"/>
<UsageCount Value="12"/>
<UsageCount Value="11"/>
</Unit10>
<Unit11>
<Filename Value="..\..\fpsopendocument.pas"/>
@ -215,27 +218,25 @@
<WindowIndex Value="0"/>
<TopLine Value="1"/>
<CursorPos X="1" Y="1"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit11>
<Unit12>
<Filename Value="d:\lazarus-svn\lcl\grids.pas"/>
<UnitName Value="Grids"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="4852"/>
<CursorPos X="16" Y="4884"/>
<UsageCount Value="48"/>
<Loaded Value="True"/>
<UsageCount Value="47"/>
</Unit12>
<Unit13>
<Filename Value="..\..\fpsutils.pas"/>
<UnitName Value="fpsutils"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="9"/>
<WindowIndex Value="0"/>
<TopLine Value="614"/>
<CursorPos X="23" Y="621"/>
<UsageCount Value="47"/>
<TopLine Value="65"/>
<CursorPos X="1" Y="78"/>
<UsageCount Value="51"/>
<Loaded Value="True"/>
</Unit13>
<Unit14>
@ -243,7 +244,7 @@
<WindowIndex Value="0"/>
<TopLine Value="1212"/>
<CursorPos X="3" Y="1218"/>
<UsageCount Value="4"/>
<UsageCount Value="3"/>
</Unit14>
<Unit15>
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
@ -251,26 +252,23 @@
<WindowIndex Value="0"/>
<TopLine Value="1937"/>
<CursorPos X="11" Y="1956"/>
<UsageCount Value="33"/>
<UsageCount Value="32"/>
</Unit15>
<Unit16>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\classesh.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="248"/>
<CursorPos X="22" Y="263"/>
<UsageCount Value="12"/>
<UsageCount Value="11"/>
</Unit16>
<Unit17>
<Filename Value="..\..\xlsbiff8.pas"/>
<UnitName Value="xlsbiff8"/>
<EditorIndex Value="5"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/>
<TopLine Value="1747"/>
<CursorPos X="25" Y="1779"/>
<UsageCount Value="78"/>
<Bookmarks Count="1">
<Item0 X="1" Y="1761" ID="1"/>
</Bookmarks>
<TopLine Value="62"/>
<CursorPos X="15" Y="90"/>
<UsageCount Value="82"/>
<Loaded Value="True"/>
</Unit17>
<Unit18>
@ -279,23 +277,23 @@
<WindowIndex Value="0"/>
<TopLine Value="1091"/>
<CursorPos X="12" Y="1122"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit18>
<Unit19>
<Filename Value="d:\lazarus-svn\lcl\include\wincontrol.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="7344"/>
<CursorPos X="30" Y="7349"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit19>
<Unit20>
<Filename Value="..\..\xlscommon.pas"/>
<UnitName Value="xlscommon"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/>
<TopLine Value="1207"/>
<CursorPos X="1" Y="1217"/>
<UsageCount Value="74"/>
<TopLine Value="608"/>
<CursorPos X="31" Y="634"/>
<UsageCount Value="78"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
@ -305,7 +303,7 @@
<WindowIndex Value="0"/>
<TopLine Value="1363"/>
<CursorPos X="1" Y="1364"/>
<UsageCount Value="61"/>
<UsageCount Value="65"/>
<Loaded Value="True"/>
</Unit21>
<Unit22>
@ -315,7 +313,7 @@
<WindowIndex Value="0"/>
<TopLine Value="664"/>
<CursorPos X="21" Y="677"/>
<UsageCount Value="62"/>
<UsageCount Value="66"/>
<Loaded Value="True"/>
</Unit22>
<Unit23>
@ -324,7 +322,7 @@
<WindowIndex Value="0"/>
<TopLine Value="841"/>
<CursorPos X="19" Y="852"/>
<UsageCount Value="1"/>
<UsageCount Value="10"/>
</Unit23>
<Unit24>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\packages\fcl-image\src\fpcanvas.pp"/>
@ -332,7 +330,7 @@
<WindowIndex Value="0"/>
<TopLine Value="111"/>
<CursorPos X="3" Y="112"/>
<UsageCount Value="14"/>
<UsageCount Value="13"/>
</Unit24>
<Unit25>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\packages\fcl-image\src\fpimage.pp"/>
@ -340,14 +338,14 @@
<WindowIndex Value="0"/>
<TopLine Value="74"/>
<CursorPos X="3" Y="93"/>
<UsageCount Value="2"/>
<UsageCount Value="1"/>
</Unit25>
<Unit26>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\lists.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="141"/>
<CursorPos X="3" Y="143"/>
<UsageCount Value="10"/>
<UsageCount Value="9"/>
</Unit26>
<Unit27>
<Filename Value="d:\Prog_Delphi\common\units\XLS.pas"/>
@ -355,14 +353,14 @@
<WindowIndex Value="0"/>
<TopLine Value="114"/>
<CursorPos X="42" Y="152"/>
<UsageCount Value="10"/>
<UsageCount Value="9"/>
</Unit27>
<Unit28>
<Filename Value="d:\lazarus-svn\lcl\include\pen.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="354"/>
<CursorPos X="1" Y="385"/>
<UsageCount Value="15"/>
<UsageCount Value="14"/>
</Unit28>
<Unit29>
<Filename Value="d:\lazarus-svn\lcl\controls.pp"/>
@ -370,14 +368,14 @@
<WindowIndex Value="0"/>
<TopLine Value="2222"/>
<CursorPos X="14" Y="2242"/>
<UsageCount Value="10"/>
<UsageCount Value="9"/>
</Unit29>
<Unit30>
<Filename Value="d:\lazarus-svn\lcl\include\control.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="4129"/>
<CursorPos X="1" Y="4161"/>
<UsageCount Value="9"/>
<UsageCount Value="8"/>
</Unit30>
<Unit31>
<Filename Value="..\..\fpspreadsheetchart.pas"/>
@ -385,7 +383,7 @@
<WindowIndex Value="0"/>
<TopLine Value="170"/>
<CursorPos X="37" Y="204"/>
<UsageCount Value="5"/>
<UsageCount Value="4"/>
</Unit31>
<Unit32>
<Filename Value="d:\lazarus-svn\components\lazutils\lazutf8.pas"/>
@ -393,7 +391,7 @@
<WindowIndex Value="0"/>
<TopLine Value="3180"/>
<CursorPos X="1" Y="3212"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit32>
<Unit33>
<Filename Value="d:\lazarus-svn\lcl\colorbox.pas"/>
@ -401,7 +399,7 @@
<WindowIndex Value="0"/>
<TopLine Value="584"/>
<CursorPos X="3" Y="598"/>
<UsageCount Value="14"/>
<UsageCount Value="13"/>
</Unit33>
<Unit34>
<Filename Value="d:\lazarus-svn\lcl\dialogs.pp"/>
@ -409,7 +407,7 @@
<WindowIndex Value="0"/>
<TopLine Value="222"/>
<CursorPos X="3" Y="253"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit34>
<Unit35>
<Filename Value="d:\lazarus-svn\lcl\forms.pp"/>
@ -417,7 +415,7 @@
<WindowIndex Value="0"/>
<TopLine Value="932"/>
<CursorPos X="3" Y="939"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit35>
<Unit36>
<Filename Value="C:\development\lazarus\lcl\graphics.pp"/>
@ -425,7 +423,7 @@
<WindowIndex Value="0"/>
<TopLine Value="2053"/>
<CursorPos X="30" Y="1945"/>
<UsageCount Value="9"/>
<UsageCount Value="8"/>
</Unit36>
<Unit37>
<Filename Value="C:\development\fpc\packages\fcl-image\src\fpcanvas.pp"/>
@ -433,14 +431,14 @@
<WindowIndex Value="0"/>
<TopLine Value="89"/>
<CursorPos X="15" Y="97"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit37>
<Unit38>
<Filename Value="C:\development\fpc\packages\fcl-image\src\fpfont.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="54"/>
<CursorPos X="3" Y="57"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit38>
<Unit39>
<Filename Value="C:\development\lazarus\lcl\graphmath.pp"/>
@ -448,7 +446,7 @@
<WindowIndex Value="0"/>
<TopLine Value="584"/>
<CursorPos X="3" Y="439"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit39>
<Unit40>
<Filename Value="C:\development\lazarus\lcl\graphtype.pp"/>
@ -456,7 +454,7 @@
<WindowIndex Value="0"/>
<TopLine Value="234"/>
<CursorPos X="3" Y="33"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit40>
<Unit41>
<Filename Value="C:\development\lazarus\lcl\lcltype.pp"/>
@ -464,7 +462,7 @@
<WindowIndex Value="0"/>
<TopLine Value="1628"/>
<CursorPos X="3" Y="1643"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit41>
<Unit42>
<Filename Value="C:\development\lazarus\lcl\graphutil.pp"/>
@ -472,7 +470,7 @@
<WindowIndex Value="0"/>
<TopLine Value="128"/>
<CursorPos X="12" Y="143"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit42>
<Unit43>
<Filename Value="C:\development\fpc\rtl\objpas\math.pp"/>
@ -480,14 +478,16 @@
<WindowIndex Value="0"/>
<TopLine Value="144"/>
<CursorPos X="10" Y="159"/>
<UsageCount Value="11"/>
<UsageCount Value="10"/>
</Unit43>
<Unit44>
<Filename Value="C:\development\fpc\rtl\i386\i386.inc"/>
<EditorIndex Value="5"/>
<WindowIndex Value="0"/>
<TopLine Value="1551"/>
<CursorPos X="3" Y="1563"/>
<UsageCount Value="9"/>
<TopLine Value="1497"/>
<CursorPos X="1" Y="1515"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit44>
<Unit45>
<Filename Value="C:\development\lazarus\lcl\grids.pas"/>
@ -495,7 +495,7 @@
<WindowIndex Value="0"/>
<TopLine Value="794"/>
<CursorPos X="15" Y="1010"/>
<UsageCount Value="15"/>
<UsageCount Value="14"/>
</Unit45>
<Unit46>
<Filename Value="..\..\..\spktoolbar\SpkGraphTools\SpkGraphTools.pas"/>
@ -503,199 +503,213 @@
<WindowIndex Value="0"/>
<TopLine Value="136"/>
<CursorPos X="1" Y="143"/>
<UsageCount Value="6"/>
<UsageCount Value="5"/>
</Unit46>
<Unit47>
<Filename Value="C:\development\fpc\rtl\objpas\classes\lists.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="34"/>
<CursorPos X="1" Y="49"/>
<UsageCount Value="14"/>
<UsageCount Value="13"/>
</Unit47>
<Unit48>
<Filename Value="C:\development\lazarus\lcl\include\canvas.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="1705"/>
<CursorPos X="1" Y="1720"/>
<UsageCount Value="14"/>
<UsageCount Value="13"/>
</Unit48>
<Unit49>
<Filename Value="C:\development\lazarus\lcl\include\font.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="1139"/>
<CursorPos X="25" Y="1161"/>
<UsageCount Value="14"/>
<UsageCount Value="13"/>
</Unit49>
<Unit50>
<Filename Value="C:\development\lazarus\lcl\include\winapih.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="156"/>
<CursorPos X="10" Y="171"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit50>
<Unit51>
<Filename Value="C:\development\lazarus\lcl\include\intfbasewinapi.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="1577"/>
<CursorPos X="3" Y="1579"/>
<UsageCount Value="8"/>
<UsageCount Value="7"/>
</Unit51>
<Unit52>
<Filename Value="C:\development\fpc\rtl\inc\except.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="202"/>
<CursorPos X="1" Y="227"/>
<UsageCount Value="8"/>
<UsageCount Value="12"/>
</Unit52>
<Unit53>
<Filename Value="d:\lazarus-svn\lcl\include\menuitem.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="69"/>
<CursorPos X="28" Y="82"/>
<UsageCount Value="14"/>
<UsageCount Value="13"/>
</Unit53>
<Unit54>
<Filename Value="d:\lazarus-svn\lcl\include\application.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="1371"/>
<CursorPos X="1" Y="1390"/>
<UsageCount Value="13"/>
<UsageCount Value="12"/>
</Unit54>
<Unit55>
<Filename Value="d:\lazarus-svn\lcl\include\font.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="648"/>
<CursorPos X="1" Y="675"/>
<UsageCount Value="12"/>
<UsageCount Value="11"/>
</Unit55>
<Unit56>
<Filename Value="d:\lazarus-svn\lcl\include\fontdialog.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="24"/>
<CursorPos X="1" Y="49"/>
<UsageCount Value="12"/>
<UsageCount Value="11"/>
</Unit56>
<Unit57>
<Filename Value="C:\development\fpc\rtl\objpas\sysutils\sysinth.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="50"/>
<CursorPos X="3" Y="57"/>
<UsageCount Value="10"/>
</Unit57>
<Unit58>
<Filename Value="C:\development\fpc\rtl\inc\wstrings.inc"/>
<WindowIndex Value="0"/>
<TopLine Value="169"/>
<CursorPos X="1" Y="185"/>
<UsageCount Value="10"/>
</Unit58>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1753" Column="1" TopLine="1738"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="783" Column="1" TopLine="768"/>
</Position1>
<Position2>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1968" Column="1" TopLine="1928"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="804" Column="1" TopLine="788"/>
</Position2>
<Position3>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="805" Column="1" TopLine="788"/>
</Position3>
<Position4>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="80" Column="21" TopLine="47"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="817" Column="32" TopLine="788"/>
</Position4>
<Position5>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1760" Column="1" TopLine="1744"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="807" Column="1" TopLine="788"/>
</Position5>
<Position6>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="95" Column="22" TopLine="75"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="808" Column="1" TopLine="788"/>
</Position6>
<Position7>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="784" Column="1" TopLine="769"/>
</Position7>
<Position8>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1524" Column="37" TopLine="1516"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="785" Column="1" TopLine="769"/>
</Position8>
<Position9>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1649" Column="21" TopLine="1622"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="786" Column="1" TopLine="769"/>
</Position9>
<Position10>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1527" Column="3" TopLine="1524"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="787" Column="1" TopLine="769"/>
</Position10>
<Position11>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1758" Column="3" TopLine="1733"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="788" Column="1" TopLine="769"/>
</Position11>
<Position12>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="794" Column="1" TopLine="769"/>
</Position12>
<Position13>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="51" Column="19" TopLine="18"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="1108" Column="1" TopLine="1093"/>
</Position13>
<Position14>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="57" Column="11" TopLine="24"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="1109" Column="1" TopLine="1093"/>
</Position14>
<Position15>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="67" Column="13" TopLine="34"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1461" Column="1" TopLine="1445"/>
</Position15>
<Position16>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1394" Column="3" TopLine="1388"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1462" Column="1" TopLine="1445"/>
</Position16>
<Position17>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1761" Column="3" TopLine="1738"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1464" Column="1" TopLine="1445"/>
</Position17>
<Position18>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="95" Column="75" TopLine="76"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1465" Column="1" TopLine="1451"/>
</Position18>
<Position19>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1749" Column="8" TopLine="1747"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1469" Column="1" TopLine="1451"/>
</Position19>
<Position20>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="95" Column="55" TopLine="95"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1470" Column="1" TopLine="1451"/>
</Position20>
<Position21>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1748" Column="49" TopLine="1733"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1471" Column="1" TopLine="1451"/>
</Position21>
<Position22>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="95" Column="55" TopLine="95"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1485" Column="39" TopLine="1468"/>
</Position22>
<Position23>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1749" Column="8" TopLine="1747"/>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="913" Column="46" TopLine="884"/>
</Position23>
<Position24>
<Filename Value="..\..\xlsbiff5.pas"/>
<Caret Line="1370" Column="1" TopLine="1358"/>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="83" Column="3" TopLine="52"/>
</Position24>
<Position25>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="39" Column="3" TopLine="10"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1485" Column="42" TopLine="1459"/>
</Position25>
<Position26>
<Filename Value="..\..\xlsbiff2.pas"/>
<Caret Line="677" Column="21" TopLine="664"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position26>
<Position27>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="524" Column="27" TopLine="524"/>
<Filename Value="..\..\fpspreadsheet.pas"/>
<Caret Line="2612" Column="3" TopLine="2674"/>
</Position27>
<Position28>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="581" Column="3" TopLine="573"/>
</Position28>
<Position29>
<Filename Value="..\..\fpspreadsheetgrid.pas"/>
<Caret Line="1787" Column="3" TopLine="1779"/>
<Filename Value="..\..\xlscommon.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position29>
<Position30>
<Filename Value="..\..\xlsbiff8.pas"/>
<Caret Line="1779" Column="25" TopLine="1747"/>
<Filename Value="..\..\fpsutils.pas"/>
<Caret Line="1157" Column="1" TopLine="1131"/>
</Position30>
</JumpHistory>
</ProjectOptions>
@ -725,15 +739,6 @@
</Other>
</CompilerOptions>
<Debugging>
<BreakPoints Count="1">
<Item1>
<Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="..\..\fpspreadsheetgrid.pas"/>
<Line Value="1790"/>
</Item1>
</BreakPoints>
<Watches Count="2">
<Item1>
<Expression Value="acol"/>

View File

@ -13,7 +13,7 @@ program test_write_formatting;
uses
Classes, SysUtils, fpspreadsheet, xlsbiff8, fpsopendocument,
laz_fpspreadsheet, fpsconvencoding;
laz_fpspreadsheet;
var
MyWorkbook: TsWorkbook;

View File

@ -12,7 +12,7 @@ program test_write_formula;
uses
Classes, SysUtils,
fpspreadsheet, xlsbiff5, xlsbiff8, fpsopendocument,
laz_fpspreadsheet, fpsconvencoding;
laz_fpspreadsheet;
var
MyWorkbook: TsWorkbook;

View File

@ -521,8 +521,8 @@ type
FFirstFormatIndexInFile: Integer;
FNextFormatIndex: Integer;
procedure AddBuiltinFormats; virtual;
procedure Analyze(var AFormatString: String; var ANumFormat: TsNumberFormat;
var ADecimals: Word); virtual;
procedure Analyze(AFormatIndex: Integer; var AFormatString: String;
var ANumFormat: TsNumberFormat; var ADecimals: Word); virtual;
procedure RemoveFormat(AIndex: Integer);
public
constructor Create;
@ -555,7 +555,7 @@ type
FWorkbook: TsWorkbook;
FWorksheet: TsWorksheet;
FNumFormatList: TsCustomNumFormatList;
procedure CreateNumFormatList; virtual; abstract;
procedure CreateNumFormatList; virtual;
{ Record reading methods }
procedure ReadBlank(AStream: TStream); virtual; abstract;
procedure ReadFormula(AStream: TStream); virtual; abstract;
@ -587,7 +587,7 @@ type
FNumFormatList: TsCustomNumFormatList;
{ Helper routines }
procedure AddDefaultFormats(); virtual;
procedure CreateNumFormatList; virtual; abstract;
procedure CreateNumFormatList; virtual;
function ExpandFormula(AFormula: TsFormula): TsExpandedFormula;
function FindFormattingInList(AFormat: PCell): Integer;
procedure FixFormat(ACell: PCell); virtual;
@ -1480,20 +1480,20 @@ begin
nfLongTime:
ACell^.NumberFormatStr := 'tt';
nfShortTimeAM:
ACell^.NumberFormatStr := 't am/pm';
ACell^.NumberFormatStr := 'hh:nn AM/PM';
nfLongTimeAM:
ACell^.NumberFormatStr := 'tt am/pm';
ACell^.NumberFormatStr := 'hh:nn:ss AM/PM';
nfFmtDateTime:
begin
fmt := lowercase(AFormatStr);
if fmt = 'dm' then ACell^.NumberFormatStr := 'd/mmm'
else if fmt = 'my' then ACell^.NumberFormatStr := 'mmm/yy'
else if fmt = 'ms' then ACell^.NumberFormatStr := 'mm:ss' // Excel does not like the "n"
else if fmt = 'msz' then ACell^.NumberFormatStr := 'mm:ss.z'
else if fmt = 'ms' then ACell^.NumberFormatStr := 'nn:ss'
else if fmt = 'msz' then ACell^.NumberFormatStr := 'nn:ss.z'
else ACell^.NumberFormatStr := AFormatStr;
end;
nfTimeInterval:
if AFormatStr = '' then ACell^.NumberFormatStr := '[h]:mm:ss'
if AFormatStr = '' then ACell^.NumberFormatStr := '[h]:nn:ss'
else ACell^.NumberFormatStr := AFormatStr;
end;
ChangedCell(ARow, ACol);
@ -2564,10 +2564,14 @@ begin
inc(FNextFormatIndex);
end;
{ Adds the builtin format items to the list. Must be called before user items
are added. Must specify FFirstFormatIndexInFile (BIFF5-8, e.g. don't save
formats <164) and must initialize the index of the first user format
(FNextFormatIndex) which is automatically incremented when adding user formats. }
{ Adds the builtin format items to the list. The formats must be specified in
a way which can be understood by fpc.
If fpc and file speak different languages "translation" must be made in
"Analyze" for reading and "FormatStringForWriting" for writing.
Must be called before user items are added.
Must specify FFirstFormatIndexInFile (BIFF5-8, e.g. doesn't save formats <164)
and must initialize the index of the first user format (FNextFormatIndex)
which is automatically incremented when adding user formats. }
procedure TsCustomNumFormatList.AddBuiltinFormats;
begin
// must be overridden
@ -2575,12 +2579,13 @@ end;
{ Takes the format string (AFormatString) as it is read from the file and
extracts the number format type (ANumFormat) and the number of decimals
(ADecimals) out of it. If the format string cannot be directly handled by
fpc it has to be transformed to make it compatible. Can be done in
overridden versions which know more about the structure of the string in
the actual file format. }
procedure TsCustomNumFormatList.Analyze(var AFormatString: String;
var ANumFormat: TsNumberFormat; var ADecimals: Word);
(ADecimals) out of it for use by fpc.
If the format string cannot be directly handled by fpc it has to be transformed
to make it compatible. Can be done in overridden versions which know more
about the structure of the string in the actual file format. }
procedure TsCustomNumFormatList.Analyze(AFormatIndex: Integer;
var AFormatString: String; var ANumFormat: TsNumberFormat;
var ADecimals: Word);
const
SHORT_LONG_DATE: array[boolean] of TsNumberFormat = (
nfShortDate, nfLongDate
@ -2600,7 +2605,42 @@ var
isInterval: Boolean;
isSci: Boolean;
isTime, isDate: Boolean;
lFormatData: TsNumFormatData;
i: Integer;
fmt: String;
begin
{ Check the built-in formats first }
i := Find(AFormatIndex);
if i > 0 then begin
lFormatData := Items[i];
case lFormatData.NumFormat of
nfFixed, nfFixedTh, nfPercentage, nfExp, nfSci:
begin
ANumFormat := lFormatData.NumFormat;
AFormatString := lFormatData.FormatString;
ADecimals := lFormatData.Decimals;
exit;
end;
nfShortDateTime, nfShortDate, nfLongDate,
nfShortTime, nfLongTime, nfShortTimeAM, nfLongTimeAM, nfTimeInterval:
begin
ANumFormat := lFormatData.NumFormat;
AFormatString := lFormatData.FormatString;
ADecimals := 0;
exit;
end;
nfFmtDateTime:
begin
ANumFormat := lFormatData.NumFormat;
AFormatString := lFormatData.FormatString;
IsTimeFormat(AFormatString, isLongTime, isAMPM, isInterval, ADecimals);
exit;
end;
end;
end;
{ Then check the non-standard formats. There is a chance that they may not be
reckognized correctly... }
ANumFormat := nfGeneral;
if IsPercentNumberFormat(AFormatString, ADecimals) then
ANumFormat := nfPercentage
@ -2648,7 +2688,7 @@ begin
raise Exception.Create('TsCustomNumFormatList.AnalyzeAndAdd: Format index must be unique.');
// Analyze the format string and extract information for internal formatting
Analyze(AFormatString, nf, decs);
Analyze(AFormatIndex, AFormatString, nf, decs);
// Add the new item
AddFormat(AFormatIndex, nf, AFormatString, decs);
@ -2828,6 +2868,12 @@ begin
inherited Destroy;
end;
procedure TsCustomSpreadReader.CreateNumFormatList;
begin
{ The format list needs to be created by descendants who know about the
special requirements of the file format. }
end;
{@@
Default file reading method.
@ -2979,6 +3025,12 @@ begin
NextXFIndex := 0;
end;
procedure TsCustomSpreadWriter.CreateNumFormatList;
begin
{ The format list needs to be created by descendants who know about the
special requirements of the file format. }
end;
procedure TsCustomSpreadWriter.ListAllFormattingStylesCallback(ACell: PCell; AStream: TStream);
var
Len: Integer;

View File

@ -653,8 +653,11 @@ end;
{ IsDateFormat checks if the format string s corresponds to a date format }
function IsDateFormat(s: String; out IsLong: Boolean): Boolean;
begin
s := Lowercase(s);
// Day, month, year are separated by a slash
Result := (pos('/', s) > 0);
// We also check part of the year/month/day symbol because there may be
// other control code with a slash.
Result := (pos('y/', s) > 0) or (pos('m/', s) > 0) or (pos('/m', s) > 0) or (pos('/d', s) > 0);
if Result then
// Check validity of format string
try
@ -688,6 +691,13 @@ begin
count := 1;
s := Uppercase(s);
// Seek for "H:MM:SS" or "H:MM" to see if it is a long or short time format.
if pos('H:MM:SS', s) <> 0 then
isLong := true
else
if pos('H:MM', s) <> 0 then
isLong := false
else
// If there are is a second colon s is a "long" time format
for i:=p+1 to Length(s) do
if s[i] = ':' then begin
@ -698,9 +708,11 @@ begin
// Seek for "AM/PM" etc to detect that specific format
isAMPM := (pos('AM/PM', s) > 0) or (pos('A/P', s) > 0) or (pos('AMPM', s) > 0);
// Look for square brackets indicating the interval format.
p := pos('[', s);
if p > 0 then isInterval := (pos(']', s) > 0) else isInterval := false;
// Look for special square bracket symbols indicating the interval format.
isInterval := (pos('[H]', s) <> 0) or (pos('[HH]', s) <> 0) or
(pos('[M]', s) <> 0) or (pos('[MM]', s) <> 0) or
(pos('[N]', s) <> 0) or (pos('[NN]', s) <> 0) or
(pos('[S]', s) <> 0) or (pos('[SS]', s) <> 0);
// Count decimals
pdp := pos('.', s);

View File

@ -182,10 +182,10 @@ begin
for i:=Low(SollDateTimes) to High(SollDateTimes) do begin
SollDateTimeStrings[i, 0] := DateToStr(SollDateTimes[i]) + ' ' + FormatDateTime('t', SollDateTimes[i]);
SollDateTimeStrings[i, 1] := DateToStr(SollDateTimes[i]);
SollDateTimeStrings[i, 2] := FormatDateTime('t', SollDateTimes[i]);
SolLDateTimeStrings[i, 3] := FormatDateTime('tt', SollDateTimes[i]);
SollDateTimeStrings[i, 4] := FormatDateTime('t am/pm', SollDateTimes[i]);
SollDateTimeStrings[i, 5] := FormatDateTime('tt am/pm', SollDateTimes[i]);
SollDateTimeStrings[i, 2] := FormatDateTime('hh:nn', SollDateTimes[i]);
SolLDateTimeStrings[i, 3] := FormatDateTime('hh:nn:ss', SollDateTimes[i]);
SollDateTimeStrings[i, 4] := FormatDateTime('hh:nn am/pm', SollDateTimes[i]); // dont't use "t" - it does the hours wrong
SollDateTimeStrings[i, 5] := FormatDateTime('hh:nn:ss am/pm', SollDateTimes[i]);
SollDateTimeStrings[i, 6] := FormatDateTime('dd/mmm', SollDateTimes[i]);
SollDateTimeStrings[i, 7] := FormatDateTime('mmm/yy', SollDateTimes[i]);
SollDateTimeStrings[i, 8] := FormatDateTime('nn:ss', SollDateTimes[i]);
@ -331,7 +331,11 @@ begin
Continue; // The formats nfFmtDateTime and nfTimeInterval are not supported by BIFF2
MyWorksheet.WriteDateTime(Row, Col, SollDateTimes[Row], SollDateTimeFormats[Col], SollDateTimeFormatStrings[Col]);
ActualString := MyWorksheet.ReadAsUTF8Text(Row, Col);
CheckEquals(SollDateTimeStrings[Row, Col], ActualString, 'Test unsaved string mismatch cell ' + CellNotation(MyWorksheet,Row,Col));
CheckEquals(
Lowercase(SollDateTimeStrings[Row, Col]),
Lowercase(ActualString),
'Test unsaved string mismatch cell ' + CellNotation(MyWorksheet,Row,Col)
);
end;
MyWorkBook.WriteToFile(TempFile, AFormat, true);
MyWorkbook.Free;
@ -350,7 +354,11 @@ begin
if (AFormat = sfExcel2) and (SollDateTimeFormats[Col] in [nfFmtDateTime, nfTimeInterval]) then
Continue; // The formats nfFmtDateTime and nfTimeInterval are not supported by BIFF2
ActualString := MyWorksheet.ReadAsUTF8Text(Row,Col);
CheckEquals(SollDateTimeStrings[Row, Col], ActualString, 'Test saved string mismatch cell '+CellNotation(MyWorksheet,Row,Col));
CheckEquals(
Lowercase(SollDateTimeStrings[Row, Col]),
Lowercase(ActualString),
'Test saved string mismatch cell '+CellNotation(MyWorksheet,Row,Col)
);
end;
// Finalization

View File

@ -348,6 +348,8 @@ type
TsBIFFNumFormatList = class(TsCustomNumFormatList)
protected
procedure AddBuiltinFormats; override;
procedure Analyze(AFormatIndex: Integer; var AFormatString: String;
var ANumFormat: TsNumberFormat; var ADecimals: Word); override;
public
function FormatStringForWriting(AIndex: Integer): String; override;
end;
@ -478,32 +480,6 @@ implementation
uses
StrUtils;
const
{ see ➜ 5.49 }
COUNT_DEFAULT_FORMATS = 58;
NOT_USED = nfGeneral;
DEFAULT_NUM_FORMATS: array[1..COUNT_DEFAULT_FORMATS] of TsNumberFormat = (
nfFixed, nfFixed, nfFixedTh, nfFixedTh, nfFixedTh, // 1..5
nfFixedTh, nfFixedTh, nfFixedTh, nfPercentage, nfPercentage, // 6..10
nfExp, NOT_USED, NOT_USED, nfShortDate, nfShortDate, // 11..15
nfFmtDateTime, nfFmtDateTime, nfShortTimeAM, nfLongTimeAM, nfShortTime, // 16..20
nfLongTime, nfShortDateTime, NOT_USED, NOT_USED, NOT_USED, // 21..25
NOT_USED, NOT_USED, NOT_USED, NOT_USED, NOT_USED, // 26..30
NOT_USED, NOT_USED, NOT_USED, NOT_USED, NOT_USED, // 31..35
NOT_USED, nfFixedTh, nfFixedTh, nfFixedTh, nfFixedTh, // 36..40
nfFixedTh, nfFixedTh, nfFixedTh, nfFixedTh, nfFmtDateTime, // 41..45
nfTimeInterval, nfFmtDateTime, nfSci, NOT_USED, NOT_USED, // 46..50
NOT_USED, NOT_USED, NOT_USED, NOT_USED, NOT_USED, // 51..55
NOT_USED, NOT_USED, NOT_USED // 56..58
);
DEFAULT_NUM_FORMAT_DECIMALS: array[1..COUNT_DEFAULT_FORMATS] of word = (
0, 2, 0, 2, 0, 0, 2, 2, 0, 2, // 1..10
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 11..20
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 21..30
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, // 31..40
0, 0, 2, 2, 0, 3, 0, 1, 0, 0, // 41..50 #48 is "scientific", use "exponential" instead
0, 0, 0, 0, 0, 0, 0, 0); // 51..58
function ConvertExcelDateTimeToDateTime(
const AExcelDateNum: Double; ADateMode: TDateMode): TDateTime;
begin
@ -574,17 +550,17 @@ begin
// fraction formats 12 ('# ?/?') and 13 ('# ??/??') not supported
AddFormat(14, nfShortDate);
AddFormat(15, nfLongDate);
AddFormat(16, nfFmtDateTime, 'D-MMM');
AddFormat(17, nfFmtDateTime, 'MMM-YY');
AddFormat(16, nfFmtDateTime, 'd/mmm');
AddFormat(17, nfFmtDateTime, 'mmm/yy');
AddFormat(18, nfShortTimeAM);
AddFormat(19, nfLongTimeAM);
AddFormat(20, nfShortTime);
AddFormat(21, nfLongTime);
AddFormat(22, nfShortDateTime);
// 23..44 not supported
AddFormat(45, nfFmtDateTime, 'mm:ss');
AddFormat(46, nfTimeInterval, '[h]:mm:ss');
AddFormat(47, nfFmtDateTime, 'mm:ss.z'); // z will be replace by 0 later
AddFormat(45, nfFmtDateTime, 'nn:ss');
AddFormat(46, nfTimeInterval, '[h]:nn:ss');
AddFormat(47, nfFmtDateTime, 'nn:ss.z'); // z will be replace by 0 later
AddFormat(48, nfSci, '##0.0E+0', 1);
// 49 ("Text") not supported
@ -594,6 +570,51 @@ begin
FNextFormatIndex := 164;
end;
{ Considers some Excel specialities for format detection.
The output values will be passed to fpc. }
procedure TsBIFFNumFormatList.Analyze(AFormatIndex: Integer;
var AFormatString: String; var ANumFormat: TsNumberFormat;
var ADecimals: Word);
var
fmt: String;
begin
fmt := Lowercase(AFormatString);
{ Check the built-in formats first }
if (pos('[$-F400]', AFormatString) = 1) then begin
ANumFormat := nfLongTime;
AFormatString := ''; // will be replaced by system's format setting
ADecimals := 0;
exit;
end;
if (pos('[$', fmt) = 1) then begin
if (pos('h:mm:ss\', fmt) > 0) then begin
// long time format
if (pos('am/pm', fmt) > 0) or (pos('a/p',fmt) > 0) then begin
ANumFormat := nfLongTimeAM;
AFormatString := '';
end else begin
ANumFormat := nfLongTime;
AFormatString := '';
end;
ADecimals := 0;
exit;
end;
if (pos('h:mm\', fmt) > 0) then begin
if (pos('am/pm', fmt) > 0) or (pos ('a/p', fmt) > 0) then begin
ANumFormat := nfShortTimeAM;
AFormatString := '';
end else begin
ANumFormat := nfShortTime;
AFormatString := '';
end;
end;
ADecimals := 0;
exit;
end;
inherited Analyze(AFormatIndex, AFormatString, ANumFormat, ADecimals);
end;
{ Creates formatting strings that are written into the file. }
function TsBIFFNumFormatList.FormatStringForWriting(AIndex: Integer): String;
var
@ -606,8 +627,12 @@ begin
nfFmtDateTime:
begin
Result := lowercase(item.FormatString);
for i:=1 to Length(Result) do
for i:=1 to Length(Result) do begin
// The milliseccond format contains the symbol "z" in fpc, but Excel wants "0"
if Result[i] in ['z', 'Z'] then Result[i] := '0';
// The minutes in short time formats are coded by "n" in fpc, but Excel wants "m".
if Result[i] in ['n', 'N'] then Result[i] := 'm';
end;
end;
nfTimeInterval:
// Time interval format string could still be without square brackets

View File

@ -41,6 +41,20 @@ uses
type
{ TsOOXMLFormatList }
TsOOXMLNumFormatList = class(TsCustomNumFormatList)
protected
{
procedure AddBuiltinFormats; override;
procedure Analyze(AFormatIndex: Integer; var AFormatString: String;
var ANumFormat: TsNumberFormat; var ADecimals: Word); override;
}
public
{
function FormatStringForWriting(AIndex: Integer): String; override;
}
end;
{ TsSpreadOOXMLWriter }
TsSpreadOOXMLWriter = class(TsCustomSpreadWriter)
@ -52,22 +66,30 @@ type
FWorkbookString, FWorkbookRelsString, FStylesString, FSharedStrings: string;
FSheets: array of string;
FSharedStringsCount: Integer;
protected
{ Helper routines }
procedure CreateNumFormatList; override;
protected
{ Streams with the contents of files }
FSContentTypes: TStringStream;
FSRelsRels: TStringStream;
FSWorkbook, FSWorkbookRels, FSStyles, FSSharedStrings: TStringStream;
FSSheets: array of TStringStream;
FCurSheetNum: Integer;
protected
{ Routines to write those files }
procedure WriteGlobalFiles;
procedure WriteContent;
procedure WriteWorksheet(CurSheet: TsWorksheet);
function GetStyleIndex(ACell: PCell): Cardinal;
protected
{ Record writing methods }
//todo: add WriteDate
procedure WriteLabel(AStream: TStream; const ARow, ACol: Cardinal; const AValue: string; ACell: PCell); override;
procedure WriteNumber(AStream: TStream; const ARow, ACol: Cardinal; const AValue: double; ACell: PCell); override;
procedure WriteDateTime(AStream: TStream; const ARow, ACol: Cardinal; const AValue: TDateTime; ACell: PCell); override;
public
constructor Create(AWorkbook: TsWorkbook); override;
destructor Destroy; override;
@ -114,6 +136,7 @@ const
MIME_STYLES = MIME_SPREADML + '.styles+xml';
MIME_STRINGS = MIME_SPREADML + '.sharedStrings+xml';
{ TsSpreadOOXMLWriter }
procedure TsSpreadOOXMLWriter.WriteGlobalFiles;
@ -367,6 +390,12 @@ begin
inherited Destroy;
end;
procedure TsSpreadOOXMLWriter.CreateNumFormatList;
begin
FreeAndNil(FNumFormatList);
FNumFormatList := TsOOXMLNumFormatList.Create;
end;
{
Writes a string to a file. Helper convenience method.
}