You've already forked lazarus-ccr
fpspreadsheet: restructure examples/other folder.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7494 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -8,14 +8,15 @@
|
|||||||
<MainUnitHasCreateFormStatements Value="False"/>
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
<MainUnitHasTitleStatement Value="False"/>
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
<MainUnitHasScaledStatement Value="False"/>
|
<MainUnitHasScaledStatement Value="False"/>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<Title Value="demo_conditional_formatting"/>
|
<Title Value="demo_conditional_formatting"/>
|
||||||
<UseAppBundle Value="False"/>
|
<UseAppBundle Value="False"/>
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
</General>
|
</General>
|
||||||
<BuildModes>
|
<BuildModes Count="1">
|
||||||
<Item Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
</BuildModes>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
@ -24,16 +25,16 @@
|
|||||||
<RunParams>
|
<RunParams>
|
||||||
<FormatVersion Value="2"/>
|
<FormatVersion Value="2"/>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages>
|
<RequiredPackages Count="1">
|
||||||
<Item>
|
<Item1>
|
||||||
<PackageName Value="laz_fpspreadsheet"/>
|
<PackageName Value="laz_fpspreadsheet"/>
|
||||||
</Item>
|
</Item1>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units>
|
<Units Count="1">
|
||||||
<Unit>
|
<Unit0>
|
||||||
<Filename Value="demo_conditional_formatting.pas"/>
|
<Filename Value="demo_conditional_formatting.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit>
|
</Unit0>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
@ -48,16 +49,16 @@
|
|||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions>
|
<Exceptions Count="3">
|
||||||
<Item>
|
<Item1>
|
||||||
<Name Value="EAbort"/>
|
<Name Value="EAbort"/>
|
||||||
</Item>
|
</Item1>
|
||||||
<Item>
|
<Item2>
|
||||||
<Name Value="ECodetoolError"/>
|
<Name Value="ECodetoolError"/>
|
||||||
</Item>
|
</Item2>
|
||||||
<Item>
|
<Item3>
|
||||||
<Name Value="EFOpenError"/>
|
<Name Value="EFOpenError"/>
|
||||||
</Item>
|
</Item3>
|
||||||
</Exceptions>
|
</Exceptions>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
@ -28,7 +28,7 @@ begin
|
|||||||
// ... set the borders
|
// ... set the borders
|
||||||
fmt.SetBorders([cbNorth, cbEast, cbWest], scBlack, lsThin);
|
fmt.SetBorders([cbNorth, cbEast, cbWest], scBlack, lsThin);
|
||||||
fmt.SetBorders([cbSouth], scRed, lsThick);
|
fmt.SetBorders([cbSouth], scRed, lsThick);
|
||||||
// ... set the font (bold) ---- NOT SUPPORTED AT THE MOMENT...
|
// ... set the font (bold) ---- NOT SUPPORTED AT THE MOMENT FOR WRITING TO XLSX...
|
||||||
font := wb.CloneFont(0);
|
font := wb.CloneFont(0);
|
||||||
font.Style := [fssBold, fssItalic];
|
font.Style := [fssBold, fssItalic];
|
||||||
font.Color := scRed;
|
font.Color := scRed;
|
||||||
|
@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<MainUnitHasScaledStatement Value="False"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="demo_protection"/>
|
||||||
|
<UseAppBundle Value="False"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
</General>
|
||||||
|
<BuildModes Count="1">
|
||||||
|
<Item1 Name="Default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
<Modes Count="0"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="1">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="laz_fpspreadsheet"/>
|
||||||
|
</Item1>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="1">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="demo_protection.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="demo_protection"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<UseExternalDbgSyms Value="True"/>
|
||||||
|
</Debugging>
|
||||||
|
</Linking>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item3>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
@ -0,0 +1,53 @@
|
|||||||
|
program demo_protection;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils,
|
||||||
|
fpstypes, fpspreadsheet, fpsallformats, fpsutils, fpscrypto;
|
||||||
|
|
||||||
|
const
|
||||||
|
PASSWORD = 'lazarus';
|
||||||
|
|
||||||
|
var
|
||||||
|
book: TsWorkbook;
|
||||||
|
sheet: TsWorksheet;
|
||||||
|
cell: PCell;
|
||||||
|
c: TsCryptoInfo;
|
||||||
|
begin
|
||||||
|
book := TsWorkbook.Create;
|
||||||
|
try
|
||||||
|
sheet := book.AddWorksheet('Sheet1');
|
||||||
|
|
||||||
|
// Add an unprotected cell
|
||||||
|
cell := sheet.WriteText(0, 0, 'Unprotected cell');
|
||||||
|
sheet.WriteCellProtection(cell, []);
|
||||||
|
|
||||||
|
// Add a protected cell
|
||||||
|
sheet.WriteText(1, 0, 'Protected cell');
|
||||||
|
|
||||||
|
// Activate worksheet protection such that a password is required to
|
||||||
|
// change the protection state
|
||||||
|
InitCryptoInfo(c);
|
||||||
|
c.Algorithm := caExcel;
|
||||||
|
c.PasswordHash := Format('%.4x', [ExcelPasswordHash(PASSWORD)]);
|
||||||
|
sheet.CryptoInfo := c;
|
||||||
|
sheet.Protection := [spDeleteRows, spDeleteColumns, spInsertRows, spInsertColumns];
|
||||||
|
sheet.Protect(true);
|
||||||
|
|
||||||
|
book.WriteToFile('protected.xls', sfExcel8, true);
|
||||||
|
book.WriteToFile('protected.xlsx', sfOOXML, true);
|
||||||
|
// Note ODS does not write the excel password correctly, yet. --> protection cannot be removed.
|
||||||
|
book.WriteToFile('protected.ods', sfOpenDocument, true);
|
||||||
|
|
||||||
|
finally
|
||||||
|
book.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
WriteLn('Open the files "protected.*" in your spreadsheet application.');
|
||||||
|
WriteLn('Only cell A1 can be modifed.');
|
||||||
|
WriteLn('Press [ENTER] to quit...');
|
||||||
|
ReadLn;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -1,27 +1,47 @@
|
|||||||
This folder contains various demo applications:
|
This folder contains various demo applications:
|
||||||
|
|
||||||
- demo_formula_func: shows how a user-provided function can be registered in
|
- cell_formats/formatting/demo_write_formatting: shows some simple cell formatting
|
||||||
fpspreadsheet for usage in rpn formulas. The example covers some financial
|
|
||||||
functions.
|
|
||||||
|
|
||||||
- demo_recursive_calc: demonstrates recursive calculation of formulas. All
|
|
||||||
formulas in this demo depend on the result of the formula in the next cell,
|
|
||||||
except for the last cell. When the formula in the first cell is calculated
|
|
||||||
recursive calculation of the other cells is requested.
|
|
||||||
|
|
||||||
- demo_virtualmode_writing: demonstrates how the virtual mode of the workbook
|
|
||||||
can be used to create huge spreadsheet files.
|
|
||||||
|
|
||||||
- demo_virtualmode_reading: demonstrates how the virtual mode of the workbook
|
|
||||||
can be used to read huge spreadsheet files. Requires the file written by
|
|
||||||
demo_virtualmode_writing.
|
|
||||||
|
|
||||||
- demo_write_colors: show the colors of the Excel8 color palette
|
- colors/demo_write_colors: shows the colors of the Excel8 color palette
|
||||||
|
|
||||||
- demo_write_formatting: shows some simple cell formatting
|
- conditional_formatting/demo_conditional_formatting: demonstrates how
|
||||||
|
a cell range can be formatted depending on the cell content ("conditional
|
||||||
|
formatting").
|
||||||
|
|
||||||
- demo_write_formula: shows some rpn formulas
|
- expression_parser_demo_expression_parser: shows how the formula engine of
|
||||||
|
FPSpreadsheet is used.
|
||||||
|
|
||||||
|
- header_footer_images/demo_write_headerfooter_images: adds images to
|
||||||
|
worksheet headers and footers
|
||||||
|
|
||||||
|
- images/demo_write_images: shows how to create workbooks/worksheets with
|
||||||
|
embedded images.
|
||||||
|
|
||||||
- demo_write_images: adds images to worksheets
|
- protection/demo_protection: demonstrates cell and sheet protection
|
||||||
|
supported by FPSpreadsheet.
|
||||||
|
|
||||||
- demo_write_headerfooter_images: adds images to worksheet headers and footers
|
- recursive_calculation/demo_recursive_calc: demonstrates recursive
|
||||||
|
calculation of formulas. All formulas in this demo depend on the result
|
||||||
|
of the formula in the next cell, except for the last cell. When the formula
|
||||||
|
in the first cell is calculated recursive calculation of the other cells
|
||||||
|
is requested.
|
||||||
|
|
||||||
|
- rpn_formulas/demo_write_formula: shows some rpn formulas
|
||||||
|
|
||||||
|
- searching/demo_search: demonstrates how specific cell content can be
|
||||||
|
searched within a worksheet
|
||||||
|
|
||||||
|
- sorting/demo_sorting: shows how cell ranges can be sorted within FPSpreadsheet
|
||||||
|
|
||||||
|
- user_defined_formulas/demo_formula_func: shows how a user-provided function
|
||||||
|
can be registered in fpspreadsheet for usage in rpn formulas. The example
|
||||||
|
covers some financial functions.
|
||||||
|
|
||||||
|
- virtual_mode/demo_virtualmode_writing: demonstrates how the virtual mode
|
||||||
|
of the workbook can be used to create huge spreadsheet files.
|
||||||
|
|
||||||
|
- virtual_mode/demo_virtualmode_reading: demonstrates how the virtual mode
|
||||||
|
of the workbook can be used to read huge spreadsheet files. Requires the
|
||||||
|
file written by demo_virtualmode_writing.
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user