com.groupdocs.assembly

Class CsvDataSource

  • java.lang.Object
    • com.groupdocs.assembly.CsvDataSource


  • public class CsvDataSource
    extends java.lang.Object
    Provides access to data of a CSV file or stream to be used while assembling a document.

    To access data of the corresponding file or stream while assembling a document, pass an instance of this class as a data source to one of DocumentAssembler. assembleDocument overloads.

    In template documents, a CsvDataSource instance should be treated in the same way as if it was a DataTable instance. For more information, see template syntax reference(https://docs.groupdocs.com/display/assemblyjava/Template+Syntax+-+Part+1+of+2#TemplateSyntax-Part1of2-UsingDataSources).

    Data types of comma-separated values are determined automatically upon their string representations. So in template documents, you can work with typed values rather than just strings. The engine is capable to automatically recognize values of the following types:

    • java.lang.Integer
    • java.lang.Long
    • java.lang.Double
    • java.lang.Boolean
    • java.util.Date
    • java.lang.String

    Note that for automatic recognition of data types to work, string representations of comma-separated values should be formed using invariant culture settings.

    • Constructor Summary

      Constructors 
      Constructor and Description
      CsvDataSource(java.io.InputStream csvStream)
      Creates a new data source with data from a CSV stream.
      CsvDataSource(java.io.InputStream csvStream, CsvDataLoadOptions options)
      Creates a new data source with data from a CSV stream.
      CsvDataSource(java.lang.String csvPath)
      Creates a new data source with data from a CSV file.
      CsvDataSource(java.lang.String csvPath, CsvDataLoadOptions options)
      Creates a new data source with data from a CSV file.
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CsvDataSource

        public CsvDataSource(java.lang.String csvPath)
                      throws java.lang.Exception
        Creates a new data source with data from a CSV file.
        Parameters:
        csvPath - The path to the CSV file to be used as the data source.
        Throws:
        java.lang.Exception
      • CsvDataSource

        public CsvDataSource(java.lang.String csvPath,
                             CsvDataLoadOptions options)
                      throws java.lang.Exception
        Creates a new data source with data from a CSV file.
        Parameters:
        csvPath - The path to the CSV file to be used as the data source.
        options - Options for parsing the CSV data.
        Throws:
        java.lang.Exception
      • CsvDataSource

        public CsvDataSource(java.io.InputStream csvStream)
                      throws java.lang.Exception
        Creates a new data source with data from a CSV stream.
        Parameters:
        csvStream - The stream of CSV data to be used as the data source.
        Throws:
        java.lang.Exception
      • CsvDataSource

        public CsvDataSource(java.io.InputStream csvStream,
                             CsvDataLoadOptions options)
                      throws java.lang.Exception
        Creates a new data source with data from a CSV stream.
        Parameters:
        csvStream - The stream of CSV data to be used as the data source.
        options - Options for parsing the CSV data.
        Throws:
        java.lang.Exception