Class JChemExcelAPI


  • @PublicAPI
    public class JChemExcelAPI
    extends Object
    Low-level API to create JChemExcel files
    Since:
    Marvin 5.12
    • Constructor Summary

      Constructors 
      Constructor Description
      JChemExcelAPI​(org.apache.poi.ss.usermodel.Workbook wb, OutputStream output)
      Constructor for adding molecule/structure data one-by-one to store them in a JChemExcel workbook.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, byte[] structureData)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, byte[] structureData, String format)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, byte[] structureData, String id, boolean showId)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, byte[] structureData, String format, String id, boolean showId)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, Molecule molecule, String targetFormat)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, Molecule molecule, String targetFormat, String id, boolean showId)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, String structure)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, String structure, String format)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, String structure, String id, boolean showId)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName, int columnIndex, int rowIndex, String structure, String format, String id, boolean showId)
      Adds a structure to the cell in the given column/row on the sheet with the given name.
      void finalize()  
      void finish()
      Writes the workbook to the stream, and closes the stream.
      org.apache.poi.ss.usermodel.Sheet getOrCreateWorksheet​(String worksheetName)  
      org.apache.poi.ss.usermodel.Workbook getWorkbook()
      Returns the Workbook object model instance
    • Constructor Detail

      • JChemExcelAPI

        public JChemExcelAPI​(org.apache.poi.ss.usermodel.Workbook wb,
                             OutputStream output)
                      throws FileNotFoundException,
                             chemaxon.license.LicenseException
        Constructor for adding molecule/structure data one-by-one to store them in a JChemExcel workbook. Structures/molecules can be added using addStructure() method overloads.
        Parameters:
        wb - the workbook the structures should be added to
        output - the stream to be written the workbook to
        Throws:
        FileNotFoundException
        chemaxon.license.LicenseException
    • Method Detail

      • getWorkbook

        public org.apache.poi.ss.usermodel.Workbook getWorkbook()
        Returns the Workbook object model instance
      • getOrCreateWorksheet

        public org.apache.poi.ss.usermodel.Sheet getOrCreateWorksheet​(String worksheetName)
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             Molecule molecule,
                                                             String targetFormat)
                                                      throws IOException,
                                                             MolFormatException,
                                                             chemaxon.util.ArgumentException
        Adds a structure to the cell in the given column/row on the sheet with the given name.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        molecule - the molecule object of the structure
        targetFormat - the structure format the molecule will be stored on the structure-sheet
        Returns:
        the Cell object created
        Throws:
        IOException
        MolFormatException
        chemaxon.util.ArgumentException
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             Molecule molecule,
                                                             String targetFormat,
                                                             String id,
                                                             boolean showId)
                                                      throws IOException,
                                                             MolFormatException,
                                                             chemaxon.util.ArgumentException
        Adds a structure to the cell in the given column/row on the sheet with the given name.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        molecule - the molecule object of the structure
        targetFormat - the structure format the molecule will be stored on the structure-sheet
        id - an Id for the structure also added to the cell (as =JCIDSYSStructure(...,id))
        showId - shows the Id instead of the structure by default
        Returns:
        the Cell object created
        Throws:
        IOException
        MolFormatException
        chemaxon.util.ArgumentException
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             String structure)
                                                      throws MolFormatException,
                                                             chemaxon.util.ArgumentException,
                                                             UnsupportedEncodingException,
                                                             IOException
        Adds a structure to the cell in the given column/row on the sheet with the given name. The structure format will be determined automatically, but it causes a substantial overhead compared to when the format also passed as a parameter.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        structure - the structure string
        Returns:
        the Cell object created
        Throws:
        MolFormatException
        chemaxon.util.ArgumentException
        UnsupportedEncodingException
        IOException
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             String structure,
                                                             String id,
                                                             boolean showId)
                                                      throws MolFormatException,
                                                             chemaxon.util.ArgumentException,
                                                             UnsupportedEncodingException,
                                                             IOException
        Adds a structure to the cell in the given column/row on the sheet with the given name. The structure format will be determined automatically, but it causes a substantial overhead compared to when the format also passed as a parameter.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        structure - the structure string
        id - an Id for the structure also added to the cell (as =JCIDSYSStructure(...,id))
        Returns:
        the Cell object created
        Throws:
        MolFormatException
        chemaxon.util.ArgumentException
        UnsupportedEncodingException
        IOException
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             byte[] structureData)
                                                      throws MolFormatException,
                                                             chemaxon.util.ArgumentException,
                                                             IOException,
                                                             UnsupportedOperationException
        Adds a structure to the cell in the given column/row on the sheet with the given name. The structure format will be determined automatically, but it causes a substantial overhead compared to when the format also passed as a parameter.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        structureData - the structure data byte-array
        Returns:
        the Cell object created
        Throws:
        MolFormatException
        chemaxon.util.ArgumentException
        IOException
        UnsupportedOperationException
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             byte[] structureData,
                                                             String id,
                                                             boolean showId)
                                                      throws MolFormatException,
                                                             chemaxon.util.ArgumentException,
                                                             IOException,
                                                             UnsupportedOperationException
        Adds a structure to the cell in the given column/row on the sheet with the given name. The structure format will be determined automatically, but it causes a substantial overhead compared to when the format also passed as a parameter.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        structureData - the structure data byte-array
        id - an Id for the structure also added to the cell (as =JCIDSYSStructure(...,id))
        showId - shows the Id instead of the structure by default
        Returns:
        the Cell object created
        Throws:
        MolFormatException
        chemaxon.util.ArgumentException
        IOException
        UnsupportedOperationException
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             byte[] structureData,
                                                             String format)
                                                      throws UnsupportedOperationException,
                                                             IOException
        Adds a structure to the cell in the given column/row on the sheet with the given name.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        structureData - the structure data byte-array
        format - the structure data format
        Returns:
        the Cell object created
        Throws:
        UnsupportedOperationException
        IOException
      • addStructure

        public org.apache.poi.ss.usermodel.Cell addStructure​(String worksheetName,
                                                             int columnIndex,
                                                             int rowIndex,
                                                             byte[] structureData,
                                                             String format,
                                                             String id,
                                                             boolean showId)
                                                      throws UnsupportedOperationException,
                                                             IOException
        Adds a structure to the cell in the given column/row on the sheet with the given name.
        Parameters:
        worksheetName - sheet name of the structure added to
        columnIndex - the column-index of the cell the structure added to
        rowIndex - the row-index of the cell the structure added to
        structureData - the structure data byte-array
        format - the structure data format
        id - an Id for the structure also added to the cell (as =JCIDSYSStructure(...,id))
        showId - shows the Id instead of the structure by default
        Returns:
        the Cell object created
        Throws:
        UnsupportedOperationException
        IOException
      • finish

        public void finish()
                    throws IOException
        Writes the workbook to the stream, and closes the stream.
        Throws:
        IOException