fpspreadsheet: xlsx reads images in header/footer

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8333 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-07-01 20:36:06 +00:00
parent 2ceb5949ee
commit 105099f338
4 changed files with 261 additions and 113 deletions

View File

@@ -64,6 +64,7 @@
</Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>

View File

@@ -20,6 +20,24 @@ const
begin
Writeln('Starting program "demo_write_headerfooter_images"...');
if not FileExists(image1) then
begin
WriteLn(ExpandFilename(image1) + ' not found.');
Halt;
end;
if not FileExists(image2) then
begin
WriteLn(ExpandFilename(image2) + ' not found.');
Halt;
end;
if not FileExists(image3) then
begin
WriteLn(ExpandFilename(image3) + ' not found.');
Halt;
end;
// Create the spreadsheet
MyWorkbook := TsWorkbook.Create;
try

View File

@@ -7,6 +7,9 @@ program demo_read_images;
uses
SysUtils, fpspreadsheet, fpstypes, fpsutils, fpsimages, xlsxooxml, fpsopendocument;
const
FILE_NAME = 'img';
var
workbook: TsWorkbook;
worksheet: TsWorksheet;
@@ -24,10 +27,10 @@ begin
// Read spreadsheet file
myDir := ExtractFilePath(ParamStr(0));
{$IFDEF USE_XLSX}
workbook.ReadFromFile(myDir + 'img.xlsx', sfOOXML);
workbook.ReadFromFile(myDir + FILE_NAME + '.xlsx', sfOOXML);
{$ENDIF}
{$IFDEF USE_OPENDOCUMENT}
workbook.ReadFromFile(myDir + 'img.ods', sfOpenDocument);
workbook.ReadFromFile(myDir + FILE_NAME + '.ods', sfOpenDocument);
{$ENDIF}
// Get worksheets
@@ -48,7 +51,8 @@ begin
', ScaleX=', img^.ScaleX:0:2,
', ScaleY=', img^.ScaleY:0:2
);
embobj.Stream.SaveToFile(ExtractFileName(embobj.FileName));
if embObj.FileName <> '' then
embobj.Stream.SaveToFile(ExtractFileName(embobj.FileName));
end;
end;
WriteLn('Finished.');