OpenPetra
Free Administration Software for Non-Profits
Ict.Common.IO.TCsv2Xml Class Reference

Static Public Member Functions

static bool Xml2Csv (XmlDocument ADoc, string AOutCSVFile)
 format the XML into CSV so that it can be opened as a spreadsheet; this only works for quite simple files; hierarchical structures are flattened (using childOf column) More...
 
static string Xml2CsvString (XmlDocument ADoc)
 format the XML into CSV so that it can be opened as a spreadsheet; this only works for quite simple files; hierarchical structures are flattened (using childOf column) More...
 
static bool Xml2ExcelStream (XmlDocument ADoc, Stream AStream, bool AWithHashInCaption=true)
 store the data into Excel format, Open Office XML, .xlsx More...
 
static bool Xml2ExcelStream (SortedList< string, XmlDocument >ADocs, MemoryStream AStream, bool AWithHashInCaption=true)
 store the data into Excel format, Open Office XML, .xlsx this overload stores several worksheets More...
 
static bool DataTable2ExcelStream (DataTable table, MemoryStream AStream, bool AWithHashInCaption=true)
 save a generic DataTable to an Excel file More...
 
static bool CSV2ExcelStream (string ACSVData, MemoryStream AStream, string ASeparator=",", string ATableName="data")
 save a generic CSV string to an Excel file More...
 
static DataTable ParseExcelWorkbook2DataTable (Stream AStream, bool AHasHeader=false, int AWorksheetID=0, List< string >AColumnsToImport=null)
 Load an xlsx Excel file into a datatable More...
 
static XmlDocument ParseCSVFile2Xml (string ACSVFilename, string ASeparator=null, Encoding AFallbackEncoding=null)
 convert a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty More...
 
static XmlDocument ParseCSVContent2Xml (string AFileContent, string ASeparator=null)
 convert the content of a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty More...
 
static XmlDocument ParseCSV2Xml (TextReader AReader, string ASeparator=null)
 convert a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty More...
 
static XmlDocument ParseCSV2Xml (List< string >ALines, string ASeparator, out List< string > AAllAttributes)
 convert a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty More...
 
static DataTable ParseCSV2DataTable (List< string >ALines, string ASeparator)
 convert a CSV file to a DataTable. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty More...
 

Detailed Description

provides methods for converting CSV file to and from XML; this helps with adding values, rearranging columns etc; expects a header line with column names

Member Function Documentation

◆ CSV2ExcelStream()

static bool Ict.Common.IO.TCsv2Xml.CSV2ExcelStream ( string  ACSVData,
MemoryStream  AStream,
string  ASeparator = ",",
string  ATableName = "data" 
)
inlinestatic

save a generic CSV string to an Excel file

◆ DataTable2ExcelStream()

static bool Ict.Common.IO.TCsv2Xml.DataTable2ExcelStream ( DataTable  table,
MemoryStream  AStream,
bool  AWithHashInCaption = true 
)
inlinestatic

save a generic DataTable to an Excel file

◆ ParseCSV2DataTable()

static DataTable Ict.Common.IO.TCsv2Xml.ParseCSV2DataTable ( List< string >  ALines,
string  ASeparator 
)
inlinestatic

convert a CSV file to a DataTable. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty

◆ ParseCSV2Xml() [1/2]

static XmlDocument Ict.Common.IO.TCsv2Xml.ParseCSV2Xml ( List< string >  ALines,
string  ASeparator,
out List< string >  AAllAttributes 
)
inlinestatic

convert a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty

◆ ParseCSV2Xml() [2/2]

static XmlDocument Ict.Common.IO.TCsv2Xml.ParseCSV2Xml ( TextReader  AReader,
string  ASeparator = null 
)
inlinestatic

convert a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty

◆ ParseCSVContent2Xml()

static XmlDocument Ict.Common.IO.TCsv2Xml.ParseCSVContent2Xml ( string  AFileContent,
string  ASeparator = null 
)
inlinestatic

convert the content of a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty

◆ ParseCSVFile2Xml()

static XmlDocument Ict.Common.IO.TCsv2Xml.ParseCSVFile2Xml ( string  ACSVFilename,
string  ASeparator = null,
Encoding  AFallbackEncoding = null 
)
inlinestatic

convert a CSV file to an XmlDocument. the first line is expected to contain the column names/captions, in quotes. from the header line, the separator can be determined, if the parameter ASeparator is empty

Parameters
ACSVFilenameThe filename
AFallbackEncodingThe file encoding will be automatically determined, but if a fallback is specified that does not match the encoding that was determined, it will be used. Usually this paramter can be null.
ASeparatorA column separator

◆ ParseExcelWorkbook2DataTable()

static DataTable Ict.Common.IO.TCsv2Xml.ParseExcelWorkbook2DataTable ( Stream  AStream,
bool  AHasHeader = false,
int  AWorksheetID = 0,
List< string >  AColumnsToImport = null 
)
inlinestatic

Load an xlsx Excel file into a datatable

◆ Xml2Csv()

static bool Ict.Common.IO.TCsv2Xml.Xml2Csv ( XmlDocument  ADoc,
string  AOutCSVFile 
)
inlinestatic

format the XML into CSV so that it can be opened as a spreadsheet; this only works for quite simple files; hierarchical structures are flattened (using childOf column)

◆ Xml2CsvString()

static string Ict.Common.IO.TCsv2Xml.Xml2CsvString ( XmlDocument  ADoc)
inlinestatic

format the XML into CSV so that it can be opened as a spreadsheet; this only works for quite simple files; hierarchical structures are flattened (using childOf column)

◆ Xml2ExcelStream() [1/2]

static bool Ict.Common.IO.TCsv2Xml.Xml2ExcelStream ( SortedList< string, XmlDocument >  ADocs,
MemoryStream  AStream,
bool  AWithHashInCaption = true 
)
inlinestatic

store the data into Excel format, Open Office XML, .xlsx this overload stores several worksheets

◆ Xml2ExcelStream() [2/2]

static bool Ict.Common.IO.TCsv2Xml.Xml2ExcelStream ( XmlDocument  ADoc,
Stream  AStream,
bool  AWithHashInCaption = true 
)
inlinestatic

store the data into Excel format, Open Office XML, .xlsx


The documentation for this class was generated from the following file: