This feature allows for exporting cursor data into Excel or OpenOffice spreadsheets, similarly to the COPY TO … TYPE XL5 command, with the following enhancements:
- The number of records is not limited to 65K
- Formatting options, including dynamic formatting, column width, header names and styles and text trimming
Running the export
Run XFRX_CopyToXLSX or XFRX_CopyToODS procedure inside XFRX.PRG/FXP with the following parameters:
- lcAlias - Source ALIAS (required)
- lcFile - Output file name (required)
- lcFCCallBack - Callback function name - please see Formatting options below (optional)
- lcSheetName - Excel sheet name (optional)
- llOnlyData - Export only data - no headers (optional)
Example
OPEN DATABASE "C:\Program Files (x86)\Microsoft Visual FoxPro 9\Samples\Northwind\Northwind" USE "Invoices" SET PROCEDURE TO xfrx.prg m.liErr=XFRX_CopyToXLSX("Invoices", "test.xlsx", , "Invoices") IF m.liErr<>0 ?"ERROR",m.liErr ENDIF
Formatting options
The process uses the following settings to format the data output:
- Date values
- SET DATE
- SET CENTURY
- SET MARK TO
- Datetime values
- SET DATE
- SET CENTURY
- SET MARK TO
- SET SECONDS
- SET HOURS TO
- Numbers
- SET DECIMALS TO
- SET POINT TO
Additional formatting