fpspreadsheet: Fix compilation issues when fpc version is changed: separate package units into different folders, incorporate code of fpsnumformatparser in unit fpsnumformat and code of fpsregfileformats in units fpsreaderwriter. Check and fix all demos.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5282 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-10-22 20:59:00 +00:00
parent 253b399787
commit 3e6dd484f7
107 changed files with 2336 additions and 3711 deletions

View File

@ -13,9 +13,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -57,7 +54,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common;..\..\source\export"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -56,7 +53,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
</CompilerOptions> </CompilerOptions>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -41,12 +38,10 @@
<Unit0> <Unit0>
<Filename Value="demo_formula_func.pas"/> <Filename Value="demo_formula_func.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="demo_formula_func"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="financemath.pas"/> <Filename Value="financemath.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="financemath"/>
</Unit1> </Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@ -58,7 +53,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -51,7 +48,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -36,15 +33,11 @@
<PackageName Value="LazUtils"/> <PackageName Value="LazUtils"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="1">
<Unit0> <Unit0>
<Filename Value="demo_sorting.pas"/> <Filename Value="demo_sorting.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
</Unit0> </Unit0>
<Unit1>
<Filename Value="..\..\fpsexprparser.pas"/>
<IsPartOfProject Value="True"/>
</Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
@ -55,7 +48,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
</CompilerOptions> </CompilerOptions>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -51,7 +48,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -51,7 +48,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -51,7 +48,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
</CompilerOptions> </CompilerOptions>

View File

@ -17,9 +17,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -42,7 +39,6 @@
<Unit0> <Unit0>
<Filename Value="demo_write_formatting.pas"/> <Filename Value="demo_write_formatting.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="demo_write_formatting"/>
</Unit0> </Unit0>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@ -54,7 +50,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -16,9 +16,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="2"> <BuildModes Count="2">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Debug" Default="True"/>
<Item2 Name="Release"> <Item2 Name="Release">
@ -65,7 +62,6 @@
<Unit0> <Unit0>
<Filename Value="demo_write_formula.pas"/> <Filename Value="demo_write_formula.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="demo_write_formula"/>
</Unit0> </Unit0>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@ -76,7 +72,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="../.."/> <OtherUnitFiles Value="../../source/common"/>
<UnitOutputDirectory Value="../lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="../lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="demo_write_headerfooter_images"/> <Title Value="demo_write_headerfooter_images"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="demo_write_headerfooter_images"/> <Filename Value="demo_write_headerfooter_images"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="demo_write_images"/> <Title Value="demo_write_images"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="demo_write_images"/> <Filename Value="demo_write_images"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="csvread"/> <Title Value="csvread"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="csvread"/> <Filename Value="csvread"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="csvwrite"/> <Title Value="csvwrite"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -53,7 +50,7 @@
<Filename Value="csvwrite"/> <Filename Value="csvwrite"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking> <Linking>

View File

@ -12,9 +12,6 @@
<Title Value="excel2read"/> <Title Value="excel2read"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="excel2read"/> <Filename Value="excel2read"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="excel2write"/> <Title Value="excel2write"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="excel2write"/> <Filename Value="excel2write"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="excel5read"/> <Title Value="excel5read"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="excel5read"/> <Filename Value="excel5read"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="excel5write"/> <Title Value="excel5write"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="excel5write"/> <Filename Value="excel5write"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -11,9 +11,6 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="excel8write"/> <Title Value="excel8write"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -53,7 +50,7 @@
<Filename Value="excel8write"/> <Filename Value="excel8write"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking> <Linking>

View File

@ -12,9 +12,6 @@
<Title Value="excelxmlwrite"/> <Title Value="excelxmlwrite"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="excelxmlwrite"/> <Filename Value="excelxmlwrite"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking> <Linking>

View File

@ -12,9 +12,6 @@
<Title Value="htmlread"/> <Title Value="htmlread"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="htmlread"/> <Filename Value="htmlread"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="htmlread_http"/> <Title Value="htmlread_http"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="htmlread_http"/> <Filename Value="htmlread_http"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="htmlwrite"/> <Title Value="htmlwrite"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="htmlwrite"/> <Filename Value="htmlwrite"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="ooxmlread"/> <Title Value="ooxmlread"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="ooxmlread"/> <Filename Value="ooxmlread"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="ooxmlwrite"/> <Title Value="ooxmlwrite"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="ooxmlwrite"/> <Filename Value="ooxmlwrite"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="opendocread"/> <Title Value="opendocread"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="opendocread"/> <Filename Value="opendocread"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="opendocwrite"/> <Title Value="opendocwrite"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="opendocwrite"/> <Filename Value="opendocwrite"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -11,9 +11,6 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -12,9 +12,6 @@
<Title Value="wikitablewrite"/> <Title Value="wikitablewrite"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -49,7 +46,7 @@
<Filename Value="wikitablewrite"/> <Filename Value="wikitablewrite"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -22,7 +22,6 @@
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\shared"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <CodeGeneration>
<SmartLinkUnit Value="True"/> <SmartLinkUnit Value="True"/>
@ -57,7 +56,7 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item2> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="9"> <Units Count="2">
<Unit0> <Unit0>
<Filename Value="demo_ctrls.lpr"/> <Filename Value="demo_ctrls.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -69,59 +68,6 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
</Unit1> </Unit1>
<Unit2>
<Filename Value="..\shared\scsvparamsform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CSVParamsForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="sCSVParamsForm"/>
</Unit2>
<Unit3>
<Filename Value="..\shared\sformatsettingsform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="FormatSettingsForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="sFormatsettingsForm"/>
</Unit3>
<Unit4>
<Filename Value="..\shared\ssortparamsform.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
<UnitName Value="sSortParamsForm"/>
</Unit4>
<Unit5>
<Filename Value="..\shared\scurrencyform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CurrencyForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit5>
<Unit6>
<Filename Value="..\shared\shyperlinkform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="HyperlinkForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="sHyperlinkForm"/>
</Unit6>
<Unit7>
<Filename Value="..\shared\snumformatform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="NumFormatForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="sNumFormatForm"/>
</Unit7>
<Unit8>
<Filename Value="..\shared\ssearchform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="SearchForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="sSearchForm"/>
</Unit8>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
@ -132,7 +78,6 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\shared"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <CodeGeneration>

View File

@ -7,7 +7,7 @@ uses
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, main, sHyperlinkForm, sNumFormatForm, sSearchForm; Forms, main;
{$R *.res} {$R *.res}

View File

@ -14,9 +14,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@ -55,7 +52,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common;..\..\..\source\visual"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Linking> <Linking>

View File

@ -48,7 +48,7 @@ implementation
uses uses
fpcanvas, lazutf8, fpcanvas, lazutf8,
fpstypes, fpsutils, fpsRegFileFormats, fpspreadsheet; fpstypes, fpsutils, fpsReaderWriter, fpspreadsheet;
{ TForm1 } { TForm1 }

View File

@ -14,9 +14,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="2"> <BuildModes Count="2">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Debug" Default="True"/>
<Item2 Name="Release"> <Item2 Name="Release">
@ -78,7 +75,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common;..\..\..\source\visual"/>
<UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="..\..\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <CodeGeneration>

View File

@ -53,7 +53,7 @@ implementation
{$R *.lfm} {$R *.lfm}
uses uses
fpsUtils, fpsRegFileFormats; fpsUtils, fpsReaderWriter;
{ TForm1 } { TForm1 }

View File

@ -12,7 +12,6 @@
<VersionInfo> <VersionInfo>
<Language Value=""/> <Language Value=""/>
<CharSet Value=""/> <CharSet Value=""/>
<StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="3"> <BuildModes Count="3">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
@ -126,7 +125,7 @@
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\..\.."/> <OtherUnitFiles Value="..\..\..\source\common;..\..\..\source\visual"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>

View File

@ -218,7 +218,7 @@ implementation
uses uses
TypInfo, LazUtf8, LCLIntf, LCLType, LCLVersion, clipbrd, fpcanvas, TypInfo, LazUtf8, LCLIntf, LCLType, LCLVersion, clipbrd, fpcanvas,
SynHighlighterWikiTable, SynHighlighterWikiTable,
fpsutils, fpsRegFileFormats; fpsutils, fpsReaderWriter;
const const
DROPDOWN_COUNT = 24; DROPDOWN_COUNT = 24;

View File

@ -48,7 +48,7 @@ implementation
{$R *.lfm} {$R *.lfm}
uses uses
fpsRegFileFormats; fpsReaderWriter;
const const
MOUSEWHEEL_FACTOR = 1.05; MOUSEWHEEL_FACTOR = 1.05;

File diff suppressed because it is too large Load Diff

View File

