Interface IDocumentTemplateWriter
The IDocumentTemplateWriter interface offers the functionality to report chemical information in a predefined template.
Tags help the user editing the template to position the place holders for entities accordingly.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStructure
(IMoleculeData molecule) Adds the molecule and its properties into the predefined template.void
addStructure
(IMoleculeData molecule, ITemplateWriterOptions options) Adds the molecule and its properties into the predefined template.void
addStructures
(IMoleculeData[] molecules) Adds the array of molecule structures and their corresponding properties to the predefined template.void
addStructures
(IMoleculeData[] molecules, ITemplateWriterOptions options) Adds the array of molecule structures and their corresponding properties to the predefined template.void
close()
Clear up resources collected during the report generation process.String[]
Return list of all successfully generated report file paths so far.void
load
(InputStream stream) Loads the molecule structure(s) and their corresponding properties from the given stream into the predefined template.void
load
(InputStream stream, ITemplateWriterOptions options) Loads the molecule structure(s) and their corresponding properties from the given stream into the predefined template.void
Loads the molecule structure(s) and their corresponding properties from the given file into the predefined template.void
load
(String filePath, ITemplateWriterOptions options) Loads the molecule structure(s) and their corresponding properties from the given file into the predefined template.void
Merge all reported documents into one report file.
-
Method Details
-
addStructure
Adds the molecule and its properties into the predefined template.The following is one example of the use of the addStructure. The code:
IDocumentTemplateWriter writer = DocumentHandlerFactory.createDocumentTemplateWriter(DocumentType.PPT, stream, folder); Molecule molecule = MolImporter.importMol("C1=CC=CC=C1"); molecule.properties().set("Mass", new MStringProp(String.valueOf(molecule.getMass()))); writer.addStructure(new MoleculeData(molecule));
- Parameters:
molecule
- - IMoleculeData that is reported/filled into the template.- Throws:
Exception
-
addStructure
Adds the molecule and its properties into the predefined template.The following is one example of the use of the addStructure. The code:
IDocumentTemplateWriter writer = DocumentHandlerFactory.createDocumentTemplateWriter(DocumentType.PPT, stream, folder); Molecule molecule = MolImporter.importMol("C1=CC=CC=C1"); molecule.properties().set("Mass", new MStringProp(String.valueOf(molecule.getMass()))); writer.addStructure(new MoleculeData(molecule), new TemplateWriterOptions());
- Parameters:
molecule
- - IMoleculeData that is reported/filled into the template.options
- - ITemplateWriterOptions that can be passed to influence the report e.g. with the reporting quality, file size etc.- Throws:
Exception
-
addStructures
Adds the array of molecule structures and their corresponding properties to the predefined template.The following is one example how to use the addStructures. The code:
- Parameters:
molecules
- - Array of IMoleculeData what should be added to the edited document- Throws:
Exception
-
addStructures
Adds the array of molecule structures and their corresponding properties to the predefined template.The following is one example how to use the addStructures. The code:
- Parameters:
molecules
- - Array of IMoleculeData what should be added to the edited documentoptions
- - ITemplateWriterOptions that can be passed to influence the report e.g. with the reporting quality, file size etc.- Throws:
Exception
-
load
Loads the molecule structure(s) and their corresponding properties from the given file into the predefined template.The following is one example how to use the load. The code:
IDocumentTemplateWriter writer = DocumentHandlerFactory.createDocumentTemplateWriter(DocumentType.PPT, stream, folder); writer.load("ShortSDF.sdf");
- Parameters:
filePath
- - The path of the file from where the structures will be loaded- Throws:
Exception
-
load
Loads the molecule structure(s) and their corresponding properties from the given file into the predefined template.The following is one example how to use the load. The code:
IDocumentTemplateWriter writer = DocumentHandlerFactory.createDocumentTemplateWriter(DocumentType.PPT, stream, folder); writer.load("ShortSDF.sdf", new TemplateWriterOptions());
- Parameters:
filePath
- - The path of the file from where the structures will be loadedoptions
- - ITemplateWriterOptions that can be passed to influence the report e.g. with the reporting quality, file size etc.- Throws:
Exception
-
load
Loads the molecule structure(s) and their corresponding properties from the given stream into the predefined template.The following is one example how to use the load. The code:
IDocumentTemplateWriter writer = DocumentHandlerFactory.createDocumentTemplateWriter(DocumentType.PPT, stream, folder); InputStream stream2 = this.getClass().getResourceAsStream("ShortSDF.sdf"); try{ writer.load(stream2); }finally { stream2.close(); }
- Parameters:
stream
- - The input stream from where the structures will be loaded- Throws:
Exception
-
load
Loads the molecule structure(s) and their corresponding properties from the given stream into the predefined template.The following is one example how to use the load. The code:
IDocumentTemplateWriter writer = DocumentHandlerFactory.createDocumentTemplateWriter(DocumentType.PPT, stream, folder); InputStream stream2 = this.getClass().getResourceAsStream("ShortSDF.sdf"); try{ writer.load(stream2, new TemplateWriterOptions()); }finally { stream2.close(); }
- Parameters:
stream
- - The input stream from where the structures will be loadedoptions
- - ITemplateWriterOptions that can be passed to influence the report e.g. with the reporting quality, file size etc.- Throws:
Exception
-
merge
Merge all reported documents into one report file.IDocumentTemplateWriter writer = DocumentHandlerFactory.createDocumentTemplateWriter(DocumentType.PPT, stream, folder); try{ InputStream stream2 = this.getClass().getResourceAsStream("ShortSDF.sdf"); try{ writer.load(stream2, new TemplateWriterOptions()); writer.merge("MasterDocument.dotx", true); }finally { stream2.close(); } }finally{ writer.close(); }
- Parameters:
masterDocumentName
- - The master document name that needs to be filled with the intermediate reports and written out to the report folder.deleteIntermediateItems
- - Option to delete all intermediate report files from the folder,- Throws:
Exception
-
getReportedFiles
Return list of all successfully generated report file paths so far. Note: if in the merge function is called with the deleteIntermediateItems flag then the list of reports will be deleted automatically.- Returns:
- - Array of report file paths.
- Throws:
Exception
-
close
void close()Clear up resources collected during the report generation process.
-