FPSpreadsheet: Check/update all read/write sample projects

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9427 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-09-05 10:11:03 +00:00
parent 24b215f8be
commit fc509d130b
18 changed files with 55 additions and 61 deletions

View File

@ -63,6 +63,7 @@
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>

View File

@ -261,7 +261,7 @@ begin
MyWorksheet.WriteFontColor(r, 2, scGray);
inc(r, 2);
number := 1.333333333;
MyWorksheet.WriteUTF8Text(r, 0, 'nfPercentage, 0 decs');
MyWorksheet.WriteText(r, 0, 'nfPercentage, 0 decs');
MyWorksheet.WriteNumber(r, 1, number, nfPercentage, 0);
inc(r);
MyWorksheet.WriteText(r, 0, 'nfPercentage, 1 decs');
@ -305,8 +305,10 @@ begin
// Set height of rows 5 and 6
lRow.Height := 4; // 4 lines
lRow.RowHeightType := rhtCustom;
MyWorksheet.WriteRowInfo(5, lRow);
lRow.Height := 2; // 2 lines
lRow.RowHeightType := rhtCustom;
MyWorksheet.WriteRowInfo(6, lRow);
CSVParams.Delimiter := #9;

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="excel2read"/>
<UseAppBundle Value="False"/>
</General>
@ -17,19 +17,16 @@
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default">
<local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</Mode0>
</Modes>
@ -64,6 +61,7 @@
</Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>

View File

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

View File

@ -352,15 +352,16 @@ begin
// Set width of columns 0 to 3
MyWorksheet.WriteColWidth(0, 10, suCentimeters); // 10 cm
lCol.Width := 40; // WriteColInfo uses workbook units, i.e. mm
lCol.ColWidthType := cwtCustom;
MyWorksheet.WriteColInfo(1, lCol);
MyWorksheet.WriteColInfo(2, lCol);
MyWorksheet.WriteColInfo(3, lCol);
MyWorksheet.WriteColInfo(4, lCol);
MyWorksheet.WriteColWidth(5, 6); // default is characters: 6 characters
MyWorksheet.WriteColWidth(5, 6, suChars); // 6 default-font characters wide
// Set height of rows 5 and 6
MyWorksheet.WriteRowHeight(5, 4, suLines); // Lines
MyWorksheet.WriteRowHeight(6, 2); // Lines is default...
MyWorksheet.WriteRowHeight(6, 2, suLines);
// Save the spreadsheet to a file
MyWorkbook.WriteToFile(MyDir + 'test' + STR_EXCEL_EXTENSION, sfExcel2, true);

View File

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

View File

