CSV

Parent Previous Next

With the CSV adapter you can export a csv file with a specific content.



Syntax

       public class CSVDocument


Members

CSVDocument(string Delimiter = ";", string stringEscape="\"", string Escape="\\", string LineBreak = "\r\n")

The constructor

void SetValue(int row, int col, object value)

Sets a value into a specified row and column

void SaveAs(Stream s)

Saves the file



Sample

This sample creates a .csv file with given values


import clr

clr.AddReferenceToFileAndPath(Session.GetAdapterPath("CSV"))

from IYOPROCsvAdapter import CSVDocument

import System

from System.IO import FileStream, FileMode


fs = FileStream("CSVSample.csv", FileMode.Create)          

csv = CSVDocument()

csv.SetValue(1, 1, "Column A")

csv.SetValue(1, 2, "Column B")

csv.SetValue(1, 3, "Column C")

csv.SetValue(2, 1, "Hello")

csv.SetValue(2, 2, 3)

csv.SetValue(2, 3, 4.2)

csv.SaveAs(fs)

fs.Close()