MTblExportToExcel

Functions ›› MTblExport... ››
Parent Previous Next

nRet = MTblExportToExcel( hWndTbl, nLanguage, sExcelStartCell, nExcelFlags, nExportFlags, nRowFlagsOn, nRowFlagsOff, nColFlagsOn, nColFlagsOff )

Exports a table to Microsoft Excel.

Parameters
hWndTbl
Window Handle: Handle of the table

nLanguage
Number: Language. See fcMTblExcelExpParams.Language for further details.

sExcelStartCell
String: Cell in Excel that shall be the starting point. See fcMTblExcelExpParams.ExcelStartCell for further details.

nExcelFlags
Number: Optional Excel flags. See fcMTblExcelExpParams.ExcelFlags for further details.

nExportFlags
Number: Optional export flags. See fcMTblExcelExpParams.ExpFlags for further details.

nRowFlagsOn
Number: The flags a row should have to be exported.

nRowFlagsOff
Number: The flags a row should not have to be exported.

nColFlagsOn
Number: The flags a column should have to be exported.

nColFlagsOff
Number: The flags a column should not have to be exported.

Return
Number: See MTblExportToExcelEx return value for further details.

Example
In this example all visible rows ( incl. split rows ) and columns of a table are exported to a new worksheet of a running or new Excel instance with column headers, colors, fonts and grid. The start cell is B2 and the status dialog is shown. The language is English:

Set nLanguage = MTE_LNG_ENGLISH
Set sStartCell = "B2"
Set nExcelFlags = MTE_EXCEL_RUNNING_INSTANCE | MTE_EXCEL_NEW_INSTANCE | MTE_EXCEL_NEW_WORKSHEET
Set nExportFlags = MTE_COL_HEADERS | MTE_COLORS | MTE_FONTS | MTE_GRID | MTE_SPLIT_ROWS | MTE_SHOW_STATUS
Set nRowFlagsOn = 0
Set nRowFlagsOff = ROW_Hidden
Set nColFlagsOn = COL_Visible
Set nColFlagsOff = 0
Set nRet = MTblExportToExcel( hWndTbl, nLanguage, sStartCell, nExcelFlags, nExportFlags, nRowFlagsOn, nRowFlagsOff, nColFlagsOn, nColFlagsOff )

Remarks
M!Table uses automation based on the Microsoft Excel 8.0 Object Library ( Excel 97 ) and is tested with Excel 97, 2000 and 2007. It's not guaranteed that it works with another Excel version.

When you set or omit both Excel instance flags( MTE_EXCEL_RUNNING_INSTANCE and MTE_EXCEL_NEW_INSTANCE ), M!Table first looks for a running instance. If no running instance is found, a new instance is created.

For performance reasons, automatic calculation in Excel is switched off during the export.
The original setting is restored after the export.

The following messages are sent while exporting:
MTM_QueryExcelColWidth
MTM_QueryExcelNumberFormat
MTM_QueryExcelRowHeight

See also
MTblExportToExcelEx
Exports

Created with the Personal Edition of HelpNDoc: Free EPub and documentation generator