FPSpreadsheet: Adds a reader method which guesses the format from the extension.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1642 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
038d224034
commit
7f8e1edddb
@ -9,11 +9,11 @@
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<UseDefaultCompilerOptions Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
<ActiveWindowIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<i18n>
|
||||
<EnableI18N LFM="False"/>
|
||||
@ -21,7 +21,7 @@
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1" Active="Default">
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
@ -39,124 +39,13 @@
|
||||
<PackageName Value="laz_fpspreadsheet"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="4">
|
||||
<Units Count="1">
|
||||
<Unit0>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="excel8write_format"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="31"/>
|
||||
<CursorPos X="12" Y="44"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<UnitName Value="fpspreadsheet"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="93"/>
|
||||
<CursorPos X="1" Y="105"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\..\..\..\lazarus29\fpc\2.4.3\source\packages\fcl-image\src\fpimage.pp"/>
|
||||
<UnitName Value="FPimage"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="10"/>
|
||||
<CursorPos X="3" Y="30"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<UnitName Value="xlsbiff8"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="758"/>
|
||||
<CursorPos X="61" Y="766"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
<JumpHistory Count="18" HistoryIndex="17">
|
||||
<Position1>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="29" Column="1" TopLine="9"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="35" Column="23" TopLine="20"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="15" Column="25" TopLine="2"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="160" Column="78" TopLine="146"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="122" Column="25" TopLine="116"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="132" Column="25" TopLine="114"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="131" Column="10" TopLine="106"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="132" Column="24" TopLine="112"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="17" Column="35" TopLine="3"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\..\fpspreadsheet.pas"/>
|
||||
<Caret Line="132" Column="25" TopLine="111"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="15" Column="25" TopLine="5"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="47" Column="25" TopLine="33"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<Caret Line="941" Column="11" TopLine="926"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<Caret Line="125" Column="17" TopLine="116"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="..\..\xlsbiff8.pas"/>
|
||||
<Caret Line="933" Column="61" TopLine="924"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="57" Column="29" TopLine="36"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="28" Column="54" TopLine="14"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="excel8write_format.pas"/>
|
||||
<Caret Line="41" Column="14" TopLine="28"/>
|
||||
</Position18>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="10"/>
|
||||
|
@ -190,7 +190,8 @@ type
|
||||
destructor Destroy; override;
|
||||
function CreateSpreadReader(AFormat: TsSpreadsheetFormat): TsCustomSpreadReader;
|
||||
function CreateSpreadWriter(AFormat: TsSpreadsheetFormat): TsCustomSpreadWriter;
|
||||
procedure ReadFromFile(AFileName: string; AFormat: TsSpreadsheetFormat);
|
||||
procedure ReadFromFile(AFileName: string; AFormat: TsSpreadsheetFormat); overload;
|
||||
procedure ReadFromFile(AFileName: string); overload;
|
||||
procedure ReadFromStream(AStream: TStream; AFormat: TsSpreadsheetFormat);
|
||||
procedure WriteToFile(const AFileName: string;
|
||||
const AFormat: TsSpreadsheetFormat;
|
||||
@ -777,6 +778,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{@@
|
||||
Reads the document from a file. This method will try to guess the format from
|
||||
the extension. In the case of the ambiguous xls extension, it will simply
|
||||
assume that it is BIFF8. Note that it could be BIFF2, 3, 4 or 5 too.
|
||||
}
|
||||
procedure TsWorkbook.ReadFromFile(AFileName: string);
|
||||
var
|
||||
Str: String;
|
||||
begin
|
||||
Str := ExtractFileExt(AFileName);
|
||||
if Str = STR_EXCEL_EXTENSION then ReadFromFile(AFileName, sfExcel8)
|
||||
else if Str = STR_OOXML_EXCEL_EXTENSION then ReadFromFile(AFileName, sfOOXML)
|
||||
else if Str = STR_OPENDOCUMENT_CALC_EXTENSION then ReadFromFile(AFileName, sfOpenDocument);
|
||||
end;
|
||||
|
||||
{@@
|
||||
Reads the document from a seekable stream.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user