Go to the source code of this file.
Data Structures | |
struct | CsvTable |
The standard structure used to contain all spreadsheet data. More... | |
Functions | |
CsvTable * | csvLoadBuffer (long len, const unsigned char *data, char cend, char qchr) |
Create a CsvTable structure from a CSV-format data buffer. | |
CsvTable * | csvLoadFile (const char *file_name, char cend, char qchr) |
Create a CsvTable structure from a file in any supported format. | |
CsvTable * | csvCreateTable (long width, long height) |
Create a new CsvTable structure in memory. | |
void | csvFree (CsvTable *csv) |
Free a previously allocated CsvTable structure from memory. | |
int | csvSaveCSV (const CsvTable *csv, const char *fname, char cend, char qchr) |
Export a CsvTable structure as a CSV file. | |
int | csvSaveHTML (const CsvTable *csv, const char *file_name) |
Export a CsvTable structure as an HTML file. | |
int | csvEditCell (const CsvTable *csv, long x, long y, const char *new_text) |
Edit the contents of a CsvTable cell. | |
long | csvSearchCol (const CsvTable *csv, long col, const char *str) |
Search for a matching string in a particular column of a CsvTable. |
Additional formats might be supported in the future.
CsvTable* csvCreateTable | ( | long | width, | |
long | height | |||
) |
int csvEditCell | ( | const CsvTable * | csv, | |
long | x, | |||
long | y, | |||
const char * | new_text | |||
) |
void csvFree | ( | CsvTable * | csv | ) |
CsvTable* csvLoadBuffer | ( | long | len, | |
const unsigned char * | data, | |||
char | cend, | |||
char | qchr | |||
) |
Create a CsvTable structure from a CSV-format data buffer.
This function can also be used to import Tab-Seperated or Space-Separated files.
len | The length of the data buffer. | |
data | A raw byte buffer containing file data. | |
cend | The col-end character. Usually a comma, but may be a semicolon, etc. | |
qchr | The quote character. Usually a doublequote but may be a singlequote. |
CsvTable* csvLoadFile | ( | const char * | file_name, | |
char | cend, | |||
char | qchr | |||
) |
Create a CsvTable structure from a file in any supported format.
This function is essentially a special wrapper for csvLoadBuffer(). It creates a data buffer from a given file, passes it to csvLoadBuffer() and then frees it before returning the result obtained from the csvLoadBuffer() function.
file_name | The name and path of the file to be loaded. | |
cend | The col-end character. Usually a comma, but may be a semicolon, etc. | |
qchr | The quote character. Usually a doublequote but may be a singlequote. |
int csvSaveCSV | ( | const CsvTable * | csv, | |
const char * | fname, | |||
char | cend, | |||
char | qchr | |||
) |
Export a CsvTable structure as a CSV file.
This function can also be used to export Tab-Seperated or Space-Separated files.
csv | The CsvTable to be saved. | |
fname | The filename to use for the exported table. | |
cend | The col-end character. Usually a comma but may be a semicolon, etc. | |
qchr | The quote character. Usually a doublequote but may be a singlequote |
int csvSaveHTML | ( | const CsvTable * | csv, | |
const char * | file_name | |||
) |
long csvSearchCol | ( | const CsvTable * | csv, | |
long | col, | |||
const char * | str | |||
) |
Search for a matching string in a particular column of a CsvTable.
Returns the first match found, even when there is more than one possible match.
csv | The CsvTable to be searched. | |
col | The column to search. | |
str | The value to look for. |