Interface IDocumentTemplateWriter


@PublicAPI public 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 Type
    Method
    Description
    void
    Adds the molecule and its properties into the predefined template.
    void
    Adds the molecule and its properties into the predefined template.
    void
    Adds the array of molecule structures and their corresponding properties to the predefined template.
    void
    Adds the array of molecule structures and their corresponding properties to the predefined template.
    void
    Clear up resources collected during the report generation process.
    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
    Loads the molecule structure(s) and their corresponding properties from the given stream into the predefined template.
    void
    load(String filePath)
    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(String masterDocumentName, boolean deleteIntermediateItems)
    Merge all reported documents into one report file.
  • Method Details

    • addStructure

      void addStructure(IMoleculeData molecule) throws Exception
      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

      void addStructure(IMoleculeData molecule, ITemplateWriterOptions options) throws Exception
      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

      void addStructures(IMoleculeData[] molecules) throws Exception
      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

      void addStructures(IMoleculeData[] molecules, ITemplateWriterOptions options) throws Exception
      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
      options - - ITemplateWriterOptions that can be passed to influence the report e.g. with the reporting quality, file size etc.
      Throws:
      Exception
    • load

      void load(String filePath) throws Exception
      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

      void load(String filePath, ITemplateWriterOptions options) throws Exception
      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 loaded
      options - - ITemplateWriterOptions that can be passed to influence the report e.g. with the reporting quality, file size etc.
      Throws:
      Exception
    • load

      void load(InputStream stream) throws Exception
      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

      void load(InputStream stream, ITemplateWriterOptions options) throws Exception
      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 loaded
      options - - ITemplateWriterOptions that can be passed to influence the report e.g. with the reporting quality, file size etc.
      Throws:
      Exception
    • merge

      void merge(String masterDocumentName, boolean deleteIntermediateItems) throws Exception
      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

      String[] getReportedFiles() throws Exception
      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.