|
26.03.2024, 16:11 | #1 |
Участник
|
a33ik: Read/Write CSV file
Источник: http://daxonline.org/1945-read-write-csv-file.html
============== If unquoted text values are required then CommaTextStreamIo should be replaced with TextStreamIo, which has the same methods. Read CSV file #File #OCCRetryCount #define.delimiterField(',') System.IO.MemoryStream memoryStream = connector.getCurrentMemoryStream(); CommaTextStreamIo commaTextStreamIo = CommaTextStreamIo::constructForRead(memoryStream); if (commaTextStreamIo) { if (commaTextStreamIo.status()) { throw error("@CLIDocuments:FileUpload_Failed"); } commaTextStreamIo.inFieldDelimiter(#delimiterField); commaTextStreamIo.inRecordDelimiter(#delimiterCRLF); container record; while (!commaTextStreamIo.status()) { record = commaTextStreamIo.read(); } } Write CSV file CommaTextStreamIo commaTextStreamIo = CommaTextStreamIo::constructForWrite(); commaTextStreamIo.writeExp(['row 1 col 1', 'row 1 col 2']); commaTextStreamIo.writeExp(['row 2 col 1', 'row 2 col 2']); File::SendFileToUser(commaTextStreamIo.getStream(), 'file name.csv'); Result: Источник: http://daxonline.org/1945-read-write-csv-file.html |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|