nRet = MTblExportToOOCalc( hWndTbl, nLanguage, sCalcStartCell, nCalcFlags, nExportFlags, nRowFlagsOn, nRowFlagsOff, nColFlagsOn, nColFlagsOff )

Exports a table to Open Office Calc.

Parameters
hWndTbl
Window Handle: Handle of the table

nLanguage
Number: Language. Specify MTE_LNG_GERMAN, MTE_LNG_ENGLISH or the ID of a registered custom language. The language refers to the status dialog and messages.

sCalcStartCell
String: Cell in Calc that shall be the starting point. You can also specify STRING_Null for no start cell. If the flag MTE_OOCALC_CURRENT_POS is set, this parameter is ignored.

nCalcFlags
Number: Optional Calc flags:

MTE_OOCALC_NEW_WORKBOOK

Exports to a new workbook.

MTE_OOCALC_NEW_WORKSHEET

Exports to a new worksheet.

MTE_OOCALC_CURRENT_POS

Uses the active cell in Calc as the starting point. If you don't specify this flag, the starting point is cell "A1".

MTE_OOCALC_STRING_COLS_AS_TEXT

The cell's data type in Calc is set to "Standard" before inserting any text in order to let Calc determine the data type. However, in some cases this has the unwanted effect that Calc interprets a text as a date or something similar, e.g. "1/2" is interpreted as "01-Feb". When you set this flag, the data type of the cells in Calc which belong to a string column in the table are set to "Text" in order to "tell" Calc to leave them unchanged.

MTE_OOCALC_NULLS_AS_SPACE

Exports null values ( empty cells ) as a space character

nExportFlags
Number: Optional export flags:

MTE_COL_HEADERS

Exports column headers.

MTE_COLORS

Exports text and background colors.

MTE_FONTS

Exports fonts and font enhancements.

MTE_GRID

Exports a grid according to the table's row and column lines.

MTE_SPLIT_ROWS

Exports also split rows ( if any )

MTE_SHOW_STATUS

Displays a status dialog with a "Cancel" button.

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

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

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

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

Return
Number: 1 if successful or one of the following error codes:

MTE_ERR_CANCELLED

The user has cancelled the export.

MTE_ERR_STATUS

An status dialog error occured.

MTE_ERR_OLE_EXCEPTION

An OLE exception occured. The exception is reported to the user in a message box.

MTE_ERR_EXCEPTION

Another exception occured. The exception is reported to the user in a message box.

MTE_ERR_NOT_SUBCLASSED

The table isn't subclassed with MTblSubClass.

MTE_ERR_INVALID_LANG

The specified language is invalid.

Example
In this example all visible rows ( incl. split rows ) and columns of a table are exported to a new worksheet 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 nCalcFlags = MTE_OOCALC_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 = MTblExportToOOCalc( hWndTbl, nLanguage, sStartCell, nCalcFlags, nExportFlags, nRowFlagsOn, nRowFlagsOff, nColFlagsOn, nColFlagsOff )

Remarks
M!Table uses automation based on the Open Office 3.01 ActiveX component and is tested with Open Office Calc 3.01. It's not guaranteed that it works with another Calc version.
If the Open Office ActiveX component isn't installed, the export will fail!

See also
Exports
Localization

Created with the Personal Edition of HelpNDoc: Write EPub books for the iPad