fpspreadsheet: Clean-up of demos (sometimes the default built mode was lost). Add some more overloaded methods to TsWorksheet having the cell as an argument instead of row/col index.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3411 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-08-02 22:31:19 +00:00
parent de9d844893
commit de5e05ec86
13 changed files with 237 additions and 503 deletions

View File

@@ -15,78 +15,8 @@
<CharSet Value=""/> <CharSet Value=""/>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="3"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
<Item3 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item3>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -144,9 +74,6 @@
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="5"> <Exceptions Count="5">

View File

@@ -63,6 +63,11 @@
<OtherUnitFiles Value="C:\Users\Rik\Downloads\udata\"/> <OtherUnitFiles Value="C:\Users\Rik\Downloads\udata\"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Linking> <Linking>
<Options> <Options>
<Win32> <Win32>

View File

@@ -15,39 +15,8 @@
<VersionInfo> <VersionInfo>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="1">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="ooxmlread"/>
</Target>
<SearchPaths>
<OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
<SrcPath Value=".."/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -91,18 +60,9 @@
</SearchPaths> </SearchPaths>
<Parsing> <Parsing>
<SyntaxOptions> <SyntaxOptions>
<IncludeAssertionCode Value="True"/>
<UseAnsiStrings Value="False"/> <UseAnsiStrings Value="False"/>
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking> <Linking>
<Debugging> <Debugging>
<DebugInfoType Value="dsDwarf2Set"/> <DebugInfoType Value="dsDwarf2Set"/>

View File

@@ -20,35 +20,8 @@
<VersionInfo> <VersionInfo>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="1">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo_formula_func"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -87,19 +60,16 @@
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Parsing>
<Optimizations> <SyntaxOptions>
<OptimizationLevel Value="0"/> <UseAnsiStrings Value="False"/>
</Optimizations> </SyntaxOptions>
</CodeGeneration> </Parsing>
<Linking> <Linking>
<Debugging> <Debugging>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@@ -20,35 +20,8 @@
<VersionInfo> <VersionInfo>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="1">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo_recursive_calc"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -82,19 +55,16 @@
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Parsing>
<Optimizations> <SyntaxOptions>
<OptimizationLevel Value="0"/> <UseAnsiStrings Value="False"/>
</Optimizations> </SyntaxOptions>
</CodeGeneration> </Parsing>
<Linking> <Linking>
<Debugging> <Debugging>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@@ -20,40 +20,8 @@
<VersionInfo> <VersionInfo>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="1">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo_virtualmode_read"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -86,19 +54,16 @@
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Parsing>
<Optimizations> <SyntaxOptions>
<OptimizationLevel Value="0"/> <UseAnsiStrings Value="False"/>
</Optimizations> </SyntaxOptions>
</CodeGeneration> </Parsing>
<Linking> <Linking>
<Debugging> <Debugging>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@@ -20,40 +20,8 @@
<VersionInfo> <VersionInfo>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="1">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo_virtualmode_write"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -86,19 +54,16 @@
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Parsing>
<Optimizations> <SyntaxOptions>
<OptimizationLevel Value="0"/> <UseAnsiStrings Value="False"/>
</Optimizations> </SyntaxOptions>
</CodeGeneration> </Parsing>
<Linking> <Linking>
<Debugging> <Debugging>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@@ -10,7 +10,7 @@
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<Title Value="test_write_formatting"/> <Title Value="demo_write_formatting"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
</General> </General>
@@ -20,35 +20,8 @@
<VersionInfo> <VersionInfo>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="1">
<Item1 Name="Debug" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="demo_write_formatting"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
<StripSymbols Value="True"/>
</Debugging>
<LinkSmart Value="True"/>
</Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -69,7 +42,6 @@
<Unit0> <Unit0>
<Filename Value="demo_write_formatting.pas"/> <Filename Value="demo_write_formatting.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="demo_write_formatting"/>
</Unit0> </Unit0>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@@ -77,25 +49,22 @@
<Version Value="11"/> <Version Value="11"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Target> <Target>
<Filename Value="test_write_formatting"/> <Filename Value="demo_write_formatting"/>
</Target> </Target>
<SearchPaths> <SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/> <IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\.."/> <OtherUnitFiles Value="..\.."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Parsing>
<Optimizations> <SyntaxOptions>
<OptimizationLevel Value="0"/> <UseAnsiStrings Value="False"/>
</Optimizations> </SyntaxOptions>
</CodeGeneration> </Parsing>
<Linking> <Linking>
<Debugging> <Debugging>
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@@ -42,9 +42,6 @@
</Debugging> </Debugging>
<LinkSmart Value="True"/> <LinkSmart Value="True"/>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
</Item2> </Item2>
</BuildModes> </BuildModes>
@@ -68,6 +65,7 @@
<Unit0> <Unit0>
<Filename Value="demo_write_formula.pas"/> <Filename Value="demo_write_formula.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="demo_write_formula"/>
</Unit0> </Unit0>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@@ -81,6 +79,11 @@
<OtherUnitFiles Value="../.."/> <OtherUnitFiles Value="../.."/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration> <CodeGeneration>
<Optimizations> <Optimizations>
<OptimizationLevel Value="0"/> <OptimizationLevel Value="0"/>
@@ -91,9 +94,6 @@
<UseExternalDbgSyms Value="True"/> <UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
</Linking> </Linking>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@@ -30,47 +30,42 @@ begin
MyWorksheet.WriteUTF8Text(0, 1, 'Text Formula');// B1 MyWorksheet.WriteUTF8Text(0, 1, 'Text Formula');// B1
MyWorksheet.WriteUTF8Text(0, 2, 'RPN');// C1 MyWorksheet.WriteUTF8Text(0, 2, 'RPN');// C1
MyWorksheet.WriteNumber(0, 4, -3.14); // E1
MyWorksheet.WriteNumber(1, 4, 100); // E2
MyWorksheet.WriteNumber(2, 4, 200); // E3
Myworksheet.WriteNumber(3, 4, 300); // E4
MyWorksheet.WriteNumber(4, 4, 250); // E5
// =Sum(E2:e5) // =Sum(E2:e5)
MyWorksheet.WriteUTF8Text(1, 0, '=Sum(E2:e5)'); // A2 MyWorksheet.WriteUTF8Text(1, 0, '=Sum(E2:e5)'); // A2
// //
MyFormula.FormulaStr := '=Sum(DE:e5)'; MyFormula.FormulaStr := '=Sum(E2:e5)';
MyFormula.DoubleValue := 0.0; MyFormula.DoubleValue := 0.0;
MyWorksheet.WriteFormula(1, 1, MyFormula); // B2 MyWorksheet.WriteFormula(1, 1, MyFormula); // B2
// //
SetLength(MyRPNFormula, 2); MyWorksheet.WriteRPNFormula(1, 2, CreateRPNFormula( // C2
MyRPNFormula[0].ElementKind := fekCellRange; RPNCellRange('E2:E5',
MyRPNFormula[0].Row := 1; RPNFunc(fekSum, 1, nil))));
MyRPNFormula[0].Row2 := 4;
MyRPNFormula[0].Col := 4;
MyRPNFormula[0].Col2 := 4;
MyRPNFormula[1].ElementKind := fekOpSUM;
MyWorksheet.WriteRPNFormula(1, 2, MyRPNFormula); // C2
// Write the formula =ABS(E1) // Write the formula =ABS(E1)
MyWorksheet.WriteUTF8Text(2, 0, '=ABS(E1)'); // A3 MyWorksheet.WriteUTF8Text(2, 0, '=ABS(E1)'); // A3
// //
SetLength(MyRPNFormula, 2); MyWorksheet.WriteRPNFormula(2, 2, CreateRPNFormula( // C3
MyRPNFormula[0].ElementKind := fekCell; RPNCellValue('E1',
MyRPNFormula[0].Col := 4; RPNFunc(fekAbs, nil))));
MyRPNFormula[0].Row := 0;
MyRPNFormula[1].ElementKind := fekABS;
MyWorksheet.WriteRPNFormula(2, 2, MyRPNFormula);
// Write the formula =4+5 // Write the formula =4+5
MyWorksheet.WriteUTF8Text(3, 0, '=4+5'); // A4 MyWorksheet.WriteUTF8Text(3, 0, '=4+5'); // A4
// //
SetLength(MyRPNFormula, 3); MyWorksheet.WriteRPNFormula(3, 2, CreateRPNFormula( //C4
MyRPNFormula[0].ElementKind := fekNum; RPNNumber(4.0,
MyRPNFormula[0].DoubleValue := 4.0; RPNNumber(5.0,
MyRPNFormula[1].ElementKind := fekNum; RPNFunc(fekAdd, nil)))));
MyRPNFormula[1].DoubleValue := 5.0;
MyRPNFormula[2].ElementKind := fekAdd;
MyWorksheet.WriteRPNFormula(3, 2, MyRPNFormula);
end; end;
procedure WriteSecondWorksheet(); procedure WriteSecondWorksheet();
begin begin
{ MyWorksheet := MyWorkbook.AddWorksheet('Worksheet2'); MyWorksheet := MyWorkbook.AddWorksheet('Worksheet2');
// Write some cells // Write some cells
@@ -78,9 +73,8 @@ begin
MyWorksheet.WriteUTF8Text(1, 1, 'Relatório'); MyWorksheet.WriteUTF8Text(1, 1, 'Relatório');
MyCell := MyWorksheet.GetCell(1, 1); MyCell := MyWorksheet.GetCell(1, 1);
MyCell^.Border := [cbNorth, cbWest, cbSouth]; MyWorksheet.WriteBorders(MyCell, [cbNorth, cbWest, cbSouth]);
MyCell^.BackgroundColor := scGrey20pct; Myworksheet.WriteBackgroundColor(MyCell, scGray20pct);
MyCell^.UsedFormattingFields := [uffBorder, uffBackgroundColor, uffBold];}
end; end;
const const