@ -23,7 +23,7 @@ const
var
MyWorkbook: TsWorkbook;
MyWorksheet: TsWorksheet;
MyRPNFormula: TsRPNFormula;
MyRPNFormula: TsRPNFormula = nil;
MyDir: string;
i, r: Integer;
number: Double;
@ -48,14 +48,14 @@ begin
MyWorkbook.AddFont('Calibri', 20, [], scRed);
// Change row height
MyWorksheet.WriteRowHeight(0, 3); // modify height of row 0 to 3 lines
MyWorksheet.WriteRowHeight(0, 3, suLines); // modify height of row 0 to 3 lines
// Change colum widths
MyWorksheet.WriteColWidth(0, 40); // characters
MyWorksheet.WriteColWidth(1, 20);
MyWorksheet.WriteColWidth(2, 20);
MyWorksheet.WriteColWidth(3, 15);
MyWorksheet.WriteColWidth(4, 15);
MyWorksheet.WriteColWidth(0, 40, suChars); // characters
MyWorksheet.WriteColWidth(1, 30, suChars);
MyWorksheet.WriteColWidth(2, 20, suChars);
MyWorksheet.WriteColWidth(3, 15, suChars);
MyWorksheet.WriteColWidth(4, 15, suChars);
// Write some cells
MyWorksheet.WriteNumber(0, 0, 1.0);// A1
@ -65,6 +65,7 @@ begin
MyWorksheet.WriteNumber(0, 2, 3.0);// C1
MyWorksheet.WriteNumber(0, 3, 4.0);// D1
MyWorksheet.WriteRowHeight(4, 1, suLines, rhtAuto);
MyWorksheet.WriteText(4, 2, Str_Total);// C5
MyWorksheet.WriteBorders(4, 2, [cbEast, cbNorth, cbWest, cbSouth]);
myWorksheet.WriteFontColor(4, 2, scRed);
@ -74,7 +75,7 @@ begin
MyWorksheet.WriteNumber(4, 3, 10); // D5
MyWorksheet.WriteText(4, 4, 'This is a long wrapped text.');
MyWorksheet.WriteUsedFormatting(4, 4, [uffWordWrap]);
MyWorksheet.WriteUsedFormatting(4, 4, [uffWordWrap]); // or: MyWorksheet.WriteWordWrap(4, 4, true);
MyWorksheet.WriteHorAlignment(4, 4, haCenter);
MyWorksheet.WriteText(4, 5, 'Stacked text');
@ -108,6 +109,7 @@ begin
// Write current date/time
MyWorksheet.WriteDateTime(5, 0, now);
MyWorksheet.WriteFont(5, 0, 'Courier New', 20, [fssBold, fssItalic, fssUnderline], scBlue);
MyWorksheet.WriteRowHeight(5, 1, suLines, rhtAuto);
// F6 empty cell, only all thin borders
MyWorksheet.WriteBorders(5, 5, [cbNorth, cbEast, cbSouth, cbWest]);
@ -130,17 +132,6 @@ begin
MyWorksheet.WriteBorderLineStyle(5, 9, cbWest, lsThick);
MyWorksheet.WriteBorderLineStyle(5, 9, cbNorth, lsThick);
{ Uncomment this to test large XLS files
for i := 2 to 20 do
begin
MyWorksheet.WriteAnsiText(i, 0, ParamStr(0));
MyWorksheet.WriteAnsiText(i, 1, ParamStr(0));
MyWorksheet.WriteAnsiText(i, 2, ParamStr(0));
MyWorksheet.WriteAnsiText(i, 3, ParamStr(0));
end;
}
// Write the formula E1 = A1 + B1 as rpn roken array
SetLength(MyRPNFormula, 3);
MyRPNFormula[0].ElementKind := fekCell;

View File

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

View File

@ -59,6 +59,7 @@
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>

View File

@ -74,6 +74,9 @@ begin
MyWorksheet.WriteFontSize(5, 3, 12);
// or: MyWorksheet.WriteFont(5, 3, 'Arial', 12, [], scWhite);
// Auto-row-height for row 5
MyWorksheet.WriteRowHeight(5, 1, suLines, rhtAuto);
// E6 empty cell, only background color
MyWorksheet.WriteBackgroundColor(5, 4, scYellow);
@ -124,13 +127,15 @@ begin
MyWorksheet.WriteBorders(5, 14, [cbWest]);
MyWorksheet.WriteBorderLineStyle(5, 14, cbWest, lsDouble);
// Word-wrapped long text in D7
// Word-wrapped long text in D7, auto-row-height in this row
MyWorksheet.WriteText(6, 3, 'This is a very, very, very, very long wrapped text.');
MyWorksheet.WriteUsedFormatting(6, 3, [uffWordwrap]);
MyWorksheet.WriteRowHeight(6, 1, suLines, rhtAuto);
// Cell with changed font in D8
// Cell with changed font in D8, auto-row-height
MyWorksheet.WriteText(7, 3, 'This is 16pt red bold & italic Times New Roman.');
Myworksheet.WriteFont(7, 3, 'Times New Roman', 16, [fssBold, fssItalic], scRed);
MyWorksheet.WriteRowHeight(7, 1, suLines, rhtAuto);
// Cell with changed font and background in D9 and comment
MyWorksheet.WriteText(8, 3, 'Colors...');
@ -138,18 +143,6 @@ begin
MyWorksheet.WriteBackgroundColor(8, 3, scYellow);
// MyWorksheet.WriteComment(8, 3, 'This is font "Courier New", Size 12.');
{}
{
// Uncomment this to test large XLS files
for i := 50 to 1000 do
begin
// MyWorksheet.WriteUTF8Text(i, 0, ParamStr(0));
// MyWorksheet.WriteUTF8Text(i, 1, ParamStr(0));
// MyWorksheet.WriteUTF8Text(i, 2, ParamStr(0));
MyWorksheet.WriteUTF8Text(i, 3, ParamStr(0));
end;
}
// Write the string formula E1 = A1 + B1 ...
MyWorksheet.WriteFormula(0, 4, 'A1+B1');
// ... and the rpn formula E2 = A1 + B1
@ -372,12 +365,14 @@ begin
// Set width of columns 0, 1 and 5
MyWorksheet.WriteColWidth(0, 30);
lCol.Width := 25;
lCol.Width := 60; // millimeters
lCol.ColWidthType := cwtCustom;
MyWorksheet.WriteColInfo(1, lCol);
MyWorksheet.WriteColWidth(2, 15);
MyWorksheet.WriteColWidth(3, 15);
MyWorksheet.WriteColWidth(4, 15);
lCol.Width := 5;
MyWorksheet.WriteColWidth(2, 15, suChars);
MyWorksheet.WriteColWidth(3, 15, suChars);
MyWorksheet.WriteColWidth(4, 15, suChars);
lCol.Width := 10; // millimeters
lCol.ColWidthType := cwtCustom;
MyWorksheet.WriteColInfo(5, lCol);
// Set height of rows 0

