BUFTOEXCEL
Create an Excel file in XLSX format using the contents of a memory buffer.
WebVue support - Yes.
Syntax
IntVal = BUFTOEXCEL (Handle, LineSeparator, ColumnSeparator, WorkbookPath, SheetName, FileMode, [OffsetLineNumber, OffsetColumnNumber])
Return type: INTEGER.
Argument |
Meaning |
Handle |
The handle of a memory buffer. Type LONG. |
LineSeparator | The line separator used in buffer (one character such as ‘;’ or ‘\n’). Type STR. |
ColumnSeperator | The column separator used in buffer (one character such as ‘,’ or ‘\t’). Type STR. |
WorkBookPath |
The full path of the workbook including the file name. If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the path must be valid on that computer. For example, E:\\WorkBooks\\MyBook.xlsx. |
SheetName | The name of the worksheet. Type STR. |
FileMode |
The mode for writing the file. Type STR. CLEARSHEET - The workbook and the sheet are created and characters from the memory buffer are written to it until the first null character is encountered in the buffer. If the sheet already exists, any content in the cells is cleared. |
OffsetLineNumber | Offset of the line to write in the Excel sheet. For the APPEND mode it is an offset from the last line otherwise it is from the origin. The default value is 1. Type INTEGER. |
OffsetColumnNumber | Offset of the column to write in Excel sheet. The default value is 1. |
Execution
Action |
Create an Excel file in XLSX format using the contents of a memory buffer. 0 - OK -1 - Buffer parameter invalid -2 - Buffer unknown -3 - Line separator parameter invalid -4 - Column separator parameter invalid -5 - WorkbookPath parameter invalid -6 - SheetName parameter invalid -7 - FileMode parameter invalid -8 - FileMode unknown -9 - OffsetLineNumber parameter must greater than 1 when used -10 - OffsetColumnNumber parameter must greater than 1 when used -11 - Incorrect buffer content (column count is not the same for each line) -12 - Write operation failed (details in Event Viewer) |
-13 - File generation failed - Buffer is empty (size <= 0) |