View File

@@ -15,80 +15,8 @@
<CharSet Value=""/> <CharSet Value=""/>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="3"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="spready"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item2>
<Item3 Name="Release">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="spready"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<SmartLinkUnit Value="True"/>
<Optimizations>
<OptimizationLevel Value="3"/>
</Optimizations>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="False"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
</Item3>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@@ -598,17 +598,27 @@ type
procedure WriteUTF8Text(ACell: PCell; AText: ansistring); overload; procedure WriteUTF8Text(ACell: PCell; AText: ansistring); overload;
{ Writing of cell attributes } { Writing of cell attributes }
procedure WriteBackgroundColor(ARow, ACol: Cardinal; AColor: TsColor); procedure WriteBackgroundColor(ARow, ACol: Cardinal; AColor: TsColor); overload;
procedure WriteBackgroundColor(ACell: PCell; AColor: TsColor); overload;
procedure WriteBorderColor(ARow, ACol: Cardinal; ABorder: TsCellBorder; AColor: TsColor); procedure WriteBorderColor(ARow, ACol: Cardinal; ABorder: TsCellBorder; AColor: TsColor); overload;
procedure WriteBorderColor(ACell: PCell; ABorder: TsCellBorder; AColor: TsColor); overload;
procedure WriteBorderLineStyle(ARow, ACol: Cardinal; ABorder: TsCellBorder; procedure WriteBorderLineStyle(ARow, ACol: Cardinal; ABorder: TsCellBorder;
ALineStyle: TsLineStyle); ALineStyle: TsLineStyle); overload;
procedure WriteBorders(ARow, ACol: Cardinal; ABorders: TsCellBorders); procedure WriteBorderLineStyle(ACell: PCell; ABorder: TsCellBorder;
ALineStyle: TsLineStyle); overload;
procedure WriteBorders(ARow, ACol: Cardinal; ABorders: TsCellBorders); overload;
procedure WriteBorders(ACell: PCell; ABorders: TsCellBorders); overload;
procedure WriteBorderStyle(ARow, ACol: Cardinal; ABorder: TsCellBorder; procedure WriteBorderStyle(ARow, ACol: Cardinal; ABorder: TsCellBorder;
AStyle: TsCellBorderStyle); overload; AStyle: TsCellBorderStyle); overload;
procedure WriteBorderStyle(ACell: PCell; ABorder: TsCellBorder;
AStyle: TsCellBorderStyle); overload;
procedure WriteBorderStyle(ARow, ACol: Cardinal; ABorder: TsCellBorder; procedure WriteBorderStyle(ARow, ACol: Cardinal; ABorder: TsCellBorder;
ALineStyle: TsLineStyle; AColor: TsColor); overload; ALineStyle: TsLineStyle; AColor: TsColor); overload;
procedure WriteBorderStyles(ARow, ACol: Cardinal; const AStyles: TsCellBorderStyles); procedure WriteBorderStyle(ACell: PCell; ABorder: TsCellBorder;
ALineStyle: TsLineStyle; AColor: TsColor); overload;
procedure WriteBorderStyles(ARow, ACol: Cardinal; const AStyles: TsCellBorderStyles); overload;
procedure WriteBorderStyles(ACell: PCell; const AStyles: TsCellBorderStyles); overload;
procedure WriteDecimals(ARow, ACol: Cardinal; ADecimals: byte); overload; procedure WriteDecimals(ARow, ACol: Cardinal; ADecimals: byte); overload;
procedure WriteDecimals(ACell: PCell; ADecimals: Byte); overload; procedure WriteDecimals(ACell: PCell; ADecimals: Byte); overload;
@@ -3564,17 +3574,29 @@ end;
} }
procedure TsWorksheet.WriteBackgroundColor(ARow, ACol: Cardinal; procedure TsWorksheet.WriteBackgroundColor(ARow, ACol: Cardinal;
AColor: TsColor); AColor: TsColor);
var
ACell: PCell;
begin begin
ACell := GetCell(ARow, ACol); WriteBackgroundColor(GetCell(ARow, ACol), AColor);
if AColor = scTransparent then end;
Exclude(ACell^.UsedFormattingFields, uffBackgroundColor)
else begin {@@
Include(ACell^.UsedFormattingFields, uffBackgroundColor); Sets the color of a background color of a cell.
ACell^.BackgroundColor := AColor;
@param ACell Pointer to cell
@param AColor Index of the new background color into the workbook's
color palette. Use the color index scTransparent to
erase an existing background color.
}
procedure TsWorksheet.WriteBackgroundColor(ACell: PCell; AColor: TsColor);
begin
if ACell <> nil then begin
if AColor = scTransparent then
Exclude(ACell^.UsedFormattingFields, uffBackgroundColor)
else begin
Include(ACell^.UsedFormattingFields, uffBackgroundColor);
ACell^.BackgroundColor := AColor;
end;
ChangedCell(ACell^.Row, ACell^.Col);
end; end;
ChangedCell(ARow, ACol);
end; end;
{@@ {@@
@@ -3590,12 +3612,27 @@ end;
} }
procedure TsWorksheet.WriteBorderColor(ARow, ACol: Cardinal; procedure TsWorksheet.WriteBorderColor(ARow, ACol: Cardinal;
ABorder: TsCellBorder; AColor: TsColor); ABorder: TsCellBorder; AColor: TsColor);
var
lCell: PCell;
begin begin
lCell := GetCell(ARow, ACol); WriteBorderColor(GetCell(ARow, ACol), ABorder, AColor);
lCell^.BorderStyles[ABorder].Color := AColor; end;
ChangedCell(ARow, ACol);
{@@
Sets the color of a cell border line.
Note: the border must be included in Borders set in order to be shown!
@param ACell Pointer to cell
@param ABorder Indicates to which border (left/top etc) this color is
to be applied
@param AColor Index of the new border color into the workbook's
color palette.
}
procedure TsWorksheet.WriteBorderColor(ACell: PCell; ABorder: TsCellBorder;
AColor: TsColor);
begin
if ACell <> nil then begin
ACell^.BorderStyles[ABorder].Color := AColor;
ChangedCell(ACell^.Row, ACell^.Col);
end;
end; end;
{@@ {@@
@@ -3612,12 +3649,28 @@ end;
} }
procedure TsWorksheet.WriteBorderLineStyle(ARow, ACol: Cardinal; procedure TsWorksheet.WriteBorderLineStyle(ARow, ACol: Cardinal;
ABorder: TsCellBorder; ALineStyle: TsLineStyle); ABorder: TsCellBorder; ALineStyle: TsLineStyle);
var
lCell: PCell;
begin begin
lCell := GetCell(ARow, ACol); WriteBorderLineStyle(GetCell(ARow, ACol), ABorder, ALineStyle);
lCell^.BorderStyles[ABorder].LineStyle := ALineStyle; end;
ChangedCell(ARow, ACol);
{@@
Sets the linestyle of a cell border.
Note: the border must be included in the "Borders" set in order to be shown!
@param ACell Pointer to cell
@param ABorder Indicates to which border (left/top etc) this color is
to be applied
@param ALineStyle Identifier of the new line style to be applied.
@see TsLineStyle
}
procedure TsWorksheet.WriteBorderLineStyle(ACell: PCell;
ABorder: TsCellBorder; ALineStyle: TsLineStyle);
begin
if ACell <> nil then begin
ACell^.BorderStyles[ABorder].LineStyle := ALineStyle;
ChangedCell(ACell^.Row, ACell^.Col);
end;
end; end;
{@@ {@@
@@ -3632,13 +3685,27 @@ end;
@see TsCellBorder @see TsCellBorder
} }
procedure TsWorksheet.WriteBorders(ARow, ACol: Cardinal; ABorders: TsCellBorders); procedure TsWorksheet.WriteBorders(ARow, ACol: Cardinal; ABorders: TsCellBorders);
var
lCell: PCell;
begin begin
lCell := GetCell(ARow, ACol); WriteBorders(GetCell(ARow, ACol), ABorders);
Include(lCell^.UsedFormattingFields, uffBorder); end;
lCell^.Border := ABorders;
ChangedCell(ARow, ACol); {@@
Shows the cell borders included in the set ABorders. No border lines are drawn
for those not included.
The borders are drawn using the "BorderStyles" assigned to the cell.
@param ACell Pointer to cell
@param ABorders Set with elements to identify the border(s) to will be shown
@see TsCellBorder
}
procedure TsWorksheet.WriteBorders(ACell: PCell; ABorders: TsCellBorders);
begin
if ACell <> nil then begin
Include(ACell^.UsedFormattingFields, uffBorder);
ACell^.Border := ABorders;
ChangedCell(ACell^.Row, ACell^.Col);
end;
end; end;
{@@ {@@
@@ -3653,12 +3720,26 @@ end;
} }
procedure TsWorksheet.WriteBorderStyle(ARow, ACol: Cardinal; procedure TsWorksheet.WriteBorderStyle(ARow, ACol: Cardinal;
ABorder: TsCellBorder; AStyle: TsCellBorderStyle); ABorder: TsCellBorder; AStyle: TsCellBorderStyle);
var
lCell: PCell;
begin begin
lCell := GetCell(ARow, ACol); WriteBorderStyle(GetCell(ARow, ACol), ABorder, AStyle);
lCell^.BorderStyles[ABorder] := AStyle; end;
ChangedCell(ARow, ACol);
{@@
Sets the style of a cell border, i.e. line style and line color.
Note: the border must be included in the "Borders" set in order to be shown!
@param ACell Pointer to cell
@param ABorder Identifies the border to be modified (left/top/right/bottom)
@param AStyle record of parameters controlling how the border line is drawn
(line style, line color)
}
procedure TsWorksheet.WriteBorderStyle(ACell: PCell; ABorder: TsCellBorder;
AStyle: TsCellBorderStyle);
begin
if ACell <> nil then begin
ACell^.BorderStyles[ABorder] := AStyle;
ChangedCell(ACell^.Row, ACell^.Col);
end;
end; end;
{@@ {@@
@@ -3675,13 +3756,29 @@ end;
} }
procedure TsWorksheet.WriteBorderStyle(ARow, ACol: Cardinal; procedure TsWorksheet.WriteBorderStyle(ARow, ACol: Cardinal;
ABorder: TsCellBorder; ALineStyle: TsLinestyle; AColor: TsColor); ABorder: TsCellBorder; ALineStyle: TsLinestyle; AColor: TsColor);
var
lCell: PCell;
begin begin
lCell := GetCell(ARow, ACol); WriteBorderStyle(GetCell(ARow, ACol), ABorder, ALineStyle, AColor);
lCell^.BorderStyles[ABorder].LineStyle := ALineStyle; end;
lCell^.BorderStyles[ABorder].Color := AColor;
ChangedCell(ARow, ACol); {@@
Sets line style and line color of a cell border.
Note: the border must be included in the "Borders" set in order to be shown!
@param ACell Pointer to cell
@param ABorder Identifier of the border to be modified
@param ALineStyle Identifier for the new line style of the border
@param AColor Palette index for the color of the border line
@see WriteBorderStyles
}
procedure TsWorksheet.WriteBorderStyle(ACell: PCell; ABorder: TsCellBorder;
ALineStyle: TsLinestyle; AColor: TsColor);
begin
if ACell <> nil then begin
ACell^.BorderStyles[ABorder].LineStyle := ALineStyle;
ACell^.BorderStyles[ABorder].Color := AColor;
ChangedCell(ACell^.Row, ACell^.Col);
end;
end; end;
{@@ {@@
@@ -3696,13 +3793,29 @@ end;
} }
procedure TsWorksheet.WriteBorderStyles(ARow, ACol: Cardinal; procedure TsWorksheet.WriteBorderStyles(ARow, ACol: Cardinal;
const AStyles: TsCellBorderStyles); const AStyles: TsCellBorderStyles);
begin
WriteBorderStyles(GetCell(ARow, ACol), AStyles);
end;
{@@
Sets the style of all cell border of a cell, i.e. line style and line color.
Note: Only those borders included in the "Borders" set are shown!
@param ACell Pointer to cell
@param ACol Column index of the considered cell
@param AStyles Array of CellBorderStyles for each cell border.
@see WriteBorderStyle
}
procedure TsWorksheet.WriteBorderStyles(ACell: PCell;
const AStyles: TsCellBorderStyles);
var var
b: TsCellBorder; b: TsCellBorder;
cell: PCell;
begin begin
cell := GetCell(ARow, ACol); if Assigned(ACell) then begin
for b in TsCellBorder do cell^.BorderStyles[b] := AStyles[b]; for b in TsCellBorder do ACell^.BorderStyles[b] := AStyles[b];
ChangedCell(ARow, ACol); ChangedCell(ACell^.Row, ACell^.Col);
end;
end; end;
{@@ {@@

View File

@@ -15,40 +15,8 @@
<VersionInfo> <VersionInfo>
<StringTable ProductVersion=""/> <StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="2"> <BuildModes Count="1">
<Item1 Name="Release" Default="True"/> <Item1 Name="Default" Default="True"/>
<Item2 Name="Debug">
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="spreadtestgui"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value=".."/>
<UnitOutputDirectory Value="units\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<IOChecks Value="True"/>
<OverflowChecks Value="True"/>
<StackChecks Value="True"/>
</Checks>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
</Linking>
</CompilerOptions>
</Item2>
</BuildModes> </BuildModes>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -152,11 +120,11 @@
<OtherUnitFiles Value=".."/> <OtherUnitFiles Value=".."/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
<CodeGeneration> <Linking>
<Optimizations> <Debugging>
<OptimizationLevel Value="0"/> <DebugInfoType Value="dsDwarf2Set"/>
</Optimizations> </Debugging>
</CodeGeneration> </Linking>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="6"> <Exceptions Count="6">