FPSpreadsheet: Difference between revisions
Sekelsenmat (talk | contribs) No edit summary |
Sekelsenmat (talk | contribs) |
||
Line 76: | Line 76: | ||
== Current Progress == | == Current Progress == | ||
{| | |||
|- | {| BORDER="1" CELLSPACING="0" | ||
|- | !COLSPAN="1" STYLE="background:#ffdead;"|'''Format''' | ||
!COLSPAN="1" STYLE="background:#ffdead;"|'''Supports multiple sheets?''' | |||
!COLSPAN="1" STYLE="background:#ffdead;"|'''Reader Progress''' | |||
!COLSPAN="1" STYLE="background:#ffdead;"|'''Writter Progress''' | |||
|---- | |||
|Excel 2.1||No||Not implemented||Working | |||
|---- | |||
|Excel 5.0||Yes||Not implemented||Working, but only in Windows | |||
|---- | |||
|Excel 8.0||Yes||Not implemented||Not implemented | |||
|---- | |||
|Microsoft OOXML||Yes||Not implemented||Experimental | |||
|---- | |||
|OpenDocument||Yes||Not implemented||Experimental | |||
|} | |} | ||
Revision as of 14:47, 17 October 2008
The fpSpreadsheet library offers a convenient way to generate spreadsheet documents in various formats. The library is written in a very flexible manner, and is prepared to also support loading spreadsheet files in the future and can be easely extented to support more formats.
Examples
To create a project which uses the fpspreadsheet library, add the fpspreadsheet_pkg package to it's Lazarus project, or add the base directory of fpspreadsheet to you compiler options if using another IDE.
Excel 5 example
<delphi> { excel5demo.dpr
Demonstrates how to write an Excel 5.x file using the fpspreadsheet library
AUTHORS: Felipe Monteiro de Carvalho } program excel5demo;
{$mode delphi}{$H+}
uses
Classes, SysUtils, fpspreadsheet, xlsbiff5, fpspreadsheet_pkg;
var
MyWorkbook: TsWorkbook; MyWorksheet: TsWorksheet; MyFormula: TRPNFormula; MyDir: string;
begin
// Open the output file MyDir := ExtractFilePath(ParamStr(0));
// Create the spreadsheet MyWorkbook := TsWorkbook.Create; MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet');
// Write some number cells MyWorksheet.WriteNumber(0, 0, 1.0); MyWorksheet.WriteNumber(0, 1, 2.0); MyWorksheet.WriteNumber(0, 2, 3.0); MyWorksheet.WriteNumber(0, 3, 4.0);
// Write the formula E1 = A1 + B1 // or, in RPN: A1, B1, + SetLength(MyFormula, 3); MyFormula[0].TokenID := INT_EXCEL_TOKEN_TREFV; {A1} MyFormula[0].Col := 0; MyFormula[0].Row := 0; MyFormula[1].TokenID := INT_EXCEL_TOKEN_TREFV; {B1} MyFormula[1].Col := 1; MyFormula[1].Row := 0; MyFormula[2].TokenID := INT_EXCEL_TOKEN_TADD; {+} MyWorksheet.WriteRPNFormula(0, 4, MyFormula);
// Creates a new worksheet MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet 2');
// Write some string cells MyWorksheet.WriteAnsiText(0, 0, 'First'); MyWorksheet.WriteAnsiText(0, 1, 'Second'); MyWorksheet.WriteAnsiText(0, 2, 'Third'); MyWorksheet.WriteAnsiText(0, 3, 'Fourth');
// Save the spreadsheet to a file MyWorkbook.WriteToFile(MyDir + 'test' + STR_EXCEL_EXTENSION, sfExcel5); MyWorkbook.Free;
end. </delphi>
Subversion
svn co https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/fpspreadsheet fpspreadsheet
Current Progress
Format | Supports multiple sheets? | Reader Progress | Writter Progress |
---|---|---|---|
Excel 2.1 | No | Not implemented | Working |
Excel 5.0 | Yes | Not implemented | Working, but only in Windows |
Excel 8.0 | Yes | Not implemented | Not implemented |
Microsoft OOXML | Yes | Not implemented | Experimental |
OpenDocument | Yes | Not implemented | Experimental |
License
The same modified LGPL as the Lazarus Component Library