Load CSV document with options

GroupDocs.Conversion provides CsvLoadOptions to give you control over how source CSV document will be processed. The following options could be set:

Control behavior of converting date/time and numeric data

The following code sample shows how to convert CSV document and control the way the date/time and numeric data have been processed:

CsvLoadOptions loadOptions = new CsvLoadOptions();
loadOptions.setConvertDateTimeData(true);
loadOptions.setConvertNumericData(true);

Converter converter = new Converter("sample.csv", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);

Specify delimiter

The following code sample shows how to convert CSV document and specify the delimiter

CsvLoadOptions loadOptions = new CsvLoadOptions();
loadOptions.setSeparator(',');

Converter converter = new Converter("sample.csv", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);

Specify encoding

The following code sample shows how to convert CSV document and specify the encoding

CsvLoadOptions loadOptions = new CsvLoadOptions();
loadOptions.setEncoding(java.nio.charset.Charset.forName("shift_jis"));

Converter converter = new Converter("sample.csv", loadOptions);
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);

© Aspose Pty Ltd 2001-2022. All Rights Reserved.