Libre 1.0 Delphi 7-10.1 Full Source
Libre 1.0 Delphi 7-10.1 Full Source | 39 Mb
Delphi library for automating LibreOffice.
complete LibreOffice API supported
available for Delphi 7 - 10.1
source code included in full version
distributing components in applications is royalty free
How can I close spreadsheet or text document?
var
SpreadsheetDocument: XSpreadsheetDocument;
TextDocument: XTextDocument;
Closeable: XCloseable;
Closeable := CoXCloseable.Create(SpreadsheetDocument);
Closeable.close(False);
Closeable := CoXCloseable.Create(TextDocument);
Closeable.close(False);
How can I create, modify or delete spreadsheets?
var
Libre: ILibre;
SpreadsheetDocument: XSpreadsheetDocument;
Spreadsheets: XSpreadsheets;
Spreadsheet: XSpreadsheet;
Cell: XCell;
Libre := CoLibre.Create;
SpreadsheetDocument := Libre.CreateSpreadsheetDocument;
Spreadsheets := SpreadsheetDocument.getSheets;
// create new spreadsheets
Spreadsheets.insertNewByName('MySpreadsheet1', 0);
Spreadsheets.insertNewByName('MySpreadsheet2', 0);
// modify content of spreadsheet
Spreadsheet := CoXSpreadsheet.Create(Spreadsheets.getByName('MySpreadsheet1'));
Cell := Spreadsheet.getCellByPosition(2, 2);
Cell.setFormula('Hello, world!');
// delete spreadsheet
Spreadsheets.removeByName('MySpreadsheet1');
How can I set cell properties?
var
Spreadsheet: XSpreadsheet;
Cell: XCell;
PropertySet: XPropertySet;
Cell := Spreadsheet.getCellByPosition(2, 2);
Cell.setFormula('Hello, world!');
PropertySet := CoXPropertySet.Create(Cell);
PropertySet.setPropertyValue('CharColor', $003399);
PropertySet.setPropertyValue('CharHeight', 20);
PropertySet.setPropertyValue('ParaLeftMargin', 500);
PropertySet.setPropertyValue('IsCellBackgroundTransparent', False);
PropertySet.setPropertyValue('CellBackColor', $99CCFF);
How can I set column width?
var
Spreadsheet: XSpreadsheet;
CellRange: XCellRange;
ColumnRowRange: XColumnRowRange;
TableColumns: XTableColumns;
Column: Variant;
PropertySet: XPropertySet;
CellRange := Spreadsheet.getCellRangeByName('C1');
ColumnRowRange := CoXColumnRowRange.Create(CellRange);
TableColumns := ColumnRowRange.getColumns;
Column := TableColumns.getByIndex(0);
PropertySet := CoXPropertySet.Create(Column);
PropertySet.setPropertyValue('Width', 5000);