diff --git a/components/fpspreadsheet/examples/excel5demo/excel5read.lpi b/components/fpspreadsheet/examples/excel5demo/excel5read.lpi index 8051e80a7..81822828c 100644 --- a/components/fpspreadsheet/examples/excel5demo/excel5read.lpi +++ b/components/fpspreadsheet/examples/excel5demo/excel5read.lpi @@ -11,7 +11,7 @@ <UseAppBundle Value="False"/> - <ActiveEditorIndexAtStart Value="0"/> + <ActiveEditorIndexAtStart Value="3"/> </General> <VersionInfo> <ProjectVersion Value=""/> @@ -33,7 +33,7 @@ <PackageName Value="laz_fpspreadsheet"/> </Item1> </RequiredPackages> - <Units Count="15"> + <Units Count="16"> <Unit0> <Filename Value="excel5read.lpr"/> <IsPartOfProject Value="True"/> @@ -68,8 +68,8 @@ <Unit4> <Filename Value="..\..\xlsbiff5.pas"/> <UnitName Value="xlsbiff5"/> - <CursorPos X="19" Y="920"/> - <TopLine Value="903"/> + <CursorPos X="22" Y="1064"/> + <TopLine Value="1045"/> <EditorIndex Value="3"/> <UsageCount Value="140"/> <Loaded Value="True"/> @@ -86,9 +86,9 @@ <Unit6> <Filename Value="..\..\xlsbiff2.pas"/> <UnitName Value="xlsbiff2"/> - <CursorPos X="1" Y="365"/> - <TopLine Value="363"/> - <EditorIndex Value="4"/> + <CursorPos X="1" Y="387"/> + <TopLine Value="367"/> + <EditorIndex Value="5"/> <UsageCount Value="139"/> <Loaded Value="True"/> </Unit6> @@ -97,7 +97,7 @@ <UnitName Value="fpolestorage"/> <CursorPos X="78" Y="806"/> <TopLine Value="792"/> - <EditorIndex Value="5"/> + <EditorIndex Value="6"/> <UsageCount Value="139"/> <Loaded Value="True"/> </Unit7> @@ -119,7 +119,7 @@ <CursorPos X="5" Y="181"/> <TopLine Value="171"/> <EditorIndex Value="1"/> - <UsageCount Value="94"/> + <UsageCount Value="95"/> <Loaded Value="True"/> </Unit10> <Unit11> @@ -148,124 +148,137 @@ <TopLine Value="1508"/> <UsageCount Value="10"/> </Unit14> + <Unit15> + <Filename Value="..\..\xlsbiff8.pas"/> + <UnitName Value="xlsbiff8"/> + <CursorPos X="3" Y="334"/> + <TopLine Value="325"/> + <EditorIndex Value="4"/> + <UsageCount Value="11"/> + <Loaded Value="True"/> + </Unit15> </Units> - <JumpHistory Count="29" HistoryIndex="28"> + <JumpHistory Count="30" HistoryIndex="29"> <Position1> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="895" Column="1" TopLine="885"/> + <Caret Line="910" Column="1" TopLine="900"/> </Position1> <Position2> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="908" Column="1" TopLine="898"/> + <Caret Line="913" Column="1" TopLine="903"/> </Position2> <Position3> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="910" Column="1" TopLine="900"/> + <Caret Line="911" Column="1" TopLine="900"/> </Position3> <Position4> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="913" Column="1" TopLine="903"/> + <Caret Line="912" Column="1" TopLine="902"/> </Position4> <Position5> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="911" Column="1" TopLine="900"/> + <Caret Line="915" Column="1" TopLine="905"/> </Position5> <Position6> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="912" Column="1" TopLine="902"/> + <Caret Line="918" Column="1" TopLine="908"/> </Position6> <Position7> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="915" Column="1" TopLine="905"/> + <Caret Line="919" Column="1" TopLine="909"/> </Position7> <Position8> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="918" Column="1" TopLine="908"/> + <Caret Line="921" Column="1" TopLine="911"/> </Position8> <Position9> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="919" Column="1" TopLine="909"/> + <Caret Line="923" Column="1" TopLine="913"/> </Position9> <Position10> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="921" Column="1" TopLine="911"/> + <Caret Line="918" Column="1" TopLine="908"/> </Position10> <Position11> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="923" Column="1" TopLine="913"/> + <Caret Line="921" Column="1" TopLine="911"/> </Position11> <Position12> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="918" Column="1" TopLine="908"/> + <Caret Line="924" Column="1" TopLine="914"/> </Position12> <Position13> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="921" Column="1" TopLine="911"/> + <Caret Line="926" Column="1" TopLine="916"/> </Position13> <Position14> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="924" Column="1" TopLine="914"/> + <Caret Line="918" Column="1" TopLine="910"/> </Position14> <Position15> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="926" Column="1" TopLine="916"/> + <Caret Line="886" Column="1" TopLine="867"/> </Position15> <Position16> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="918" Column="1" TopLine="910"/> + <Caret Line="889" Column="1" TopLine="876"/> </Position16> <Position17> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="886" Column="1" TopLine="867"/> + <Caret Line="68" Column="24" TopLine="58"/> </Position17> <Position18> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="889" Column="1" TopLine="876"/> + <Caret Line="887" Column="1" TopLine="882"/> </Position18> <Position19> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="68" Column="24" TopLine="58"/> + <Caret Line="64" Column="37" TopLine="55"/> </Position19> <Position20> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="887" Column="1" TopLine="882"/> + <Caret Line="934" Column="5" TopLine="915"/> </Position20> <Position21> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="64" Column="37" TopLine="55"/> + <Caret Line="941" Column="23" TopLine="925"/> </Position21> <Position22> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="934" Column="5" TopLine="915"/> + <Caret Line="72" Column="25" TopLine="62"/> </Position22> <Position23> - <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="941" Column="23" TopLine="925"/> + <Filename Value="..\..\fpspreadsheet.pas"/> + <Caret Line="499" Column="45" TopLine="486"/> </Position23> <Position24> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="72" Column="25" TopLine="62"/> + <Caret Line="948" Column="1" TopLine="946"/> </Position24> <Position25> - <Filename Value="..\..\fpspreadsheet.pas"/> - <Caret Line="499" Column="45" TopLine="486"/> + <Filename Value="..\..\xlsbiff5.pas"/> + <Caret Line="994" Column="12" TopLine="981"/> </Position25> <Position26> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="948" Column="1" TopLine="946"/> + <Caret Line="891" Column="1" TopLine="872"/> </Position26> <Position27> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="994" Column="12" TopLine="981"/> + <Caret Line="70" Column="15" TopLine="60"/> </Position27> <Position28> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="891" Column="1" TopLine="872"/> + <Caret Line="1063" Column="1" TopLine="1050"/> </Position28> <Position29> <Filename Value="..\..\xlsbiff5.pas"/> - <Caret Line="70" Column="15" TopLine="60"/> + <Caret Line="1064" Column="1" TopLine="1051"/> </Position29> + <Position30> + <Filename Value="..\..\xlsbiff5.pas"/> + <Caret Line="1065" Column="1" TopLine="1052"/> + </Position30> </JumpHistory> </ProjectOptions> <CompilerOptions> diff --git a/components/fpspreadsheet/examples/excel5demo/excel5write.lpi b/components/fpspreadsheet/examples/excel5demo/excel5write.lpi index 8a3733403..eb6ea9847 100644 --- a/components/fpspreadsheet/examples/excel5demo/excel5write.lpi +++ b/components/fpspreadsheet/examples/excel5demo/excel5write.lpi @@ -11,7 +11,7 @@ <TargetFileExt Value=".exe"/> <Title Value="excel5write"/> <UseAppBundle Value="False"/> - <ActiveEditorIndexAtStart Value="0"/> + <ActiveEditorIndexAtStart Value="3"/> </General> <VersionInfo> <ProjectVersion Value=""/> @@ -38,8 +38,8 @@ <Filename Value="excel5write.lpr"/> <IsPartOfProject Value="True"/> <UnitName Value="excel5write"/> - <CursorPos X="1" Y="8"/> - <TopLine Value="1"/> + <CursorPos X="36" Y="32"/> + <TopLine Value="26"/> <EditorIndex Value="0"/> <UsageCount Value="309"/> <Loaded Value="True"/> @@ -68,8 +68,8 @@ <Unit4> <Filename Value="..\..\xlsbiff5.pas"/> <UnitName Value="xlsbiff5"/> - <CursorPos X="33" Y="539"/> - <TopLine Value="526"/> + <CursorPos X="1" Y="1063"/> + <TopLine Value="1047"/> <EditorIndex Value="3"/> <UsageCount Value="140"/> <Loaded Value="True"/> diff --git a/components/fpspreadsheet/reference/excelfileformat.pdf b/components/fpspreadsheet/reference/excelfileformat.pdf new file mode 100644 index 000000000..84c1a4ed6 Binary files /dev/null and b/components/fpspreadsheet/reference/excelfileformat.pdf differ diff --git a/components/fpspreadsheet/xlsbiff5.pas b/components/fpspreadsheet/xlsbiff5.pas index fa78cecd2..f7df36bec 100755 --- a/components/fpspreadsheet/xlsbiff5.pas +++ b/components/fpspreadsheet/xlsbiff5.pas @@ -1045,8 +1045,27 @@ begin end; procedure TsSpreadBIFF5Reader.ReadLabel(AStream: TStream); +var + L: Word; + ARow, ACol: Word; + AValue: array[0..255] of Char; + AStrValue: ansistring; begin + { BIFF Record data } + ARow := WordLEToN(AStream.ReadWord); + ACol := WordLEToN(AStream.ReadWord); + { Index to XF record } + AStream.ReadWord(); + + { Byte String with 16-bit size } + L := AStream.ReadWord(); + AStream.ReadBuffer(AValue, L); + AValue[L] := #0; + AStrValue := AValue; + + { Save the data } + FWorksheet.WriteUTF8Text(ARow, ACol, AnsiToUTF8(AStrValue)); end; procedure TsSpreadBIFF5Reader.ReadNumber(AStream: TStream); diff --git a/components/fpspreadsheet/xlsbiff8.pas b/components/fpspreadsheet/xlsbiff8.pas index ce58f100e..9a16620c7 100755 --- a/components/fpspreadsheet/xlsbiff8.pas +++ b/components/fpspreadsheet/xlsbiff8.pas @@ -1,7 +1,7 @@ { -xlsbiff5.pas +xlsbiff8.pas -Writes an Excel 5 file +Writes an Excel 8 file An Excel worksheet stream consists of a number of subsequent records. To ensure a properly formed file, the following order must be respected: @@ -10,7 +10,7 @@ To ensure a properly formed file, the following order must be respected: 2nd to Nth record: Any record Last record: EOF -Excel 5 files are OLE compound document files, and must be written using the +Excel 8 files are OLE compound document files, and must be written using the fpOLE library. Records Needed to Make a BIFF5 File Microsoft Excel Can Use: