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 Summary
Constructors Constructor Description StructureToJC4XL(OutputStream output)
Constructor for adding molecule/structure data one-by-one to store them in a JChemExcel workbook.StructureToJC4XL(org.apache.poi.ss.usermodel.Workbook wb, OutputStream output)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyColumnName(String propertyName, String displayName)
Sets the displayed name in the header column of the given propertyorg.apache.poi.ss.usermodel.Row
addStructure(byte[] structure, String fmt)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(byte[] structure, String fmt, String id, boolean showId)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(byte[] structure, String fmt, Map<String,String> properties)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(byte[] structure, String fmt, Map<String,String> properties, String id, boolean showId)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(Molecule mol, String fmt)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(Molecule mol, String fmt, String id, boolean showId)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(String structure, String encoding, String fmt)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(String structure, String encoding, String fmt, String id, boolean showId)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(String structure, String encoding, String fmt, Map<String,String> properties)
A single structure can be added to the worksheet, in the current roworg.apache.poi.ss.usermodel.Row
addStructure(String structure, String encoding, String fmt, Map<String,String> properties, String id, boolean showId)
A single structure can be added to the worksheet, in the current rowvoid
clearAllCellStyle()
Clears all the previously set cell style of the property columnsvoid
clearAllColumnWidth()
Clears all the previously set width of the property columnsvoid
clearPropertyColumnNames()
Clears the display name list of propertiesvoid
finalize()
void
finish()
Finishes the export operation, the workbook flushed and closedorg.apache.poi.ss.usermodel.CellStyle
getDefaultStyle()
Returns the style applied for the value cells of the columns having no explicit formatting.org.apache.poi.ss.usermodel.CellStyle
getHeaderStyle()
returns the cell style applied to the header rowString
getSheetName()
Returns the sheet name the structures added to.int
getStartColumn()
int
getStructureCellHeight()
int
getStructureCellWidth()
int
getStructureColumnIndex()
String
getStructureColumnName()
org.apache.poi.ss.usermodel.Workbook
getWorkbook()
Returns the Workbook object model instancestatic org.apache.poi.ss.usermodel.Workbook
readWorkbook(InputStream input)
Loads a workbook from anInputStream
void
setCellStyle(String propertyName, org.apache.poi.ss.usermodel.CellStyle cellStyle)
Sets the cell style of the property column with the given namevoid
setColumnWidth(String propertyName, int width)
Sets the column width of property column with the given namevoid
setDefaultStyle(org.apache.poi.ss.usermodel.CellStyle style)
Sets the cell style applied for the value cells of the columns having no explicit formatting.void
setHeaderStyle(org.apache.poi.ss.usermodel.CellStyle cellStyle)
Sets the cell style for the header rowvoid
setSheetName(String sheetName)
Sets the sheet name the structures/molecules added to.void
setStartColumn(int startColumn)
void
setStartRow(int startRow)
void
setStructureCellHeight(int height)
Sets the height of the structure cell.void
setStructureCellWidth(int width)
Sets the width of the structure cell in 1/256 of normal character width.void
setStructureColumnIndex(int idx)
void
setStructureColumnName(String name)
void
showHeader(boolean show)
-
-
-
Constructor Detail
-
StructureToJC4XL
public StructureToJC4XL(org.apache.poi.ss.usermodel.Workbook wb, OutputStream output) throws FileNotFoundException, chemaxon.license.LicenseException, IOException
- Throws:
FileNotFoundException
chemaxon.license.LicenseException
IOException
-
StructureToJC4XL
public StructureToJC4XL(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:
output
- the stream to be written the workbook to- Throws:
FileNotFoundException
chemaxon.license.LicenseException
-
-
Method Detail
-
readWorkbook
public static org.apache.poi.ss.usermodel.Workbook readWorkbook(InputStream input) throws IOException
Loads a workbook from anInputStream
- 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 aCellStyle
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 namedisplayName
- 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 propertywidth
- 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 propertycellStyle
- 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 objectfmt
- 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 objectfmt
- the format of the structure stringid
- 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 formatencoding
- the structure string character encodingfmt
- 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 formatencoding
- the structure string character encodingfmt
- the format of the structure stringid
- 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 formatfmt
- 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 formatfmt
- the format of the structure stringid
- 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 formatencoding
- the structure string character encodingfmt
- the format of the structure stringproperties
- 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 formatencoding
- the structure string character encodingfmt
- the format of the structure stringproperties
- a list of properties, whose values will be inserted right beside the structureid
- 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 formatfmt
- the format of the structure stringproperties
- 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 formatfmt
- the format of the structure stringproperties
- a list of properties, whose values will be inserted right beside the structureid
- an Id for the structure also added to the cell (as =JCIDSYSStructure(...,id))- Returns:
- the Row object created
- Throws:
IOException
UnsupportedOperationException
-
finalize
public void finalize() throws Throwable
-
finish
public void finish() throws IOException
Finishes the export operation, the workbook flushed and closed- Throws:
IOException
-
-