@ -1,572 +0,0 @@
{@@ ----------------------------------------------------------------------------
Unit fpsRegFileFormats implements registration of the file formats supported
by fpspreadsheet.
AUTHORS: Felipe Monteiro de Carvalho, Reinier Olislagers, Werner Pamler
LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus
distribution, for details about the license.
USAGE: Each unit implementing a new spreadsheet format must register the
reader/writer and some specific data by calling "RegisterSpreadFormat".
-------------------------------------------------------------------------------}
unit fpsRegFileFormats;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpstypes, fpsReaderWriter; //fpspreadsheet;
type
TsSpreadFileAccess = (faRead, faWrite);
function RegisterSpreadFormat(
AFormat: TsSpreadsheetFormat;
AReaderClass: TsSpreadReaderClass;
AWriterClass: TsSpreadWriterClass;
AFormatName, ATechnicalName: String;
const AFileExtensions: array of String): TsSpreadFormatID;
function GetFileFormatFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
function GetSpreadFormats(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
function GetSpreadFormatsFromFileName(AFileAccess: TsSpreadFileAccess; AFileName: TFileName;
APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
function GetSpreadFormatExt(AFormatID: TsSpreadFormatID): String;
function GetSpreadFormatName(AFormatID: TsSpreadFormatID): String;
function GetSpreadTechnicalName(AFormatID: TsSpreadFormatID): String;
function GetSpreadReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
function GetSpreadWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
implementation
uses
fpsStrings;
type
TsSpreadFormatData = class
private
FFormatID: TsSpreadFormatID; // Format identifier
FName: String; // Text to be used in FileDialog filter
FTechnicalName: String; // Text to be used e.g. in Titlebar
FFileExtensions: array of String; // File extensions used by this format
FReaderClass: TsSpreadReaderClass; // Class for reading these files
FWriterClass: TsSpreadWriterClass; // Class for writing these files
function GetFileExtension(AIndex: Integer): String;
function GetFileExtensionCount: Integer;
public
constructor Create(AFormatID: TsSpreadFormatID; AReaderClass: TsSpreadReaderClass;
AWriterClass: TsSpreadWriterClass; AFormatName, ATechnicalName: String;
const AExtensions: Array of String);
// ACanReadFromClipboard, ACanWriteToClipboard: Boolean);
function GetFileFilterMask(ASeparator: Char): String;
// property CanReadFromClipboard: boolean read FCanReadClipboard;
// property CanWriteToClipboard: boolean read FCanWriteClipboard;
property FormatID: TsSpreadFormatID read FFormatID;
property FormatName: String read FName;
property FileExtension[AIndex: Integer]: String read GetFileExtension;
property FileExtensionCount: Integer read GetFileExtensionCount;
property ReaderClass: TsSpreadReaderClass read FReaderClass;
property TechnicalName: String read FTechnicalName;
property WriterClass: TsSpreadWriterClass read FWriterClass;
end;
{ TsSpreadFormatRegistry }
TsSpreadFormatRegistry = class
private
FList: TFPList;
FCachedData: TsSpreadFormatData;
FCachedFormatID: TsSpreadFormatID;
function GetDefaultExt(AFormatID: TsSpreadFormatID): String;
function GetFormatName(AFormatID: TsSpreadFormatID): String;
function GetReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
function GetTechnicalName(AFormatID: TsSpreadFormatID): String;
function GetWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
protected
function Add(AData: TsSpreadFormatData): Integer;
function FindFormatID(AFormatID: TsSpreadFormatID): TsSpreadFormatData;
function IndexOf(AFormatID: TsSpreadFormatID): Integer;
public
constructor Create;
destructor Destroy; override;
function GetAllSpreadFilesMask(AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess): String;
function GetAllExcelFilesMask(AExtSeparator: Char): String;
function GetFileFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
function GetFormatArray(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
function GetFormatArrayFromFileName(AFileAccess: TsSpreadFileAccess;
const AFileName: String; APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
property DefaultExt[AFormatID: TsSpreadFormatID]: String read GetDefaultExt;
property FormatName[AFormatID: TsSpreadFormatID]: String read GetFormatName;
property ReaderClass[AFormatID: TsSpreadFormatID]: TsSpreadReaderClass read GetReaderClass;
property TechnicalName[AFormatID: TsSpreadFormatID]: String read GetTechnicalName;
property WriterClass[AFormatID: TsSpreadFormatID]: TsSpreadWriterClass read GetWriterClass;
end;
var
SpreadFormatRegistry: TsSpreadFormatRegistry;
{==============================================================================}
{ TsSpreadFormatData }
{==============================================================================}
constructor TsSpreadFormatData.Create(AFormatID: TsSpreadFormatID;
AReaderClass: TsSpreadReaderClass; AWriterClass: TsSpreadWriterClass;
AFormatName, ATechnicalName: String; const AExtensions: array of String);
var
i: Integer;
begin
FFormatID := AFormatID;
FReaderClass := AReaderClass;
FWriterClass := AWriterClass;
FName := AFormatName;
FTechnicalName := ATechnicalName;
SetLength(FFileExtensions, Length(AExtensions));
for i:=0 to High(FFileExtensions) do FFileExtensions[i] := AExtensions[i];
end;
function TsSpreadFormatData.GetFileExtension(AIndex: Integer): String;
begin
Result := FFileExtensions[AIndex];
end;
function TsSpreadFormatData.GetFileExtensionCount: Integer;
begin
Result := Length(FFileExtensions);
end;
function TsSpreadFormatData.GetFileFilterMask(ASeparator: Char): String;
var
i: Integer;
begin
Result := '*' + FFileExtensions[0];
for i:= 1 to High(FFileExtensions) do
Result := Result + ASeparator + '*' + FFileExtensions[i];
end;
{==============================================================================}
{ TsSpreadFormatRegistry }
{==============================================================================}
constructor TsSpreadFormatRegistry.Create;
begin
inherited;
FList := TFPList.Create;
FCachedFormatID := sfidUnknown;
FCachedData := nil;
end;
destructor TsSpreadFormatRegistry.Destroy;
var
i: Integer;
begin
for i := FList.Count-1 downto 0 do TObject(FList[i]).Free;
FList.Free;
inherited;
end;
function TsSpreadFormatRegistry.Add(AData: TsSpreadFormatData): Integer;
begin
Result := FList.Add(AData);
end;
function TsSpreadFormatRegistry.FindFormatID(AFormatID: TsSpreadFormatID): TsSpreadFormatData;
var
idx: Integer;
begin
if AFormatID <> FCachedFormatID then
begin
idx := IndexOf(AFormatID);
if idx = -1 then
begin
FCachedData := nil;
FCachedFormatID := sfidUnknown;
end else
begin
FCachedData := TsSpreadFormatData(FList[idx]);
FCachedFormatID := AFormatID;
end;
end;
Result := FCachedData;
end;
function TsSpreadFormatRegistry.GetDefaultExt(AFormatID: TsSpreadFormatID): String;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.FileExtension[0] else
Result := '';
end;
function TsSpreadFormatRegistry.GetAllSpreadFilesMask(AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess): String;
var
L: TStrings;
data: TsSpreadFormatData;
ext: String;
i, j: Integer;
begin
Result := '';
L := TStringList.Create;
try
for i:=0 to FList.Count-1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then continue;
faWrite : if data.WriterClass = nil then continue;
end;
for j:=0 to data.FileExtensionCount-1 do
begin
ext := data.FileExtension[j];
if L.IndexOf(ext) = -1 then
L.Add(ext);
end;
end;
if L.Count > 0 then
begin
Result := '*' + L[0];
for i := 1 to L.Count-1 do
Result := Result + AExtSeparator + '*' + L[i];
end;
finally
L.Free;
end;
end;
function TsSpreadFormatRegistry.GetAllExcelFilesMask(AExtSeparator: Char): String;
var
j: Integer;
L: TStrings;
data: TsSpreadFormatData;
ext: String;
begin
L := TStringList.Create;
try
// good old BIFF...
if (IndexOf(ord(sfExcel8)) <> -1) or
(IndexOf(ord(sfExcel5)) <> -1) or
(IndexOf(ord(sfExcel2)) <> -1) then L.Add('*.xls');
// Excel 2007+
j := IndexOf(ord(sfOOXML));
if j <> -1 then
begin
data := TsSpreadFormatData(FList[j]);
for j:=0 to data.FileExtensionCount-1 do
begin
ext := data.FileExtension[j];
if L.IndexOf(ext) = -1 then
L.Add('*' + ext);
end;
end;
L.Delimiter := AExtSeparator;
L.StrictDelimiter := true;
Result := L.DelimitedText;
finally
L.Free;
end;
end;
function TsSpreadFormatRegistry.GetFileFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
var
i, idx: Integer;
L: TStrings;
s: String;
data: TsSpreadFormatData;
begin
// Bring the formats listed in APriorityFormats to the top
if Length(APriorityFormats) > 0 then
for i := High(APriorityFormats) downto Low(APriorityFormats) do
begin
idx := IndexOf(APriorityFormats[i]);
data := TsSpreadFormatData(FList[idx]);
FList.Delete(idx);
FList.Insert(0, data);
end;
L := TStringList.Create;
try
L.Delimiter := AListSeparator;
L.StrictDelimiter := true;
if AllSpreadFormats then
begin
s := GetAllSpreadFilesMask(AExtSeparator, AFileAccess);
if s <> '' then
begin
L.Add(rsAllSpreadsheetFiles);
L.Add(GetAllSpreadFilesMask(AExtSeparator, AFileAccess));
end;
end;
if AllExcelFormats then
begin
s := GetAllExcelFilesMask(AExtSeparator);
if s <> '' then
begin
L.Add(Format('%s (%s)', [rsAllExcelFiles, s]));
L.Add(s);
end;
end;
for i:=0 to FList.Count-1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then Continue;
faWrite : if data.WriterClass = nil then Continue;
end;
s := data.GetFileFilterMask(AExtSeparator);
L.Add(Format('%s %s (%s)', [data.FormatName, rsFiles, s]));
L.Add(s);
end;
Result := L.DelimitedText;
finally
L.Free;
end;
end;
function TsSpreadFormatRegistry.GetFormatArray(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
var
i, n, idx: Integer;
data: TsSpreadFormatData;
begin
// Rearrange the formats such the one noted in APriorityFormats are at the top
if Length(APriorityFormats) > 0 then
for i := High(APriorityFormats) downto Low(APriorityFormats) do
begin
idx := IndexOf(APriorityFormats[i]);
data := TsSpreadFormatData(FList[idx]);
FList.Delete(idx);
FList.Insert(0, data);
end;
SetLength(Result, FList.Count);
n := 0;
for i := 0 to FList.Count-1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then Continue;
faWrite : if data.WriterClass = nil then Continue;
end;
Result[n] := data.FormatID;
inc(n);
end;
SetLength(Result, n);
end;
function TsSpreadFormatRegistry.GetFormatArrayFromFileName(
AFileAccess: TsSpreadFileAccess; const AFileName: String;
APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
var
idx: Integer;
i, j, n: Integer;
ext: String;
data: TsSpreadFormatData;
begin
ext := Lowercase(ExtractFileExt(AFileName));
if APriorityFormat <> sfidUnknown then
begin
// Bring the priority format to the top
idx := IndexOf(APriorityFormat);
FList.Exchange(0, idx);
end;
SetLength(Result, FList.Count);
n := 0;
for i := 0 to FList.Count - 1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then Continue;
faWrite : if data.WriterClass = nil then Continue;
end;
for j:=0 to data.FileExtensionCount-1 do
if Lowercase(data.FileExtension[j]) = ext then
begin
Result[n] := data.FormatID;
inc(n);
end;
end;
SetLength(Result, n);
if APriorityFormat <> sfidUnknown then
// Restore original order
FList.Exchange(idx, 0);
end;
function TsSpreadFormatRegistry.GetFormatName(AFormatID: TsSpreadFormatID): String;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.FormatName else
Result := '';
end;
function TsSpreadFormatRegistry.GetReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.ReaderClass else
Result := nil;
end;
function TsSpreadFormatRegistry.GetTechnicalName(AFormatID: TsSpreadFormatID): String;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.TechnicalName else
Result := '';
end;
function TsSpreadFormatRegistry.GetWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.WriterClass else
Result := nil;
end;
function TsSpreadFormatRegistry.IndexOf(AFormatID: TsSpreadFormatID): Integer;
begin
for Result := 0 to FList.Count - 1 do
if TsSpreadFormatData(FList[Result]).FormatID = AFormatID then
exit;
Result := -1;
end;
{==============================================================================}
{ Public utility functions }
{==============================================================================}
{@@ ----------------------------------------------------------------------------
Registers a new reader/writer pair for a given spreadsheet file format
AFormat identifies the file format, see sfXXXX declarations in built-in
fpstypes.
The system is open to user-defined formats. In this case, AFormat must have
the value "sfUser". The format identifier is calculated as a negative number,
stored in the TsSpreadFormatData class and returned as function result.
This value is needed when calling fpspreadsheet's ReadFromXXXX and WriteToXXXX
methods to specify the file format.
-------------------------------------------------------------------------------}
function RegisterSpreadFormat(AFormat: TsSpreadsheetFormat;
AReaderClass: TsSpreadReaderClass; AWriterClass: TsSpreadWriterClass;
AFormatName, ATechnicalName: String; const AFileExtensions: array of String): TsSpreadFormatID;
var
fmt: TsSpreadFormatData;
n: Integer;
begin
if AFormat <> sfUser then begin
n := SpreadFormatRegistry.IndexOf(ord(AFormat));
if n >= 0 then
raise Exception.Create('[RegisterSpreadFormat] Spreadsheet format is already registered.');
end;
if Length(AFileExtensions) = 0 then
raise Exception.Create('[RegisterSpreadFormat] File extensions needed for registering a file format.');
if (AFormatName = '') or (ATechnicalName = '') then
raise Exception.Create('[RegisterSpreadFormat] File format name is not specified.');
fmt := TsSpreadFormatData.Create(ord(AFormat), AReaderClass, AWriterClass,
AFormatName, ATechnicalName, AFileExtensions);
n := SpreadFormatRegistry.Add(fmt);
if (AFormat = sfUser) then
begin
if (n <= ord(sfUser)) then n := n + ord(sfUser) + 1;
fmt.FFormatID := -n;
end;
Result := fmt.FormatID;
end;
function GetFileFormatFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
begin
Result := SpreadFormatRegistry.GetFileFilter(AListSeparator, AExtSeparator,
AFileAccess, APriorityFormats, AllSpreadFormats, AllExcelFormats);
end;
function GetSpreadFormats(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
begin
Result := SpreadFormatRegistry.GetFormatArray(AFileAccess, APriorityFormats);
end;
function GetSpreadFormatsFromFileName(
AFileAccess: TsSpreadFileAccess; AFileName: TFileName;
APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
begin
Result := SpreadFormatRegistry.GetFormatArrayFromFileName(
AFileAccess, AFileName, APriorityFormat);
end;
function GetSpreadFormatExt(AFormatID: TsSpreadFormatID): String;
begin
Result := SpreadFormatRegistry.DefaultExt[AFormatID];
end;
function GetSpreadFormatName(AFormatID: TsSpreadFormatID): String;
begin
Result := SpreadFormatRegistry.FormatName[AFormatID];
end;
function GetSpreadTechnicalName(AFormatID: TsSpreadFormatID): String;
begin
Result := SpreadFormatRegistry.TechnicalName[AFormatID];
end;
function GetSpreadReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
begin
Result := SpreadFormatRegistry.ReaderClass[AFormatID];
end;
function GetSpreadWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
begin
Result := SpreadFormatRegistry.WriterClass[AFormatID];
end;
initialization
SpreadFormatRegistry := TsSpreadFormatRegistry.Create;
finalization
SpreadFormatRegistry.Free;
end.

View File

@ -1,22 +0,0 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit laz_fpspreadsheet;
interface
uses
fpolestorage, fpsallformats, xlscommon, fpsStreams, fpspreadsheet,
fpsxmlcommon, xlsbiff2, xlsbiff5, xlsbiff8, xlsxooxml, fpsopendocument,
fpsutils, fpszipper, uvirtuallayer_types, uvirtuallayer, uvirtuallayer_ole,
uvirtuallayer_ole_helpers, uvirtuallayer_ole_types, uvirtuallayer_stream,
fpolebasic, wikitable, fpsNumFormatParser, fpsfunc, fpsRPN, fpsStrings,
fpscsv, fpsCsvDocument, fpspatches, fpsTypes, xlsEscher, fpsReaderWriter,
fpsNumFormat, fpsclasses, fpsHeaderFooterParser, fpsPalette, fpsHTML,
fpsHTMLUtils, fpsCell, fpsSearch, xlsxml, xlsconst, fpsCurrency,
fpsRegFileFormats, fpsImages;
implementation
end.

View File

@ -1,25 +0,0 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit laz_fpspreadsheet_visual;
interface
uses
fpspreadsheetctrls, fpspreadsheetgrid, fpspreadsheetchart, fpsActions,
fpsvisualutils, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('fpspreadsheetctrls', @fpspreadsheetctrls.Register);
RegisterUnit('fpspreadsheetgrid', @fpspreadsheetgrid.Register);
RegisterUnit('fpspreadsheetchart', @fpspreadsheetchart.Register);
RegisterUnit('fpsActions', @fpsActions.Register);
end;
initialization
RegisterPackage('laz_fpspreadsheet_visual', @Register);
end.

View File

@ -1,22 +0,0 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit laz_fpspreadsheetexport_visual;
{$warn 5023 off : no warning about unused units}
interface
uses
fpsexport, fpsexportreg, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('fpsexportreg', @fpsexportreg.Register);
end;
initialization
RegisterPackage('laz_fpspreadsheetexport_visual', @Register);
end.

View File

@ -1,42 +0,0 @@
fpspreadsheet
=============
The fpSpreadsheet library offers a convenient way to generate and read
spreadsheet documents in various formats:
- Excel 2.x .xls
- Excel 5.0/Excel 95 .xls
- Excel 8.0 (Excel 97-XP) .xls
- Microsoft OOXML .xlsx
- LibreOffice/OpenOffice OpenDocument .ods
- wikimedia wikitable formats
The library is written in a very flexible manner, capable of being extended to
support any number of formats easily.
Installation
============
If you only need non-GUI components: in Lazarus:
- Package/Open Package File
- select laz_fpspreadsheet.lpk
- click Compile.
Now the package is known to Lazarus (and should e.g. show up in Package/Package Links).
Add it to your project like you add other packages.
If you also want GUI components (grid and chart):
- Package/Open Package File
- seleect laz_fpspreadsheet_visual.lpk
- click Compile
- then click Use, Install and follow the prompts to rebuild Lazarus with the new package.
Drop needed grid/chart components on your forms as usual
License
=======
LGPL with static linking exception. This is the same license as is used in the Lazarus Component Library.
More information
================
FPSpreadsheet documentation in fpspreadsheet.chm (open e.g. with Lazarus lhelp)
The fpspreadsheet article on the Lazarus wiki with lots of example:
http://wiki.lazarus.freepascal.org/FPSpreadsheet
The demo programs in the examples folder

View File

@ -93,7 +93,7 @@ implementation
uses uses
DateUtils, LConvEncoding, Math, DateUtils, LConvEncoding, Math,
fpsRegFileFormats, fpsUtils, fpsNumFormat; fpsUtils, fpsNumFormat;
function LineEndingAsString(ALineEnding: TsCSVLineEnding): String; function LineEndingAsString(ALineEnding: TsCSVLineEnding): String;
begin begin

View File

@ -142,7 +142,7 @@ implementation
uses uses
LConvEncoding, LazUTF8, URIParser, StrUtils, Math, LConvEncoding, LazUTF8, URIParser, StrUtils, Math,
fpsRegFileFormats, fpsUtils, fpsXMLCommon, fpsNumFormat; fpsUtils, fpsXMLCommon, fpsNumFormat;
const const
MIN_FONTSIZE = 6; MIN_FONTSIZE = 6;

View File

@ -51,7 +51,7 @@ procedure RichTextToHTML(AWorkbook: TsWorkbook; AFont: TsFont;
implementation implementation
uses uses
math, lazUtf8, fasthtmlparser, //StrUtils, //Strings, math, lazUtf8, fasthtmlparser,
fpsUtils, fpsClasses; fpsUtils, fpsClasses;
const const

View File

@ -26,7 +26,7 @@ unit fpsopendocument;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$endif} {$endif}
{$I fps.inc} {$I ..\fps.inc}
{.$define FPSPREADDEBUG} //used to be XLSDEBUG {.$define FPSPREADDEBUG} //used to be XLSDEBUG
@ -42,7 +42,7 @@ uses
fpszipper, fpszipper,
{$ENDIF} {$ENDIF}
fpstypes, fpspreadsheet, fpsReaderWriter, fpsutils, fpsHeaderFooterParser, fpstypes, fpspreadsheet, fpsReaderWriter, fpsutils, fpsHeaderFooterParser,
fpsNumFormat, fpsNumFormatParser, fpsxmlcommon, fpsPagelayout; fpsNumFormat, fpsxmlcommon, fpsPagelayout;
type type
TDateModeODS=( TDateModeODS=(
@ -286,7 +286,7 @@ uses
fpsPatches, fpsPatches,
{$ENDIF} {$ENDIF}
fpsStrings, fpsStreams, fpsClasses, fpsExprParser, fpsStrings, fpsStreams, fpsClasses, fpsExprParser,
fpsRegFileFormats, fpsImages; fpsImages;
const const
{ OpenDocument general XML constants } { OpenDocument general XML constants }
@ -5510,8 +5510,8 @@ begin
headerRows := false; headerRows := false;
firstRepeatedPrintRow := ASheet.PageLayout.RepeatedRows.FirstIndex; firstRepeatedPrintRow := ASheet.PageLayout.RepeatedRows.FirstIndex;
lastRepeatedPrintRow := ASheet.PageLayout.RepeatedRows.LastIndex; lastRepeatedPrintRow := ASheet.PageLayout.RepeatedRows.LastIndex;
if (firstRepeatedPrintRow <> UNASSIGNED_ROW_COL_INDEX) and if (firstRepeatedPrintRow <> Integer(UNASSIGNED_ROW_COL_INDEX)) and
(lastRepeatedPrintRow = UNASSIGNED_ROW_COL_INDEX) (lastRepeatedPrintRow = Integer(UNASSIGNED_ROW_COL_INDEX))
then then
lastRepeatedPrintRow := firstRepeatedPrintRow; lastRepeatedPrintRow := firstRepeatedPrintRow;

View File

@ -8,7 +8,7 @@
unit fpspatches; unit fpspatches;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
{$I fps.inc} {$I ..\fps.inc}
interface interface
@ -29,6 +29,27 @@ uses
Flags: TReplaceFlags; ALanguage: string=''): String; Flags: TReplaceFlags; ALanguage: string=''): String;
function UTF8LowerCase(const AInStr: string; ALanguage: string=''): string; function UTF8LowerCase(const AInStr: string; ALanguage: string=''): string;
function UTF8UpperCase(const AInStr: string; ALanguage: string=''): string; function UTF8UpperCase(const AInStr: string; ALanguage: string=''): string;
// implemented in LazFileUtils (Laz 1.2)
procedure ForcePathDelims(var FileName: String);
{$ENDIF}
{$IFDEF FPS_PTRINT}
type
{$IFDEF CPU64}
PtrInt = Int64;
{$ENDIF}
{$IFDEF CPU32}
PtrInt = Longint;
{$ENDIF}
{$IFDEF CPU16}
{$IF DEFINED(FPC_X86_DATA_FAR) OR DEFINED(FPC_X86_DATA_HUGE)}
PtrInt = Longint;
{$ELSE}
PtrInt = Integer;
{$ENDIF}
{$ENDIF CPU16}
IntPtr = PtrInt;
{$ENDIF} {$ENDIF}
@ -1693,6 +1714,21 @@ begin
// Final correction of the buffer size // Final correction of the buffer size
SetLength(Result,OutCounter); SetLength(Result,OutCounter);
end; end;
procedure ForcePathDelims(var FileName: string);
var
i: Integer;
begin
for i:=1 to Length(FileName) do
{$IFDEF Windows}
if Filename[i]='/' then
Filename[i]:='\';
{$ELSE}
if Filename[i]='\' then
Filename[i]:='/';
{$ENDIF}
end;
{$ENDIF} {$ENDIF}
end. end.

View File

@ -1,16 +1,5 @@
{**
Unit: fpspreadsheet
implements **spreadsheet documents** and their properties and methods.
AUTHORS: Felipe Monteiro de Carvalho, Reinier Olislagers, Werner Pamler
LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus
distribution, for details about the license.
}
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Unit fpspreadsheet implements <b>spreadsheet documents</b> and their Unit fpspreadsheet implements spreadsheet documents and their
properties and methods. properties and methods.
AUTHORS: Felipe Monteiro de Carvalho, Reinier Olislagers, Werner Pamler AUTHORS: Felipe Monteiro de Carvalho, Reinier Olislagers, Werner Pamler
@ -25,7 +14,7 @@ unit fpspreadsheet;
// {$mode objpas}{$H+} // {$mode objpas}{$H+}
{$endif} {$endif}
{$include fps.inc} {$include ..\fps.inc}
interface interface
@ -866,9 +855,8 @@ implementation
uses uses
Math, StrUtils, DateUtils, TypInfo, lazutf8, lazFileUtils, URIParser, Math, StrUtils, DateUtils, TypInfo, lazutf8, lazFileUtils, URIParser,
fpsStrings, uvirtuallayer_ole, uvirtuallayer_ole, {%H-}fpsPatches, fpsStrings, fpsUtils, fpsHTMLUtils,
fpsUtils, fpsHTMLUtils, fpsRegFileFormats, fpsReaderWriter, fpsReaderWriter, fpsCurrency, fpsExprParser;
fpsCurrency, fpsExprParser, fpsNumFormatParser;
(* (*
const const
@ -4268,10 +4256,8 @@ end;
procedure TsWorksheet.WriteText(ACell: PCell; AText: String; procedure TsWorksheet.WriteText(ACell: PCell; AText: String;
ARichTextParams: TsRichTextParams = nil); ARichTextParams: TsRichTextParams = nil);
var var
r, c: Cardinal;
i: Integer; i: Integer;
hyperlink: TsHyperlink; hyperlink: TsHyperlink;
fmt: TsCellFormat;
begin begin
if ACell = nil then if ACell = nil then
exit; exit;
@ -4287,8 +4273,6 @@ begin
end; end;
end; end;
fmt := Workbook.GetCellFormat(ACell^.FormatIndex);
if (AText = '') then if (AText = '') then
begin begin
{ Initially, the cell was destroyed here if AText = '' and the cell is not { Initially, the cell was destroyed here if AText = '' and the cell is not
@ -7658,7 +7642,6 @@ end;
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsWorkbook.GetLastRowColIndex(out ALastRow, ALastCol: Cardinal); procedure TsWorkbook.GetLastRowColIndex(out ALastRow, ALastCol: Cardinal);
var var
i: Integer;
sheet: TsWorksheet; sheet: TsWorksheet;
begin begin
ALastRow := 0; ALastRow := 0;

View File

@ -2,12 +2,15 @@
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Unit fpsReaderWriter implements basic reading/writing support Unit fpsReaderWriter implements basic reading/writing support
for fpspreadsheet. for fpspreadsheet, as well as registration of the file formats supported.
AUTHORS: Felipe Monteiro de Carvalho, Reinier Olislagers, Werner Pamler AUTHORS: Felipe Monteiro de Carvalho, Reinier Olislagers, Werner Pamler
LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus LICENSE: See the file COPYING.modifiedLGPL.txt, included in the Lazarus
distribution, for details about the license. distribution, for details about the license.
USAGE: Each unit implementing a new spreadsheet format must register the
reader/writer and some specific data by calling "RegisterSpreadFormat".
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
unit fpsReaderWriter; unit fpsReaderWriter;
@ -181,6 +184,33 @@ type
end; end;
type
TsSpreadFileAccess = (faRead, faWrite);
function RegisterSpreadFormat(
AFormat: TsSpreadsheetFormat;
AReaderClass: TsSpreadReaderClass;
AWriterClass: TsSpreadWriterClass;
AFormatName, ATechnicalName: String;
const AFileExtensions: array of String): TsSpreadFormatID;
function GetFileFormatFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
function GetSpreadFormats(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
function GetSpreadFormatsFromFileName(AFileAccess: TsSpreadFileAccess; AFileName: TFileName;
APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
function GetSpreadFormatExt(AFormatID: TsSpreadFormatID): String;
function GetSpreadFormatName(AFormatID: TsSpreadFormatID): String;
function GetSpreadTechnicalName(AFormatID: TsSpreadFormatID): String;
function GetSpreadReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
function GetSpreadWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
implementation implementation
uses uses
@ -331,7 +361,7 @@ begin
// If the count of columns is equal to the max colcount of the file format // If the count of columns is equal to the max colcount of the file format
// then it is likely that dummy columns have been added -> delete all empty // then it is likely that dummy columns have been added -> delete all empty
// columns (starting at the right) until the first non-empty column is found // columns (starting at the right) until the first non-empty column is found
if AWorksheet.Cols.Count = FLimitations.MaxColCount then if AWorksheet.Cols.Count = SizeInt(FLimitations.MaxColCount) then
begin begin
c := AWorksheet.Cols.Count - 1; c := AWorksheet.Cols.Count - 1;
lCol := PCol(AWorksheet.Cols[c]); lCol := PCol(AWorksheet.Cols[c]);
@ -781,5 +811,522 @@ begin
raise Exception.Create(rsUnsupportedWriteFormat); raise Exception.Create(rsUnsupportedWriteFormat);
end; end;
type
TsSpreadFormatData = class
private
FFormatID: TsSpreadFormatID; // Format identifier
FName: String; // Text to be used in FileDialog filter
FTechnicalName: String; // Text to be used e.g. in Titlebar
FFileExtensions: array of String; // File extensions used by this format
FReaderClass: TsSpreadReaderClass; // Class for reading these files
FWriterClass: TsSpreadWriterClass; // Class for writing these files
function GetFileExtension(AIndex: Integer): String;
function GetFileExtensionCount: Integer;
public
constructor Create(AFormatID: TsSpreadFormatID; AReaderClass: TsSpreadReaderClass;
AWriterClass: TsSpreadWriterClass; AFormatName, ATechnicalName: String;
const AExtensions: Array of String);
// ACanReadFromClipboard, ACanWriteToClipboard: Boolean);
function GetFileFilterMask(ASeparator: Char): String;
// property CanReadFromClipboard: boolean read FCanReadClipboard;
// property CanWriteToClipboard: boolean read FCanWriteClipboard;
property FormatID: TsSpreadFormatID read FFormatID;
property FormatName: String read FName;
property FileExtension[AIndex: Integer]: String read GetFileExtension;
property FileExtensionCount: Integer read GetFileExtensionCount;
property ReaderClass: TsSpreadReaderClass read FReaderClass;
property TechnicalName: String read FTechnicalName;
property WriterClass: TsSpreadWriterClass read FWriterClass;
end;
{ TsSpreadFormatRegistry }
TsSpreadFormatRegistry = class
private
FList: TFPList;
FCachedData: TsSpreadFormatData;
FCachedFormatID: TsSpreadFormatID;
function GetDefaultExt(AFormatID: TsSpreadFormatID): String;
function GetFormatName(AFormatID: TsSpreadFormatID): String;
function GetReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
function GetTechnicalName(AFormatID: TsSpreadFormatID): String;
function GetWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
protected
function Add(AData: TsSpreadFormatData): Integer;
function FindFormatID(AFormatID: TsSpreadFormatID): TsSpreadFormatData;
function IndexOf(AFormatID: TsSpreadFormatID): Integer;
public
constructor Create;
destructor Destroy; override;
function GetAllSpreadFilesMask(AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess): String;
function GetAllExcelFilesMask(AExtSeparator: Char): String;
function GetFileFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
function GetFormatArray(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
function GetFormatArrayFromFileName(AFileAccess: TsSpreadFileAccess;
const AFileName: String; APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
property DefaultExt[AFormatID: TsSpreadFormatID]: String read GetDefaultExt;
property FormatName[AFormatID: TsSpreadFormatID]: String read GetFormatName;
property ReaderClass[AFormatID: TsSpreadFormatID]: TsSpreadReaderClass read GetReaderClass;
property TechnicalName[AFormatID: TsSpreadFormatID]: String read GetTechnicalName;
property WriterClass[AFormatID: TsSpreadFormatID]: TsSpreadWriterClass read GetWriterClass;
end;
var
SpreadFormatRegistry: TsSpreadFormatRegistry;
{==============================================================================}
{ TsSpreadFormatData }
{==============================================================================}
constructor TsSpreadFormatData.Create(AFormatID: TsSpreadFormatID;
AReaderClass: TsSpreadReaderClass; AWriterClass: TsSpreadWriterClass;
AFormatName, ATechnicalName: String; const AExtensions: array of String);
var
i: Integer;
begin
FFormatID := AFormatID;
FReaderClass := AReaderClass;
FWriterClass := AWriterClass;
FName := AFormatName;
FTechnicalName := ATechnicalName;
SetLength(FFileExtensions, Length(AExtensions));
for i:=0 to High(FFileExtensions) do FFileExtensions[i] := AExtensions[i];
end;
function TsSpreadFormatData.GetFileExtension(AIndex: Integer): String;
begin
Result := FFileExtensions[AIndex];
end;
function TsSpreadFormatData.GetFileExtensionCount: Integer;
begin
Result := Length(FFileExtensions);
end;
function TsSpreadFormatData.GetFileFilterMask(ASeparator: Char): String;
var
i: Integer;
begin
Result := '*' + FFileExtensions[0];
for i:= 1 to High(FFileExtensions) do
Result := Result + ASeparator + '*' + FFileExtensions[i];
end;
{==============================================================================}
{ TsSpreadFormatRegistry }
{==============================================================================}
constructor TsSpreadFormatRegistry.Create;
begin
inherited;
FList := TFPList.Create;
FCachedFormatID := sfidUnknown;
FCachedData := nil;
end;
destructor TsSpreadFormatRegistry.Destroy;
var
i: Integer;
begin
for i := FList.Count-1 downto 0 do TObject(FList[i]).Free;
FList.Free;
inherited;
end;
function TsSpreadFormatRegistry.Add(AData: TsSpreadFormatData): Integer;
begin
Result := FList.Add(AData);
end;
function TsSpreadFormatRegistry.FindFormatID(AFormatID: TsSpreadFormatID): TsSpreadFormatData;
var
idx: Integer;
begin
if AFormatID <> FCachedFormatID then
begin
idx := IndexOf(AFormatID);
if idx = -1 then
begin
FCachedData := nil;
FCachedFormatID := sfidUnknown;
end else
begin
FCachedData := TsSpreadFormatData(FList[idx]);
FCachedFormatID := AFormatID;
end;
end;
Result := FCachedData;
end;
function TsSpreadFormatRegistry.GetDefaultExt(AFormatID: TsSpreadFormatID): String;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.FileExtension[0] else
Result := '';
end;
function TsSpreadFormatRegistry.GetAllSpreadFilesMask(AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess): String;
var
L: TStrings;
data: TsSpreadFormatData;
ext: String;
i, j: Integer;
begin
Result := '';
L := TStringList.Create;
try
for i:=0 to FList.Count-1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then continue;
faWrite : if data.WriterClass = nil then continue;
end;
for j:=0 to data.FileExtensionCount-1 do
begin
ext := data.FileExtension[j];
if L.IndexOf(ext) = -1 then
L.Add(ext);
end;
end;
if L.Count > 0 then
begin
Result := '*' + L[0];
for i := 1 to L.Count-1 do
Result := Result + AExtSeparator + '*' + L[i];
end;
finally
L.Free;
end;
end;
function TsSpreadFormatRegistry.GetAllExcelFilesMask(AExtSeparator: Char): String;
var
j: Integer;
L: TStrings;
data: TsSpreadFormatData;
ext: String;
begin
L := TStringList.Create;
try
// good old BIFF...
if (IndexOf(ord(sfExcel8)) <> -1) or
(IndexOf(ord(sfExcel5)) <> -1) or
(IndexOf(ord(sfExcel2)) <> -1) then L.Add('*.xls');
// Excel 2007+
j := IndexOf(ord(sfOOXML));
if j <> -1 then
begin
data := TsSpreadFormatData(FList[j]);
for j:=0 to data.FileExtensionCount-1 do
begin
ext := data.FileExtension[j];
if L.IndexOf(ext) = -1 then
L.Add('*' + ext);
end;
end;
L.Delimiter := AExtSeparator;
L.StrictDelimiter := true;
Result := L.DelimitedText;
finally
L.Free;
end;
end;
function TsSpreadFormatRegistry.GetFileFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
var
i, idx: Integer;
L: TStrings;
s: String;
data: TsSpreadFormatData;
begin
// Bring the formats listed in APriorityFormats to the top
if Length(APriorityFormats) > 0 then
for i := High(APriorityFormats) downto Low(APriorityFormats) do
begin
idx := IndexOf(APriorityFormats[i]);
data := TsSpreadFormatData(FList[idx]);
FList.Delete(idx);
FList.Insert(0, data);
end;
L := TStringList.Create;
try
L.Delimiter := AListSeparator;
L.StrictDelimiter := true;
if AllSpreadFormats then
begin
s := GetAllSpreadFilesMask(AExtSeparator, AFileAccess);
if s <> '' then
begin
L.Add(rsAllSpreadsheetFiles);
L.Add(GetAllSpreadFilesMask(AExtSeparator, AFileAccess));
end;
end;
if AllExcelFormats then
begin
s := GetAllExcelFilesMask(AExtSeparator);
if s <> '' then
begin
L.Add(Format('%s (%s)', [rsAllExcelFiles, s]));
L.Add(s);
end;
end;
for i:=0 to FList.Count-1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then Continue;
faWrite : if data.WriterClass = nil then Continue;
end;
s := data.GetFileFilterMask(AExtSeparator);
L.Add(Format('%s %s (%s)', [data.FormatName, rsFiles, s]));
L.Add(s);
end;
Result := L.DelimitedText;
finally
L.Free;
end;
end;
function TsSpreadFormatRegistry.GetFormatArray(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
var
i, n, idx: Integer;
data: TsSpreadFormatData;
begin
// Rearrange the formats such the one noted in APriorityFormats are at the top
if Length(APriorityFormats) > 0 then
for i := High(APriorityFormats) downto Low(APriorityFormats) do
begin
idx := IndexOf(APriorityFormats[i]);
data := TsSpreadFormatData(FList[idx]);
FList.Delete(idx);
FList.Insert(0, data);
end;
SetLength(Result, FList.Count);
n := 0;
for i := 0 to FList.Count-1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then Continue;
faWrite : if data.WriterClass = nil then Continue;
end;
Result[n] := data.FormatID;
inc(n);
end;
SetLength(Result, n);
end;
function TsSpreadFormatRegistry.GetFormatArrayFromFileName(
AFileAccess: TsSpreadFileAccess; const AFileName: String;
APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
var
idx: Integer;
i, j, n: Integer;
ext: String;
data: TsSpreadFormatData;
begin
ext := Lowercase(ExtractFileExt(AFileName));
if APriorityFormat <> sfidUnknown then
begin
// Bring the priority format to the top
idx := IndexOf(APriorityFormat);
FList.Exchange(0, idx);
end;
SetLength(Result, FList.Count);
n := 0;
for i := 0 to FList.Count - 1 do
begin
data := TsSpreadFormatData(FList[i]);
case AFileAccess of
faRead : if data.ReaderClass = nil then Continue;
faWrite : if data.WriterClass = nil then Continue;
end;
for j:=0 to data.FileExtensionCount-1 do
if Lowercase(data.FileExtension[j]) = ext then
begin
Result[n] := data.FormatID;
inc(n);
end;
end;
SetLength(Result, n);
if APriorityFormat <> sfidUnknown then
// Restore original order
FList.Exchange(idx, 0);
end;
function TsSpreadFormatRegistry.GetFormatName(AFormatID: TsSpreadFormatID): String;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.FormatName else
Result := '';
end;
function TsSpreadFormatRegistry.GetReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.ReaderClass else
Result := nil;
end;
function TsSpreadFormatRegistry.GetTechnicalName(AFormatID: TsSpreadFormatID): String;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.TechnicalName else
Result := '';
end;
function TsSpreadFormatRegistry.GetWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
var
data: TsSpreadFormatData;
begin
data := FindFormatID(AFormatID);
if data <> nil then
Result := data.WriterClass else
Result := nil;
end;
function TsSpreadFormatRegistry.IndexOf(AFormatID: TsSpreadFormatID): Integer;
begin
for Result := 0 to FList.Count - 1 do
if TsSpreadFormatData(FList[Result]).FormatID = AFormatID then
exit;
Result := -1;
end;
{==============================================================================}
{ Public utility functions }
{==============================================================================}
{@@ ----------------------------------------------------------------------------
Registers a new reader/writer pair for a given spreadsheet file format
AFormat identifies the file format, see sfXXXX declarations in built-in
fpstypes.
The system is open to user-defined formats. In this case, AFormat must have
the value "sfUser". The format identifier is calculated as a negative number,
stored in the TsSpreadFormatData class and returned as function result.
This value is needed when calling fpspreadsheet's ReadFromXXXX and WriteToXXXX
methods to specify the file format.
-------------------------------------------------------------------------------}
function RegisterSpreadFormat(AFormat: TsSpreadsheetFormat;
AReaderClass: TsSpreadReaderClass; AWriterClass: TsSpreadWriterClass;
AFormatName, ATechnicalName: String; const AFileExtensions: array of String): TsSpreadFormatID;
var
fmt: TsSpreadFormatData;
n: Integer;
begin
if AFormat <> sfUser then begin
n := SpreadFormatRegistry.IndexOf(ord(AFormat));
if n >= 0 then
raise Exception.Create('[RegisterSpreadFormat] Spreadsheet format is already registered.');
end;
if Length(AFileExtensions) = 0 then
raise Exception.Create('[RegisterSpreadFormat] File extensions needed for registering a file format.');
if (AFormatName = '') or (ATechnicalName = '') then
raise Exception.Create('[RegisterSpreadFormat] File format name is not specified.');
fmt := TsSpreadFormatData.Create(ord(AFormat), AReaderClass, AWriterClass,
AFormatName, ATechnicalName, AFileExtensions);
n := SpreadFormatRegistry.Add(fmt);
if (AFormat = sfUser) then
begin
if (n <= ord(sfUser)) then n := n + ord(sfUser) + 1;
fmt.FFormatID := -n;
end;
Result := fmt.FormatID;
end;
function GetFileFormatFilter(AListSeparator, AExtSeparator: Char;
AFileAccess: TsSpreadFileAccess; const APriorityFormats: array of TsSpreadFormatID;
AllSpreadFormats: Boolean = false; AllExcelFormats: Boolean = false): String;
begin
Result := SpreadFormatRegistry.GetFileFilter(AListSeparator, AExtSeparator,
AFileAccess, APriorityFormats, AllSpreadFormats, AllExcelFormats);
end;
function GetSpreadFormats(AFileAccess: TsSpreadFileAccess;
const APriorityFormats: array of TsSpreadFormatID): TsSpreadFormatIDArray;
begin
Result := SpreadFormatRegistry.GetFormatArray(AFileAccess, APriorityFormats);
end;
function GetSpreadFormatsFromFileName(
AFileAccess: TsSpreadFileAccess; AFileName: TFileName;
APriorityFormat: TsSpreadFormatID = sfidUnknown): TsSpreadFormatIDArray;
begin
Result := SpreadFormatRegistry.GetFormatArrayFromFileName(
AFileAccess, AFileName, APriorityFormat);
end;
function GetSpreadFormatExt(AFormatID: TsSpreadFormatID): String;
begin
Result := SpreadFormatRegistry.DefaultExt[AFormatID];
end;
function GetSpreadFormatName(AFormatID: TsSpreadFormatID): String;
begin
Result := SpreadFormatRegistry.FormatName[AFormatID];
end;
function GetSpreadTechnicalName(AFormatID: TsSpreadFormatID): String;
begin
Result := SpreadFormatRegistry.TechnicalName[AFormatID];
end;
function GetSpreadReaderClass(AFormatID: TsSpreadFormatID): TsSpreadReaderClass;
begin
Result := SpreadFormatRegistry.ReaderClass[AFormatID];
end;
function GetSpreadWriterClass(AFormatID: TsSpreadFormatID): TsSpreadWriterClass;
begin
Result := SpreadFormatRegistry.WriterClass[AFormatID];
end;
initialization
SpreadFormatRegistry := TsSpreadFormatRegistry.Create;
finalization
SpreadFormatRegistry.Free;
end. end.

View File

@ -61,7 +61,7 @@ type
implementation implementation
uses uses
lazutf8; lazutf8, {%H-}fpsPatches;
constructor TsSearchEngine.Create(AWorkbook: TsWorkbook); constructor TsSearchEngine.Create(AWorkbook: TsWorkbook);
begin begin

View File

@ -207,7 +207,7 @@ var
implementation implementation
uses uses
Math, lazutf8, lazfileutils, fpsStrings, fpsRegFileFormats; Math, lazutf8, lazfileutils, fpsStrings, fpsReaderWriter;
const const
INT_NUM_LETTERS = 26; INT_NUM_LETTERS = 26;

View File

@ -110,7 +110,7 @@ var
implementation implementation
uses uses
fpsStrings, fpsXMLCommon, fpsRegFileFormats; fpsStrings, fpsXMLCommon;
{ TWikiTableTokenizer } { TWikiTableTokenizer }

View File

@ -168,7 +168,7 @@ implementation
uses uses
Math, Math,
fpsStrings, fpsRegFileFormats, fpsPalette, fpsNumFormat; fpsStrings, fpsReaderWriter, fpsPalette, fpsNumFormat;
const const
{ Excel record IDs } { Excel record IDs }
@ -370,7 +370,7 @@ end;
procedure TsSpreadBIFF2Reader.ReadColumnDefault(AStream: TStream); procedure TsSpreadBIFF2Reader.ReadColumnDefault(AStream: TStream);
var var
c, col1, col2: Word; c, col1, col2: Word;
attr1, attr2, attr3: Byte; attr2, attr3: Byte;
fmt: TsCellFormat; fmt: TsCellFormat;
fmtIndex: Integer; fmtIndex: Integer;
fontIndex: Integer; fontIndex: Integer;
@ -386,7 +386,7 @@ begin
col2 := WordLEToN(AStream.ReadWord) - 1; col2 := WordLEToN(AStream.ReadWord) - 1;
{ Attributes } { Attributes }
attr1 := AStream.ReadByte; {attr1 := }AStream.ReadByte; // Avoid compiler warning of unused attr1
attr2 := AStream.ReadByte; attr2 := AStream.ReadByte;
attr3 := AStream.ReadByte; attr3 := AStream.ReadByte;

View File

@ -217,7 +217,7 @@ implementation
uses uses
Math, Math,
fpsStrings, fpsRegFileFormats, fpsStreams, fpsPalette, fpsNumFormat, xlsconst; fpsStrings, fpsReaderWriter, fpsStreams, fpsPalette, fpsNumFormat, xlsconst;
const const
{ Excel record IDs } { Excel record IDs }

View File

@ -279,7 +279,7 @@ implementation
uses uses
Math, lconvencoding, LazFileUtils, URIParser, Math, lconvencoding, LazFileUtils, URIParser,
fpsStrings, fpsStreams, fpsRegFileFormats, fpsPalette, fpsStrings, {%H-}fpsPatches, fpsStreams, fpsReaderWriter, fpsPalette,
fpsNumFormat, fpsExprParser, xlsEscher; fpsNumFormat, fpsExprParser, xlsEscher;
const const
@ -1941,7 +1941,10 @@ begin
AStream.ReadBuffer(wideStr[1], size); AStream.ReadBuffer(wideStr[1], size);
// The buffer can be larger than the space occupied by the wideStr. // The buffer can be larger than the space occupied by the wideStr.
// --> Find true string length and convert wide string to utf-8. // --> Find true string length and convert wide string to utf-8.
len := StrLen(PWideChar(widestr));
// len := StrLen(PWideChar(widestr)); // wp: working fine except for Laz1.0
len := Length(widestr); // Is this ok?
SetLength(widestr, len); SetLength(widestr, len);
link := UTF8Encode(widestr); link := UTF8Encode(widestr);
end else end else

View File

@ -11,7 +11,7 @@ interface
uses uses
Classes, SysUtils, DateUtils, lconvencoding, Classes, SysUtils, DateUtils, lconvencoding,
fpsTypes, fpSpreadsheet, fpsUtils, fpsNumFormatParser, fpsPalette, fpsTypes, fpSpreadsheet, fpsUtils, fpsNumFormat, fpsPalette,
fpsReaderWriter, fpsrpn; fpsReaderWriter, fpsrpn;
const const
@ -633,8 +633,7 @@ implementation
uses uses
AVL_Tree, Math, Variants, AVL_Tree, Math, Variants,
{%H-}fpspatches, fpsStrings, fpsClasses, fpsNumFormat, xlsConst, {%H-}fpspatches, fpsStrings, fpsClasses, xlsConst,
//fpsrpn,
fpsExprParser, fpsPageLayout; fpsExprParser, fpsPageLayout;
const const
@ -2119,8 +2118,6 @@ var
hasFormat: Boolean; hasFormat: Boolean;
flags: DWord; flags: DWord;
xf: Word; xf: Word;
idx: Integer;
fmt: PsCellFormat;
begin begin
rowrec.RowIndex := 0; // to silence the compiler... rowrec.RowIndex := 0; // to silence the compiler...
AStream.ReadBuffer(rowrec, SizeOf(TRowRecord)); AStream.ReadBuffer(rowrec, SizeOf(TRowRecord));
@ -4397,7 +4394,7 @@ begin
dw := dw or $00000040; // Row height and font height do not match dw := dw or $00000040; // Row height and font height do not match
if ARow^.FormatIndex > 0 then begin if ARow^.FormatIndex > 0 then begin
dw := dw or $00000080; // Row has custom format dw := dw or $00000080; // Row has custom format
dw := dw or (FindXFIndex(ARow^.FormatIndex) shl 16); // xf index dw := dw or DWord(FindXFIndex(ARow^.FormatIndex) shl 16); // xf index
end; end;
{ Write out } { Write out }

View File

@ -90,7 +90,7 @@ implementation
uses uses
StrUtils, Math, StrUtils, Math,
fpsStrings, fpsRegFileFormats, fpsUtils, fpsNumFormat, fpsXmlCommon, fpsHTMLUtils; fpsStrings, fpsUtils, fpsNumFormat, fpsXmlCommon, fpsHTMLUtils;
const const
FMT_OFFSET = 61; FMT_OFFSET = 61;

View File

@ -227,8 +227,7 @@ implementation
uses uses
variants, strutils, math, lazutf8, LazFileUtils, uriparser, variants, strutils, math, lazutf8, LazFileUtils, uriparser,
{%H-}fpsPatches, {%H-}fpsPatches,
fpsStrings, fpsStreams, fpsNumFormatParser, fpsClasses, fpsImages, fpsStrings, fpsStreams, fpsClasses, fpsImages;
fpsRegFileFormats;
const const
{ OOXML general XML constants } { OOXML general XML constants }
@ -1139,7 +1138,8 @@ begin
L.DelimitedText := GetNodeValue(node); L.DelimitedText := GetNodeValue(node);
for j:=0 to L.Count-1 do for j:=0 to L.Count-1 do
begin begin
s := ReplaceStr(L[j], '''', ''); //s := ReplaceStr(L[j], '''', ''); // wp: replaced by next line because of Laz 1.0
s := StringReplace(L[j], '''', '', [rfReplaceAll]);
p := pos(':', s); p := pos(':', s);
if p = 0 then if p = 0 then
begin begin
@ -1163,7 +1163,8 @@ begin
L.DelimitedText := GetNodeValue(node); L.DelimitedText := GetNodeValue(node);
for j:=0 to L.Count-1 do for j:=0 to L.Count-1 do
begin begin
s := ReplaceStr(L[j], '''', ''); //s := ReplaceStr(L[j], '''', ''); // wp: replaced by next line due to Laz 1.0
s := StringReplace(L[j], '''', '', [rfReplaceAll]);
p := pos('!', s); p := pos('!', s);
if p > 0 then s := Copy(s, p+1, MaxInt); if p > 0 then s := Copy(s, p+1, MaxInt);
p := pos(':', s); p := pos(':', s);

View File

@ -37,3 +37,8 @@
the package with older versions activate the define FPS_NO_GRID_MULTISELECT } the package with older versions activate the define FPS_NO_GRID_MULTISELECT }
{.$DEFINE FPS_NO_GRID_MULTISELECT} {.$DEFINE FPS_NO_GRID_MULTISELECT}
{ In order to provide safe casting of integers to pointers new version of FPC
provide the types PtrInt and IntPtr.
This is not yet available in fpc 2.6.0 }
{.$DEFINE FPS_PTRINT}

View File

@ -0,0 +1,3 @@
(1) Open laz_fpspreadsheet.lpk --> compile
(2) Open laz_fpspreadsheet_visual.lpk --> Usage --> Install
(3) Open laz_fpspreadsheetexport_visual.lpk --> Usage --> Install

View File

@ -9,7 +9,8 @@
<Version Value="11"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <OtherUnitFiles Value="common"/>
<UnitOutputDirectory Value="common\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>
@ -18,10 +19,11 @@
</Parsing> </Parsing>
<Other> <Other>
<CompilerMessages> <CompilerMessages>
<IgnoredMessages idx5028="True" idx4055="True" idx2005="True"/> <IgnoredMessages idx2005="True" idx4055="True" idx5028="True"/>
</CompilerMessages> </CompilerMessages>
<CustomOptions Value="$(IDEBuildOptions) <CustomOptions Value="$(IDEBuildOptions)
-dDisableWrapperFunctions"/> -dDisableWrapperFunctions"/>
<CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
<Description Value="laz_fpspreadsheet is a non-visual component that allows you to use the fpspreadsheet package to read/write spreadsheet files in .xls (BIFF/Excel), .ods OpenDocument (LibreOffice/OpenOffice) and .xlsx Open XML (Excel) formats. <Description Value="laz_fpspreadsheet is a non-visual component that allows you to use the fpspreadsheet package to read/write spreadsheet files in .xls (BIFF/Excel), .ods OpenDocument (LibreOffice/OpenOffice) and .xlsx Open XML (Excel) formats.
@ -31,189 +33,229 @@ This package is all you need if you don't want graphical components (like grids
<Version Major="1" Minor="7"/> <Version Major="1" Minor="7"/>
<Files Count="45"> <Files Count="45">
<Item1> <Item1>
<Filename Value="fpolestorage.pas"/> <Filename Value="fps.inc"/>
<UnitName Value="fpolestorage"/> <Type Value="Include"/>
</Item1> </Item1>
<Item2> <Item2>
<Filename Value="fpsallformats.pas"/> <Filename Value="common\fpolebasic.pas"/>
<UnitName Value="fpsallformats"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpolebasic"/>
</Item2> </Item2>
<Item3> <Item3>
<Filename Value="xlscommon.pas"/> <Filename Value="common\fpolestorage.pas"/>
<UnitName Value="xlscommon"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpolestorage"/>
</Item3> </Item3>
<Item4> <Item4>
<Filename Value="fpsstreams.pas"/> <Filename Value="common\fpsallformats.pas"/>
<UnitName Value="fpsStreams"/> <UnitName Value="fpsallformats"/>
</Item4> </Item4>
<Item5> <Item5>
<Filename Value="fpspreadsheet.pas"/> <Filename Value="common\fpscell.pas"/>
<UnitName Value="fpspreadsheet"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsCell"/>
</Item5> </Item5>
<Item6> <Item6>
<Filename Value="fpsxmlcommon.pas"/> <Filename Value="common\fpsclasses.pas"/>
<UnitName Value="fpsxmlcommon"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsclasses"/>
</Item6> </Item6>
<Item7> <Item7>
<Filename Value="xlsbiff2.pas"/> <Filename Value="common\fpscsv.pas"/>
<UnitName Value="xlsbiff2"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpscsv"/>
</Item7> </Item7>
<Item8> <Item8>
<Filename Value="xlsbiff5.pas"/> <Filename Value="common\fpscsvdocument.pas"/>
<UnitName Value="xlsbiff5"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsCsvDocument"/>
</Item8> </Item8>
<Item9> <Item9>
<Filename Value="xlsbiff8.pas"/> <Filename Value="common\fpscurrency.pas"/>
<UnitName Value="xlsbiff8"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsCurrency"/>
</Item9> </Item9>
<Item10> <Item10>
<Filename Value="xlsxooxml.pas"/> <Filename Value="common\fpsexprparser.pas"/>
<UnitName Value="xlsxooxml"/> <UnitName Value="fpsExprParser"/>
</Item10> </Item10>
<Item11> <Item11>
<Filename Value="fpsopendocument.pas"/> <Filename Value="common\fpsfunc.pas"/>
<UnitName Value="fpsopendocument"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsfunc"/>
</Item11> </Item11>
<Item12> <Item12>
<Filename Value="fpsutils.pas"/> <Filename Value="common\fpsheaderfooterparser.pas"/>
<UnitName Value="fpsutils"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsHeaderFooterParser"/>
</Item12> </Item12>
<Item13> <Item13>
<Filename Value="fpszipper.pp"/> <Filename Value="common\fpshtml.pas"/>
<UnitName Value="fpszipper"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsHTML"/>
</Item13> </Item13>
<Item14> <Item14>
<Filename Value="uvirtuallayer_types.pas"/> <Filename Value="common\fpshtmlutils.pas"/>
<UnitName Value="uvirtuallayer_types"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsHTMLUtils"/>
</Item14> </Item14>
<Item15> <Item15>
<Filename Value="uvirtuallayer.pas"/> <Filename Value="common\fpsimages.pas"/>
<UnitName Value="uvirtuallayer"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsImages"/>
</Item15> </Item15>
<Item16> <Item16>
<Filename Value="uvirtuallayer_ole.pas"/> <Filename Value="common\fpsnumformat.pas"/>
<UnitName Value="uvirtuallayer_ole"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsNumFormat"/>
</Item16> </Item16>
<Item17> <Item17>
<Filename Value="uvirtuallayer_ole_helpers.pas"/> <Filename Value="common\fpsopendocument.pas"/>
<UnitName Value="uvirtuallayer_ole_helpers"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsopendocument"/>
</Item17> </Item17>
<Item18> <Item18>
<Filename Value="uvirtuallayer_ole_types.pas"/> <Filename Value="common\fpspagelayout.pas"/>
<UnitName Value="uvirtuallayer_ole_types"/> <UnitName Value="fpsPageLayout"/>
</Item18> </Item18>
<Item19> <Item19>
<Filename Value="uvirtuallayer_stream.pas"/> <Filename Value="common\fpspalette.pas"/>
<UnitName Value="uvirtuallayer_stream"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsPalette"/>
</Item19> </Item19>
<Item20> <Item20>
<Filename Value="fpolebasic.pas"/> <Filename Value="common\fpspatches.pas"/>
<UnitName Value="fpolebasic"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpspatches"/>
</Item20> </Item20>
<Item21> <Item21>
<Filename Value="wikitable.pas"/> <Filename Value="common\fpspreadsheet.pas"/>
<UnitName Value="wikitable"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpspreadsheet"/>
</Item21> </Item21>
<Item22> <Item22>
<Filename Value="fpsnumformatparser.pas"/> <Filename Value="common\fpsreaderwriter.pas"/>
<UnitName Value="fpsNumFormatParser"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsReaderWriter"/>
</Item22> </Item22>
<Item23> <Item23>
<Filename Value="fpsfunc.pas"/> <Filename Value="common\fpsrpn.pas"/>
<UnitName Value="fpsfunc"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsRPN"/>
</Item23> </Item23>
<Item24> <Item24>
<Filename Value="fpsrpn.pas"/> <Filename Value="common\fpsstreams.pas"/>
<UnitName Value="fpsRPN"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsStreams"/>
</Item24> </Item24>
<Item25> <Item25>
<Filename Value="fpsstrings.pas"/> <Filename Value="common\fpsstrings.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsStrings"/> <UnitName Value="fpsStrings"/>
</Item25> </Item25>
<Item26> <Item26>
<Filename Value="fpscsv.pas"/> <Filename Value="common\fpstypes.pas"/>
<UnitName Value="fpscsv"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsTypes"/>
</Item26> </Item26>
<Item27> <Item27>
<Filename Value="fpscsvdocument.pas"/> <Filename Value="common\fpsutils.pas"/>
<UnitName Value="fpsCsvDocument"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsutils"/>
</Item27> </Item27>
<Item28> <Item28>
<Filename Value="fpspatches.pas"/> <Filename Value="common\fpsxmlcommon.pas"/>
<UnitName Value="fpspatches"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpsxmlcommon"/>
</Item28> </Item28>
<Item29> <Item29>
<Filename Value="fpstypes.pas"/> <Filename Value="common\fpszipper.pp"/>
<UnitName Value="fpsTypes"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="fpszipper"/>
</Item29> </Item29>
<Item30> <Item30>
<Filename Value="xlsescher.pas"/> <Filename Value="common\uvirtuallayer.pas"/>
<UnitName Value="xlsEscher"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="uvirtuallayer"/>
</Item30> </Item30>
<Item31> <Item31>
<Filename Value="fpsreaderwriter.pas"/> <Filename Value="common\uvirtuallayer_ole.pas"/>
<UnitName Value="fpsReaderWriter"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="uvirtuallayer_ole"/>
</Item31> </Item31>
<Item32> <Item32>
<Filename Value="fpsnumformat.pas"/> <Filename Value="common\uvirtuallayer_ole_helpers.pas"/>
<UnitName Value="fpsNumFormat"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="uvirtuallayer_ole_helpers"/>
</Item32> </Item32>
<Item33> <Item33>
<Filename Value="fpsclasses.pas"/> <Filename Value="common\uvirtuallayer_ole_types.pas"/>
<UnitName Value="fpsclasses"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="uvirtuallayer_ole_types"/>
</Item33> </Item33>
<Item34> <Item34>
<Filename Value="fpsheaderfooterparser.pas"/> <Filename Value="common\uvirtuallayer_stream.pas"/>
<UnitName Value="fpsHeaderFooterParser"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="uvirtuallayer_stream"/>
</Item34> </Item34>
<Item35> <Item35>
<Filename Value="fpspalette.pas"/> <Filename Value="common\uvirtuallayer_types.pas"/>
<UnitName Value="fpsPalette"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="uvirtuallayer_types"/>
</Item35> </Item35>
<Item36> <Item36>
<Filename Value="fpshtml.pas"/> <Filename Value="common\wikitable.pas"/>
<UnitName Value="fpsHTML"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="wikitable"/>
</Item36> </Item36>
<Item37> <Item37>
<Filename Value="fpshtmlutils.pas"/> <Filename Value="common\xlsbiff2.pas"/>
<UnitName Value="fpsHTMLUtils"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="xlsbiff2"/>
</Item37> </Item37>
<Item38> <Item38>
<Filename Value="fpscell.pas"/> <Filename Value="common\xlsbiff5.pas"/>
<UnitName Value="fpsCell"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="xlsbiff5"/>
</Item38> </Item38>
<Item39> <Item39>
<Filename Value="fpssearch.pas"/> <Filename Value="common\xlsbiff8.pas"/>
<UnitName Value="fpsSearch"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="xlsbiff8"/>
</Item39> </Item39>
<Item40> <Item40>
<Filename Value="xlsxml.pas"/> <Filename Value="common\xlscommon.pas"/>
<UnitName Value="xlsxml"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="xlscommon"/>
</Item40> </Item40>
<Item41> <Item41>
<Filename Value="xlsconst.pas"/> <Filename Value="common\xlsconst.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="xlsconst"/> <UnitName Value="xlsconst"/>
</Item41> </Item41>
<Item42> <Item42>
<Filename Value="fps.inc"/> <Filename Value="common\xlsescher.pas"/>
<Type Value="Include"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="xlsEscher"/>
</Item42> </Item42>
<Item43> <Item43>
<Filename Value="fpscurrency.pas"/> <Filename Value="common\xlsxml.pas"/>
<UnitName Value="fpsCurrency"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="xlsxml"/>
</Item43> </Item43>
<Item44> <Item44>
<Filename Value="fpsregfileformats.pas"/> <Filename Value="common\xlsxooxml.pas"/>
<UnitName Value="fpsRegFileFormats"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="xlsxooxml"/>
</Item44> </Item44>
<Item45> <Item45>
<Filename Value="fpsimages.pas"/> <Filename Value="common\fpssearch.pas"/>
<UnitName Value="fpsImages"/> <UnitName Value="fpsSearch"/>
</Item45> </Item45>
</Files> </Files>
<i18n> <i18n>
<EnableI18N Value="True"/> <EnableI18N Value="True"/>
<OutDir Value="languages"/> <OutDir Value="..\languages"/>
<EnableI18NForLFM Value="True"/> <EnableI18NForLFM Value="True"/>
</i18n> </i18n>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">

View File

@ -9,8 +9,8 @@
<Version Value="11"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="."/> <OtherUnitFiles Value="visual"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="visual\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Other> <Other>
<CustomOptions Value="$(IDEBuildOptions)"/> <CustomOptions Value="$(IDEBuildOptions)"/>
@ -23,38 +23,37 @@ It provides graphical components like a grid and chart."/>
<Version Major="1" Minor="7"/> <Version Major="1" Minor="7"/>
<Files Count="5"> <Files Count="5">
<Item1> <Item1>
<Filename Value="fpspreadsheetctrls.pas"/> <Filename Value="visual\fpsactions.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fpspreadsheetctrls"/>
</Item1>
<Item2>
<Filename Value="fpspreadsheetgrid.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fpspreadsheetgrid"/>
</Item2>
<Item3>
<Filename Value="fpspreadsheetchart.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fpspreadsheetchart"/>
</Item3>
<Item4>
<Filename Value="fpsactions.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="fpsActions"/> <UnitName Value="fpsActions"/>
</Item1>
<Item2>
<Filename Value="visual\fpspreadsheetchart.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fpspreadsheetchart"/>
</Item2>
<Item3>
<Filename Value="visual\fpspreadsheetctrls.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fpspreadsheetctrls"/>
</Item3>
<Item4>
<Filename Value="visual\fpspreadsheetgrid.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fpspreadsheetgrid"/>
</Item4> </Item4>
<Item5> <Item5>
<Filename Value="fpsvisualutils.pas"/> <Filename Value="visual\fpsvisualutils.pas"/>
<UnitName Value="fpsvisualutils"/> <UnitName Value="fpsvisualutils"/>
</Item5> </Item5>
</Files> </Files>
<RequiredPkgs Count="4"> <RequiredPkgs Count="4">
<Item1> <Item1>
<PackageName Value="tachartlazaruspkg"/> <PackageName Value="laz_fpspreadsheet"/>
<MinVersion Major="1" Minor="7" Valid="True"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="laz_fpspreadsheet"/> <PackageName Value="tachartlazaruspkg"/>
<MaxVersion Major="1" Minor="5"/>
<MinVersion Major="1" Minor="5"/>
</Item2> </Item2>
<Item3> <Item3>
<PackageName Value="LCL"/> <PackageName Value="LCL"/>

View File

@ -9,8 +9,8 @@
<Version Value="11"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="."/> <OtherUnitFiles Value="export"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="export\lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>
@ -28,11 +28,11 @@ It provides a graphical export component on the Data Export tab."/>
<Version Major="1" Minor="7"/> <Version Major="1" Minor="7"/>
<Files Count="2"> <Files Count="2">
<Item1> <Item1>
<Filename Value="fpsexport.pas"/> <Filename Value="export\fpsexport.pas"/>
<UnitName Value="fpsexport"/> <UnitName Value="fpsexport"/>
</Item1> </Item1>
<Item2> <Item2>
<Filename Value="fpsexportreg.pas"/> <Filename Value="export\fpsexportreg.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="fpsexportreg"/> <UnitName Value="fpsexportreg"/>
</Item2> </Item2>

Some files were not shown because too many files have changed in this diff Show More