"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

The parameter allows to specify which content should be included within the output.

The following options are available and can also be combined using a disjunction (OR):

  • TABLE_WRITE_VISIBLE_CELLS = only visible cells are written (i.e. invisible cells or cells with a length or width of 0 are not written); Column headers 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
  • TABLE_WRITE_ALL_ROWS = This option must be set to also include hidden rows.

These options can be combined using a disjunction (OR).

separator Allows definition of the separator used between columns.
format The file-format (.ods)

Description

-

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