-
Notifications
You must be signed in to change notification settings - Fork 43
exporting
Yeray Alonso edited this page Jun 27, 2017
·
3 revisions
In the same units that contain the import classes (BI.Data.xxx), there are exporting classes to perform the opposite, for example to generate a JSON file from the "Orders" TDataItem:
uses BI.Data.JSON;
var JSON : TBIJSONExport;
JSON:= TBIJSON.ExportFormat;
JSON.Data := Orders;
WriteLn( JSON.AsString );
Data can be exported to the following formats: CSV, HTML, XML, JSON, Excel, ClientDataset, PDF.
Any TDataItem object can be exported to Microsoft Excel format (*.xls, *.xlsx, etc), without the need to have Excel installed on that machine, by using a "plugin" class to a 3rd party library.
The unit BI.Data.Excel.TMSFlexCel implements a small "plugin" to use TMS FlexCel library, available at:
https://www.tmssoftware.com/site/flexcel.asp
Other plugin classes should be easy to create as the quantity of code is minimal.
Example code:
uses BI.Data.Excel, BI.Data.Excel.TMSFlexCel;
TBIExcelExport.Engine:=TBITMSFlexCel;
TBIExcelExport.SaveToFile(MyData, 'mydata.xlsx');