Class StructureToJC4XL

java.lang.Object
chemaxon.formats.documents.jchemexcel.StructureToJC4XL

@PublicAPI public class StructureToJC4XL extends Object
Adds molecule/structure data to a JChemExcel workbook.

example for adding multiple structures in a row ... c.setStartRow(r.getRowNum()); c.setStartColumn(1); c.addStructure(s, "utf8", m.getInputFormat()); c.setStartRow(r.getRowNum()); c.setStartColumn(2); c.addStructure(s, "utf8", m.getInputFormat(), p); c.setStartColumn(0);

Since:
Marvin 5.11
  • Constructor Details

  • Method Details

    • readWorkbook

      public static org.apache.poi.ss.usermodel.Workbook readWorkbook(InputStream input) throws IOException
      Loads a workbook from an InputStream
      Parameters:
      input - stream for an existing workbook
      Returns:
      the workbook instance created
      Throws:
      IOException
    • setDefaultStyle

      public void setDefaultStyle(org.apache.poi.ss.usermodel.CellStyle style)
      Sets the cell style applied for the value cells of the columns having no explicit formatting. Create a CellStyle object with getWorkbook().createCellStyle();
      Parameters:
      style - the CellStyle to set
    • getDefaultStyle

      public org.apache.poi.ss.usermodel.CellStyle getDefaultStyle()
      Returns the style applied for the value cells of the columns having no explicit formatting.
      Returns:
      the cell style
    • setStructureCellWidth

      public void setStructureCellWidth(int width)
      Sets the width of the structure cell in 1/256 of normal character width. "Actual column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font."
      Parameters:
      width - width of the cell
    • getStructureCellWidth

      public int getStructureCellWidth()
      Returns:
      the width of the structure cell
    • setStructureCellHeight

      public void setStructureCellHeight(int height)
      Sets the height of the structure cell.
    • getStructureCellHeight

      public int getStructureCellHeight()
      Returns:
      the height of the structure cell
    • setStructureColumnIndex

      public void setStructureColumnIndex(int idx)
    • getStructureColumnIndex

      public int getStructureColumnIndex()
    • getWorkbook

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

      public String getSheetName()
      Returns the sheet name the structures added to.
    • setSheetName

      public void setSheetName(String sheetName)
      Sets the sheet name the structures/molecules added to.
    • setStartRow

      public void setStartRow(int startRow)
      Parameters:
      startRow - the row number, where the insertion starts
    • setStartColumn

      public void setStartColumn(int startColumn)
      Parameters:
      startColumn - the column number, where the insertion starts
    • getStartColumn

      public int getStartColumn()
      Returns:
      the column number, where the insertion starts
    • showHeader

      public void showHeader(boolean show)
      Parameters:
      show - a row added to the sheet containing property names as column names
    • setStructureColumnName

      public void setStructureColumnName(String name)
      Parameters:
      name - sets the name of the structure column
    • getStructureColumnName

      public String getStructureColumnName()
      Returns:
      the name of the structure column
    • addPropertyColumnName

      public void addPropertyColumnName(String propertyName, String displayName)
      Sets the displayed name in the header column of the given property
      Parameters:
      propertyName - the structure/molecule property name
      displayName - the name displayed in the header row for the given property
    • clearPropertyColumnNames

      public void clearPropertyColumnNames()
      Clears the display name list of properties
    • setColumnWidth

      public void setColumnWidth(String propertyName, int width)
      Sets the column width of property column with the given name
      Parameters:
      propertyName - the name of the property
      width - the desired width of the property column in 1/256 of normal character width
    • clearAllColumnWidth

      public void clearAllColumnWidth()
      Clears all the previously set width of the property columns
    • setCellStyle

      public void setCellStyle(String propertyName, org.apache.poi.ss.usermodel.CellStyle cellStyle)
      Sets the cell style of the property column with the given name
      Parameters:
      propertyName - the name of the property
      cellStyle - the style to set
    • setHeaderStyle

      public void setHeaderStyle(org.apache.poi.ss.usermodel.CellStyle cellStyle)
      Sets the cell style for the header row
      Parameters:
      cellStyle - the style to set
    • getHeaderStyle

      public org.apache.poi.ss.usermodel.CellStyle getHeaderStyle()
      returns the cell style applied to the header row
      Returns:
      cell style
    • clearAllCellStyle

      public void clearAllCellStyle()
      Clears all the previously set cell style of the property columns
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(Molecule mol, String fmt) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      mol - the molecule object
      fmt - the format of the structure string
      Returns:
      the Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(Molecule mol, String fmt, String id, boolean showId) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      mol - the molecule object
      fmt - the format of the structure string
      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 Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(String structure, String encoding, String fmt) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in string format
      encoding - the structure string character encoding
      fmt - the format of the structure string
      Returns:
      the Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(String structure, String encoding, String fmt, String id, boolean showId) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in string format
      encoding - the structure string character encoding
      fmt - the format of the structure string
      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 Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(byte[] structure, String fmt) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in binary format
      fmt - the format of the structure string
      Returns:
      the Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(byte[] structure, String fmt, String id, boolean showId) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in binary format
      fmt - the format of the structure string
      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 Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(String structure, String encoding, String fmt, Map<String,String> properties) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in string format
      encoding - the structure string character encoding
      fmt - the format of the structure string
      properties - a list of properties, whose values will be inserted right beside the structure
      Returns:
      the Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(String structure, String encoding, String fmt, Map<String,String> properties, String id, boolean showId) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in string format
      encoding - the structure string character encoding
      fmt - the format of the structure string
      properties - a list of properties, whose values will be inserted right beside the structure
      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 Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(byte[] structure, String fmt, Map<String,String> properties) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in binary format
      fmt - the format of the structure string
      properties - a list of properties, whose values will be inserted right beside the structure
      Returns:
      the Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • addStructure

      public org.apache.poi.ss.usermodel.Row addStructure(byte[] structure, String fmt, Map<String,String> properties, String id, boolean showId) throws IOException, UnsupportedOperationException
      A single structure can be added to the worksheet, in the current row
      Parameters:
      structure - the molecule in binary format
      fmt - the format of the structure string
      properties - a list of properties, whose values will be inserted right beside the structure
      id - an Id for the structure also added to the cell (as =JCIDSYSStructure(...,id))
      Returns:
      the Row object created
      Throws:
      IOException
      UnsupportedOperationException
    • finish

      public void finish() throws IOException
      Finishes the export operation, the workbook flushed and closed
      Throws:
      IOException