"writeToFile"
Writes the content of a table to a file. This function can also be used to export an ODS file.
Synopsis
setValue(string shape, "writeToFile", string filename, int options, char separator
| string format);
shape.writeToFile(string filename, int options, char separator | string
format);
Parameters
Parameter | Description |
---|---|
shape | Name of the object |
filename | Path to the file to be written to. |
options |
TABLE_WRITE_VISIBLE_COLUMNS = only visible columns are written without column header (i.e. invisible columns or columns with a length of 0 are not written) TABLE_WRITE_ALL_COLUMNS = all columns are written without column header (incl. invisible columns) TABLE_WRITE_COLUMN_HEADER = only visible columns are written together with column header These options can be combined using a disjunction (OR). |
separator | Column separator |
format | The file-format ( ods) |
Description
Writes the content of a table to the file specified in "filename". The parameter "options" specifies whether only visible columns, visible columns with column header, all columns or a combination of these options should be written. The column separator can be set in the "separator" parameter.
Exporting an ODS file
The table can also export an ODS file. To do this, the format sting "ods" has to be passed as the format parameter. If the given file name does not end in ".ods", the extention is appended.
Writes all (including "invisible") columns to the file " C:/test.txt". A space is used as separator.
main()
{
shape table = getShape("table123");
table.writeToFile("c:/test.txt", TABLE_WRITE_ALL_COLUMNS, " ");
}
Writes all (including "invisible") columns including the column header to the file " C:/test.txt". A space is used as separator.
main()
{
shape table = getShape("table123");
table.writeToFile("c:/test.txt", TABLE_WRITE_ALL_COLUMNS |
TABLE_WRITE_COLUMN_HEADER , " ");
}
Assignment
Table