Interface IDocumentWriter
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStructure
(IMoleculeData molecule) Adds the molecule structure to the end of the document without it's propertiesvoid
addStructure
(IMoleculeData molecule, ISettings settings) Adds the molecule structure to the the document with the given settings without propertiesvoid
addStructureAndProperties
(IMoleculeData molecule, ISettings settings) Adds the molecule structure and all corresponding properties to the document with the give settingsvoid
addStructures
(IMoleculeData[] molecules) Adds the array of molecule structures and their corresponding properties to the end of the document.void
addStructures
(IMoleculeData[] molecules, ISettings settings) Adds the array of molecule structures and their corresponding properties to the location given in the settings.void
addStructures
(IMoleculeData[] molecules, ISettings settings, int structurePerPage) Adds the array of molecule structures and their corresponding properties to the document with the give settingsaddTable
(ITableModel table) Adds the table custom table to the and of the Documentvoid
close()
Closes the office Document stream.createTableModel
(int rowCount, int columnCount) Creates a custom table for the structure dataReturns the next writable position at the end of the Documentvoid
load
(InputStream stream, int structurePerPage) Loads the molecule structure(s) and their corresponding properties from the given input stream into the end of the document.void
load
(InputStream stream, ISettings settings, int structurePerPage) Loads the molecule structure(s) and their corresponding properties from the given input stream into the location given in the settings.void
Loads the molecule structure(s) and their corresponding properties from the given file into the end of the document.void
Loads the molecule structure(s) and their corresponding properties from the given file into the document to the location given in the settings.
-
Method Details
-
addStructure
Adds the molecule structure to the end of the document without it's propertiesThe following is one example of the use of the addStructure. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); MoleculeData moleculeData = new MoleculeData("c1ccccc1", "smiles", "CD-001"); writer.addStructure(moleculeData);
- Parameters:
molecule
- - IMoleculeData what should be written to the end of the edited document- Throws:
MolFormatException
IOException
-
addStructure
void addStructure(IMoleculeData molecule, ISettings settings) throws MolFormatException, IOException Adds the molecule structure to the the document with the given settings without propertiesThe following is one example how to use the addStructure. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); JpegExporter exporter = JpegExporter.builder().aromatization(AromatizationMethod.AROMATIZATION_GENERAL) .hydrogenize(HydrogenizeOption.EXPLICITIZE).showValenceError().build(); ISettings settings = new ReportSettings(new Location(0, 0, 1), exporter); settings.setDefaultStructureCellHeight(200); settings.setDefaultStructureCellWidth(200); IMoleculeData moleculeData = new MoleculeData("c1ccccc1", "smiles", "CD-001"); writer.addStructure(moleculeData, settings); writer.close();
- Parameters:
molecule
- - IMoleculeData what should be added to the edited documentsettings
- - Composite object what describes the location where the structure should be inserted and the options for structure rendering- Throws:
MolFormatException
IOException
-
addStructureAndProperties
void addStructureAndProperties(IMoleculeData molecule, ISettings settings) throws MolFormatException, IOException Adds the molecule structure and all corresponding properties to the document with the give settingsThe following is one example how to use the addStructureAndProperties. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); JpegExporter exporter = JpegExporter.builder().aromatization(AromatizationMethod.AROMATIZATION_GENERAL) .hydrogenize(HydrogenizeOption.EXPLICITIZE).showValenceError().build(); ISettings settings = new ReportSettings(new Location(0, 0, 1), exporter); settings.setDefaultStructureCellHeight(200); settings.setDefaultStructureCellWidth(200); IMoleculeData moleculeData = new MoleculeData("c1ccccc1", "smiles", "CD-001"); moleculeData.getMolecule().setProperty("TestProp", "CD-001_TestPropValue"); moleculeData.getMolecule().setProperty("TestProp2", "CD-001_TestPropValue2"); writer.addStructureAndProperties(moleculeData, settings); writer.close();
- Parameters:
molecule
- - IMoleculeData what should be added to the edited documentsettings
- - Composite object what describes the location where the structure should be inserted and the options for structure rendering- Throws:
MolFormatException
IOException
-
addStructures
void addStructures(IMoleculeData[] molecules, ISettings settings, int structurePerPage) throws MolFormatException, IOException Adds the array of molecule structures and their corresponding properties to the document with the give settingsThe following is one example how to use the addStructures. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); JpegExporter exporter = JpegExporter.builder().aromatization(AromatizationMethod.AROMATIZATION_GENERAL) .hydrogenize(HydrogenizeOption.EXPLICITIZE).showValenceError().build(); ISettings settings = new ReportSettings(new Location(0, 0, 1), exporter); settings.setDefaultStructureCellHeight(200); settings.setDefaultStructureCellWidth(200); MoleculeData moleculeData = new MoleculeData("c1ccccc1", "smiles", "CD-001"); moleculeData.getMolecule().setProperty("TestProp", "CD-001_TestPropValue"); moleculeData.getMolecule().setProperty("TestProp2", "CD-001_TestPropValue2"); moleculeData.getMolecule().setProperty("TestProp3", "CD-001_TestPropValue3"); MoleculeData moleculeData2 = new MoleculeData("c1ccccccc1", "smiles", "CD-002"); moleculeData2.getMolecule().setProperty("TestProp", "CD-002_TestPropValue"); moleculeData2.getMolecule().setProperty("TestProp2", "CD-002_TestPropValue2"); writer.addStructures(new IMoleculeData[] { moleculeData, moleculeData2 }, settings, 5); writer.close();
- Parameters:
molecules
- - Array of IMoleculeData what should be added to the edited documentsettings
- - Composite object what describes the location where the structures should be inserted and the options for structure renderingstructurePerPage
- - Defines how many structure should be written to a single page.- 1: Every page will contain 1 structure and the table of it's properties
- 2, ...: the structures will be displayed in tables together with their data. The tables will have 2,... number of rows per page.
- Throws:
MolFormatException
IOException
-
addStructures
Adds the array of molecule structures and their corresponding properties to the end of the document. 1 structure and it's property table per page. The structures are rendered with the default rendering settings.The following is one example how to use the addStructures. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); MoleculeData moleculeData = new MoleculeData("c1ccccc1", "smiles", "CD-001"); moleculeData.getMolecule().setProperty("TestProp", "CD-001_TestPropValue"); moleculeData.getMolecule().setProperty("TestProp2", "CD-001_TestPropValue2"); moleculeData.getMolecule().setProperty("TestProp3", "CD-001_TestPropValue3"); MoleculeData moleculeData2 = new MoleculeData("c1ccccccc1", "smiles", "CD-002"); moleculeData2.getMolecule().setProperty("TestProp", "CD-002_TestPropValue"); moleculeData2.getMolecule().setProperty("TestProp2", "CD-002_TestPropValue2"); writer.addStructures(new IMoleculeData[] { moleculeData, moleculeData2 }); writer.close();
- Parameters:
molecules
- - Array of IMoleculeData what should be added to the edited document- Throws:
MolFormatException
IOException
-
addStructures
void addStructures(IMoleculeData[] molecules, ISettings settings) throws MolFormatException, IOException Adds the array of molecule structures and their corresponding properties to the location given in the settings. 1 structure and it's property table per page. The structures are rendered based on the settings given as parameter.The following is one example how to use the addStructures. The code:
JpegExporter exporter = JpegExporter.builder().aromatization(AromatizationMethod.AROMATIZATION_GENERAL) .hydrogenize(HydrogenizeOption.EXPLICITIZE).showValenceError().build(); ISettings settings = new ReportSettings(new Location(0, 0, 1), exporter); settings.setDefaultStructureCellHeight(200); settings.setDefaultStructureCellWidth(200); IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); MoleculeData moleculeData = new MoleculeData("c1ccccc1", "smiles", "CD-001"); moleculeData.getMolecule().setProperty("TestProp", "CD-001_TestPropValue"); moleculeData.getMolecule().setProperty("TestProp2", "CD-001_TestPropValue2"); moleculeData.getMolecule().setProperty("TestProp3", "CD-001_TestPropValue3"); MoleculeData moleculeData2 = new MoleculeData("c1ccccccc1", "smiles", "CD-002"); moleculeData2.getMolecule().setProperty("TestProp", "CD-002_TestPropValue"); moleculeData2.getMolecule().setProperty("TestProp2", "CD-002_TestPropValue2"); writer.addStructures(new IMoleculeData[] { moleculeData, moleculeData2 }, settings); writer.close();
- Parameters:
molecules
- - Array of IMoleculeData what should be added to the edited documentsettings
- - Composite object what describes the location where the structure should be inserted and the options for structure rendering- Throws:
MolFormatException
IOException
-
load
Loads the molecule structure(s) and their corresponding properties from the given file into the end of the document. The structures will be rendered with default rendering settings.The following is one example how to use the load. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); writer.load("TestFiles/ShortSDF.sdf", 8); writer.close();
- Parameters:
filePath
- - The path of the file from where the structures will be loadedstructurePerPage
- - Defines how many structure should be written to a single page.- 1: Every page will contain 1 structure and the table of it's properties
- 2, ...: the structures will be displayed in tables together with their data. The tables will have 2,... number of rows per page.
- Throws:
IOException
-
load
Loads the molecule structure(s) and their corresponding properties from the given file into the document to the location given in the settings. The structures will be rendered as it is given in the settings.The following is one example how to use the load. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); writer.load("TestFiles/ShortSDF.sdf", 8); writer.close();
- Parameters:
filePath
- - The path of the file from where the structures will be loadedsettings
- : - Composite object what describes the location where the structures should be inserted and the options for structure renderingstructurePerPage
- - Defines how many structure should be written to a single page.- 1: Every page will contain 1 structure and the table of it's properties
- 2, ...: the structures will be displayed in tables together with their data. The tables will have 2,... number of rows per page.
- Throws:
IOException
-
load
Loads the molecule structure(s) and their corresponding properties from the given input stream into the end of the document. The structures will be rendered with default rendering settings.The following is one example how to use the load. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); writer.load(this.getClass().getResourceAsStream("TestFiles/ShortSDF.sdf"), 8); writer.close();
- Parameters:
stream
- - The input stream from where the structures will be loadedstructurePerPage
- - Defines how many structure should be written to a single page.- 1: Every page will contain 1 structure and the table of it's properties
- 2, ...: the structures will be displayed in tables together with their data. The tables will have 2,... number of rows per page.
- Throws:
IOException
-
load
Loads the molecule structure(s) and their corresponding properties from the given input stream into the location given in the settings. The structures will be rendered as it is given in the settings.The following is one example how to use the load. The code:
IDocumentWriter writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath()); writer.load(this.getClass().getResourceAsStream("TestFiles/ShortSDF.sdf"), 8); writer.close();
- Parameters:
stream
- - The input stream from where the structures will be loadedsettings
- : - Composite object what describes the location where the structures should be inserted and the options for structure renderingstructurePerPage
- - Defines how many structure should be written to a single page.- 1: Every page will contain 1 structure and the table of it's properties
- 2, ...: the structures will be displayed in tables together with their data. The tables will have 2,... number of rows per page.
- Throws:
IOException
-
createTableModel
Creates a custom table for the structure dataThe following is one example how to use the createTableModel. The code:
writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath());
ITableModel model = writer.createTableModel(2, 2); ITableCell cell = model.getItem(0, 0); cell.getData().Assign(new MoleculeData("C=C", "smiles", "CD-001")); cell.getFormat().setWidth(100); cell.getFormat().setHeight(100); cell.getFormat().setBackColor(Color.GREEN); cell.getFormat().setAlignment(FontAlignment.BottomCenter); ITableCell cell2 = model.getItem(0, 1); cell2.getData().Assign("Test1"); cell2.getFormat().setForeColor(Color.YELLOW); cell2.getFormat().setBackColor(Color.ORANGE); cell2.getFormat().setAlignment(FontAlignment.BottomRight); ITableCell cell3 = model.getItem(1, 0); cell3.getData().Assign("Test2"); cell3.getFormat().setForeColor(Color.GREEN); cell3.getFormat().setBackColor(Color.RED); cell3.getFormat().setAlignment(FontAlignment.BottomLeft); ITableCell cell4 = model.getItem(1, 1); cell4.getData().Assign(new MoleculeData("C=C", "smiles", "CD-002")); cell4.getFormat().setWidth(100); cell4.getFormat().setHeight(100); cell4.getFormat().setBackColor(Color.GREEN); cell4.getFormat().setAlignment(FontAlignment.BottomCenter); writer.addTable(model);
writer.close();
- Parameters:
rowCount
- - The number of rows in the custom tablecolumnCount
- - The number of columns in the custom table- Returns:
- ITableModel
-
addTable
Adds the table custom table to the and of the DocumentThe following is one example how to use the addTable. The code:
writer = DocumentHandlerFactory.createDocumentWriter(DocumentType.PPT, testFile.getPath());
ITableModel model = writer.createTableModel(2, 2); ITableCell cell = model.getItem(0, 0); cell.getData().Assign(new MoleculeData("C=C", "smiles", "CD-001")); cell.getFormat().setWidth(100); cell.getFormat().setHeight(100); cell.getFormat().setBackColor(Color.GREEN); cell.getFormat().setAlignment(FontAlignment.BottomCenter); ITableCell cell2 = model.getItem(0, 1); cell2.getData().Assign("Test1"); cell2.getFormat().setForeColor(Color.YELLOW); cell2.getFormat().setBackColor(Color.ORANGE); cell2.getFormat().setAlignment(FontAlignment.BottomRight); ITableCell cell3 = model.getItem(1, 0); cell3.getData().Assign("Test2"); cell3.getFormat().setForeColor(Color.GREEN); cell3.getFormat().setBackColor(Color.RED); cell3.getFormat().setAlignment(FontAlignment.BottomLeft); ITableCell cell4 = model.getItem(1, 1); cell4.getData().Assign(new MoleculeData("C=C", "smiles", "CD-002")); cell4.getFormat().setWidth(100); cell4.getFormat().setHeight(100); cell4.getFormat().setBackColor(Color.GREEN); cell4.getFormat().setAlignment(FontAlignment.BottomCenter); writer.addTable(model);
writer.close();
- Parameters:
table
- - The table what will be added to the Document- Returns:
- The location of the added table
- Throws:
IOException
-
getAppendLocation
Returns the next writable position at the end of the Document- Returns:
- Location object
- Throws:
IOException
-
close
Closes the office Document stream.- Throws:
IOException
-