FPSpreadsheet: Add pagelayout demo

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9508 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-11-30 17:02:29 +00:00
parent 43f8e27ce2
commit 56a27ca99b
5 changed files with 113 additions and 0 deletions

View File

@ -103,6 +103,11 @@
<Mode Name="Default"/>
</BuildModes>
</Target>
<Target FileName="pagelayout\demo_pagelayout.lpi">
<BuildModes>
<Mode Name="Default"/>
</BuildModes>
</Target>
</Targets>
</ProjectGroup>
</CONFIG>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<Title Value="demo_pagelayout"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<RequiredPackages>
<Item>
<PackageName Value="laz_fpspreadsheet"/>
</Item>
</RequiredPackages>
<Units>
<Unit>
<Filename Value="demo_pagelayout.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo_pagelayout"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</Debugging>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,34 @@
program demo_pagelayout;
uses
SysUtils, FPSpreadSheet, FPSTypes, FPSAllFormats;
var
workbook: TsWorkbook;
worksheet: TsWorksheet;
begin
WriteLn('Creating a worksheet with pagelayout for printing and print preview...');
workbook := TsWorkbook.Create;
try
worksheet := workbook.AddWorksheet('test');
worksheet.WriteText(0, 0, 'left/top');
worksheet.WriteText(1, 1, 'center');
worksheet.WriteText(2, 2, 'right/bottom');
worksheet.PageLayout.Orientation := spoLandscape;
worksheet.PageLayout.Options := worksheet.Pagelayout.Options + [poHorCentered, poVertCentered, poPrintGridLines, poPrintHeaders];
workbook.WriteToFile('test5.xls', sfExcel5, true);
workbook.WriteToFile('test8.xls', sfExcel8, true);
workbook.WriteToFile('test.xlsx', true);
workbook.WriteToFile('test.ods', true);
finally
workbook.Free;
end;
if ParamCount = 0 then
begin
{$IFDEF MSWINDOWS}
WriteLn('Press [ENTER] to quit...');
ReadLn;
{$ENDIF}
end;
end.

View File

@ -20,6 +20,11 @@ This folder contains various demo applications:
- images/demo_write_images: shows how to create workbooks/worksheets with
embedded images.
- pagelayout/demo_pagelayout: show a few cases how the page layout can be
configured for printing and print preview. After loading the created file into
Excel or Calc switch to the print preview to see the effect of the selected
parameters.
- protection/demo_protection: demonstrates cell and sheet protection
supported by FPSpreadsheet.

View File

@ -9,6 +9,7 @@ hyperlinkdemo\collectlinks -quit
ignore_formulas\demo_ignore_formula -quit
images\demo_write_images -quit
metadata\demo_metadata -quit
pagelayout\demo_pagelayout -quit
protection\demo_protection -quit
recursive_calculation\demo_recursive_calc -quit
richtext\demo_richtext_utf8 -quit