GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Eight — Data Functions (continued)
Overview
The CSVWriteTable function will write a two-dimensional string array into a formatted CSV table as a file. The file specified can be a filename or a Basic File Object.
Syntax/Parameters
Syntax
int = CSVWriteTable ( string data[][], handle hFile | string name, [dword flags] );
Parameters
data
A two-dimension string array. The first dimension is the row and the second is the column.
hFile
An optional handle for a Basic File Object. The object must have write permissions. Data is appended at the current file position. If the hFile parameter is not provided, the name parameter must be provided.
name
An optional string containing a fully qualified filename. If this parameter is not provided, the hFile parameter must be provided.
flags
An optional dword that specifies various options. The default is CSV_WT_SIMPLE_LINE_ENDING.
Return Value
Returns an int as ERROR_NONE or a formatted error code on failure.
Remarks
The data parameter is expected to be in a table format, i.e., [rows][cols].
Flags specifies various options. For example, when CSV_WT_SIMPLE_LINE_ENDING causes the output to be written with only CR (0x0D) line-ending characters as opposed to CR/LF (0x0D/0x0A).
Define | Bitwise | Description | ||||
CSV_WT_CRLF_LINE_ENDING | 0x00000000 | CR/LF (Absence of Flag) | ||||
CSV_WT_SIMPLE_LINE_ENDING | 0x00000001 | Use CR only Line Endings. To force | ||||
CSV_WT_KEY_NAMES_TO_HEADER | 0x00000002 | Convert Key Names to CSV First Row. | ||||
CSV_WT_CREATE_EXCEL_STYLE_CSV | 0x00000004 | Create Excel Style CSV | ||||
CSV_WT_ADD_UTF_8_HEADER | 0x00000008 | Add UTF-8 Header |
If key names are requested, the first row is filled with the column key names. If all the columns in the data parameter are without keys, the row will not be written.
The table size is determined by the number of used elements. For example, if the table is 10 columns wide but the highest row and column indices written are data[25][5], the CSV will be 6 columns wide and 26 rows deep.
Normally CSV is written by Legato with all fields encapsulated in quotes. Setting the CSV_WT_CREATE_EXCEL_STYLE_CSV flag causes only fields that require quoting to be quoted. Some destination application can be sensitive to the formatting.
Some applications, such as Excel, will accept CSV with UTF-8 encoded Unicode. Adding the CSV_WT_ADD_UTF_8_HEADER bit to the flags causes the writer to add the UTS-8 text signature to the start of the file. It does not cause the function to perform any character conversions. If character are ANSI in the stream and this flag is added, it will probably result in issues with the destination application.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.