fpspreadsheet: Update sample projects

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2973 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-04-25 22:50:29 +00:00
parent adf4df6ea1
commit 712e5fb61b
3 changed files with 57 additions and 26 deletions

View File

@@ -1,22 +1,23 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="7"/>
<General> <General>
<Flags> <Flags>
<AlwaysBuild Value="False"/>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=".exe"/>
<Title Value="excel5write"/> <Title Value="excel5write"/>
<UseAppBundle Value="False"/> <UseAppBundle Value="False"/>
</General> </General>
<VersionInfo> <VersionInfo>
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
<IgnoreBinaries Value="False"/> <IgnoreBinaries Value="False"/>
@@ -43,12 +44,17 @@
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="8"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<SearchPaths> <SearchPaths>
<OtherUnitFiles Value="..\"/> <OtherUnitFiles Value=".."/>
<SrcPath Value="..\"/> <SrcPath Value=".."/>
</SearchPaths> </SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other> <Other>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>
</Other> </Other>

View File

@@ -33,16 +33,41 @@ begin
MyWorkbook := TsWorkbook.Create; MyWorkbook := TsWorkbook.Create;
MyWorksheet := MyWorkbook.AddWorksheet(Str_Worksheet1); MyWorksheet := MyWorkbook.AddWorksheet(Str_Worksheet1);
MyWorkbook.AddFont('Calibri', 20, [], scRed);
// Write some cells // Write some cells
MyWorksheet.WriteNumber(0, 0, 1.0);// A1 MyWorksheet.WriteNumber(0, 0, 1.0);// A1
MyWorksheet.WriteUsedFormatting(0, 0, [uffBold]);
MyWorksheet.WriteBackgroundColor(0, 0, scRed);
MyWorksheet.WriteNumber(0, 1, 2.0);// B1 MyWorksheet.WriteNumber(0, 1, 2.0);// B1
MyWorksheet.WriteNumber(0, 2, 3.0);// C1 MyWorksheet.WriteNumber(0, 2, 3.0);// C1
MyWorksheet.WriteNumber(0, 3, 4.0);// D1 MyWorksheet.WriteNumber(0, 3, 4.0);// D1
MyWorksheet.WriteUTF8Text(4, 2, Str_Total);// C5 MyWorksheet.WriteUTF8Text(4, 2, Str_Total);// C5
MyWorksheet.WriteBorders(4, 2, [cbEast, cbNorth, cbWest, cbSouth]);
myWorksheet.WriteFontColor(4, 2, scRed);
MyWorksheet.WriteBackgroundColor(4, 2, scSilver);
MyWorksheet.WriteVertAlignment(4, 2, vaTop);
MyWorksheet.WriteNumber(4, 3, 10); // D5 MyWorksheet.WriteNumber(4, 3, 10); // D5
MyWorksheet.WriteUTF8Text(4, 4, 'This is a long wrapped text.');
MyWorksheet.WriteUsedFormatting(4, 4, [uffWordWrap]);
MyWorksheet.WriteHorAlignment(4, 4, haCenter);
MyWorksheet.WriteUTF8Text(4, 5, 'Stacked text');
MyWorksheet.WriteTextRotation(4, 5, rtStacked);
MyWorksheet.WriteUTF8Text(4, 5, 'Rotated text');
MyWorksheet.WriteTextRotation(4, 5, rt90DegreeClockwiseRotation);
MyWorksheet.WriteUTF8Text(4, 6, 'Rotated text');
MyWorksheet.WriteTextRotation(4, 5, rt90DegreeCounterClockwiseRotation);
// Write current date/time // Write current date/time
MyWorksheet.WriteDateTime(5, 0, now); MyWorksheet.WriteDateTime(5, 0, now);
MyWorksheet.WriteFont(5, 0, 'Courier New', 20, [fssBold, fssItalic, fssUnderline], scBlue);
{ Uncomment this to test large XLS files { Uncomment this to test large XLS files
for i := 2 to 20 do for i := 2 to 20 do
@@ -84,6 +109,14 @@ begin
MyWorksheet.WriteUTF8Text(0, 2, Str_Third); MyWorksheet.WriteUTF8Text(0, 2, Str_Third);
MyWorksheet.WriteUTF8Text(0, 3, Str_Fourth); MyWorksheet.WriteUTF8Text(0, 3, Str_Fourth);
// Creates a new worksheet
MyWorksheet := MyWorkbook.AddWorksheet('Colors');
for i:=0 to MyWorkbook.GetPaletteSize-1 do begin
MyWorksheet.WriteBlank(i, 0);
Myworksheet.WriteBackgroundColor(i, 0, TsColor(i));
MyWorksheet.WriteUTF8Text(i, 1, MyWorkbook.GetColorName(i));
end;
// Save the spreadsheet to a file // Save the spreadsheet to a file
MyWorkbook.WriteToFile(MyDir + 'test.xls', sfExcel5, true); MyWorkbook.WriteToFile(MyDir + 'test.xls', sfExcel5, true);
MyWorkbook.Free; MyWorkbook.Free;

View File

@@ -113,10 +113,11 @@
<Filename Value="fpsgrid.lpr"/> <Filename Value="fpsgrid.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="fpsgrid"/> <UnitName Value="fpsgrid"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="3" Y="2"/> <CursorPos X="16" Y="7"/>
<UsageCount Value="120"/> <UsageCount Value="120"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
@@ -138,7 +139,7 @@
<Unit2> <Unit2>
<Filename Value="..\..\fpspreadsheet.pas"/> <Filename Value="..\..\fpspreadsheet.pas"/>
<UnitName Value="fpspreadsheet"/> <UnitName Value="fpspreadsheet"/>
<EditorIndex Value="5"/> <EditorIndex Value="4"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="2720"/> <TopLine Value="2720"/>
<CursorPos X="49" Y="2742"/> <CursorPos X="49" Y="2742"/>
@@ -151,11 +152,10 @@
<Unit3> <Unit3>
<Filename Value="..\..\fpspreadsheetgrid.pas"/> <Filename Value="..\..\fpspreadsheetgrid.pas"/>
<UnitName Value="fpspreadsheetgrid"/> <UnitName Value="fpspreadsheetgrid"/>
<IsVisibleTab Value="True"/> <EditorIndex Value="3"/>
<EditorIndex Value="4"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="257"/> <TopLine Value="257"/>
<CursorPos X="36" Y="273"/> <CursorPos X="34" Y="260"/>
<UsageCount Value="60"/> <UsageCount Value="60"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit3> </Unit3>
@@ -217,12 +217,10 @@
<Unit11> <Unit11>
<Filename Value="..\..\fpsopendocument.pas"/> <Filename Value="..\..\fpsopendocument.pas"/>
<UnitName Value="fpsopendocument"/> <UnitName Value="fpsopendocument"/>
<EditorIndex Value="6"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<UsageCount Value="15"/> <UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="d:\lazarus-svn\lcl\grids.pas"/> <Filename Value="d:\lazarus-svn\lcl\grids.pas"/>
@@ -235,7 +233,7 @@
<Unit13> <Unit13>
<Filename Value="..\..\fpsutils.pas"/> <Filename Value="..\..\fpsutils.pas"/>
<UnitName Value="fpsutils"/> <UnitName Value="fpsutils"/>
<EditorIndex Value="3"/> <EditorIndex Value="2"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="35"/> <TopLine Value="35"/>
<CursorPos X="1" Y="62"/> <CursorPos X="1" Y="62"/>
@@ -252,26 +250,22 @@
<Unit15> <Unit15>
<Filename Value="d:\lazarus-svn\lcl\graphics.pp"/> <Filename Value="d:\lazarus-svn\lcl\graphics.pp"/>
<UnitName Value="Graphics"/> <UnitName Value="Graphics"/>
<EditorIndex Value="2"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="34"/> <TopLine Value="34"/>
<CursorPos X="1" Y="64"/> <CursorPos X="1" Y="64"/>
<UsageCount Value="27"/> <UsageCount Value="27"/>
<Loaded Value="True"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\classesh.inc"/> <Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\classesh.inc"/>
<EditorIndex Value="7"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="248"/> <TopLine Value="248"/>
<CursorPos X="22" Y="263"/> <CursorPos X="22" Y="263"/>
<UsageCount Value="19"/> <UsageCount Value="19"/>
<Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="..\..\xlsbiff8.pas"/> <Filename Value="..\..\xlsbiff8.pas"/>
<UnitName Value="xlsbiff8"/> <UnitName Value="xlsbiff8"/>
<EditorIndex Value="10"/> <EditorIndex Value="6"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="185"/> <TopLine Value="185"/>
<CursorPos X="1" Y="203"/> <CursorPos X="1" Y="203"/>
@@ -296,7 +290,7 @@
<Unit20> <Unit20>
<Filename Value="..\..\xlscommon.pas"/> <Filename Value="..\..\xlscommon.pas"/>
<UnitName Value="xlscommon"/> <UnitName Value="xlscommon"/>
<EditorIndex Value="9"/> <EditorIndex Value="5"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="493"/> <TopLine Value="493"/>
<CursorPos X="16" Y="514"/> <CursorPos X="16" Y="514"/>
@@ -306,7 +300,7 @@
<Unit21> <Unit21>
<Filename Value="..\..\xlsbiff5.pas"/> <Filename Value="..\..\xlsbiff5.pas"/>
<UnitName Value="xlsbiff5"/> <UnitName Value="xlsbiff5"/>
<EditorIndex Value="11"/> <EditorIndex Value="7"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="124"/> <TopLine Value="124"/>
<CursorPos X="38" Y="143"/> <CursorPos X="38" Y="143"/>
@@ -316,7 +310,7 @@
<Unit22> <Unit22>
<Filename Value="..\..\xlsbiff2.pas"/> <Filename Value="..\..\xlsbiff2.pas"/>
<UnitName Value="xlsbiff2"/> <UnitName Value="xlsbiff2"/>
<EditorIndex Value="12"/> <EditorIndex Value="8"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="82"/> <TopLine Value="82"/>
<CursorPos X="38" Y="101"/> <CursorPos X="38" Y="101"/>
@@ -349,12 +343,10 @@
</Unit25> </Unit25>
<Unit26> <Unit26>
<Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\lists.inc"/> <Filename Value="d:\lazarus-svn\fpc\2.6.2\source\rtl\objpas\classes\lists.inc"/>
<EditorIndex Value="8"/>
<WindowIndex Value="0"/> <WindowIndex Value="0"/>
<TopLine Value="141"/> <TopLine Value="141"/>
<CursorPos X="3" Y="143"/> <CursorPos X="3" Y="143"/>
<UsageCount Value="17"/> <UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit26> </Unit26>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">