View File

@ -59,6 +59,7 @@
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>

View File

@ -374,10 +374,13 @@ begin
MyWorksheet.WriteColWidth(3, 15, suChars);
MyWorksheet.WriteColWidth(4, 15, suChars);
lCol.Width := 12; // mm
lCol.ColWidthType := cwtCustom;
MyWorksheet.WriteColInfo(5, lCol);
// Set height of rows 0
// Set row heights
MyWorksheet.WriteRowHeight(0, 5, suLines); // 5 lines
for i := 5 to 9 do
MyWorksheet.WriteRowHeight(i, 1, suLines, rhtAuto); // automatic row height
//----------------------------------------------------------------------------

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="htmlwrite"/>
<UseAppBundle Value="False"/>
</General>
@ -17,19 +17,16 @@
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default">
<local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</Mode0>
</Modes>
@ -64,6 +61,7 @@
</Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>

View File

@ -10,7 +10,7 @@ program ooxmlread;
{$mode delphi}{$H+}
uses
Classes, SysUtils, LazUTF8, fpstypes, fpspreadsheet, xlsxooxml; //fpsallformats;
Classes, SysUtils, LazUTF8, fpstypes, fpspreadsheet, xlsxooxml;
var
MyWorkbook: TsWorkbook;

View File

@ -10,7 +10,7 @@ program ooxmlwrite;
{$mode delphi}{$H+}
uses
Classes, SysUtils, fpstypes, fpspreadsheet, fpsallformats, fpscell;
Classes, SysUtils, fpstypes, fpspreadsheet, xlsxOOXML, fpscell;
var
MyWorkbook: TsWorkbook;

View File

@ -16,8 +16,7 @@ program ooxml_decrypt_and_read;
{$mode delphi}{$H+}
uses
Classes, SysUtils, LazUTF8, fpstypes, fpspreadsheet, //laz_fpspreadsheet,
xlsxooxml_crypto;
Classes, SysUtils, LazUTF8, fpstypes, fpspreadsheet, xlsxooxml_crypto;
var
MyWorkbook: TsWorkbook;

View File

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

View File

@ -10,7 +10,7 @@ program opendocwrite;
{$mode delphi}{$H+}
uses
Classes, SysUtils, fpstypes, fpspreadsheet, fpsallformats;
Classes, SysUtils, fpstypes, fpspreadsheet, fpsOpenDocument;
var
MyWorkbook: TsWorkbook;