Open API Examples

I cannot comment the code you commented because that is the code that renders all the rest of the sections in my document. Let me explain please.

To Simplify this, the use case is as below

  1. Use Base Word Doc template that already is uploaded to Doc Composer Tools > Doc Composer > Manage Doc Templates > New - and then upload. It serves the purpose of providing a) Styles b) 1st Page i.e. Cover Page c) 2nd Page i.e. Document Information Page ( so I don’t want to do all this via Open API )

     	reportDiagramDetails.setDocBasePath(WORD_DOC_BASE_TEMPLATE_PATH);
    
  2. The 2nd page i.e. the Document Information Page of my generated document should contain information collected by Open API dialog from end user and passed to word doc ${TEXT, REVIEWER_NAME} as a example

     	IFIText variable = reportDiagramDetails.getFITextByName(name);
     	. . .
    
  3. Page 3 onwards of my generated document should render all following sections dynamically based on conditions
    a) Apply templates dynamically based on condition using Open API - Note: templates are chosen based on conditions of user input ( Open API Dialog )

     	IRDOOTemplate currentIRDOOTemplate = reportDiagramDetails.createRDOOTemplate();	
     	currentIRDOOTemplate.setTemplateURI(templateName);
     	currentIRDOOTemplate.setSourceType(1);
     	currentIRDOOTemplate.setSourceId(archiMateDiagram.getId());
    

    b) Apply layer filters dynamically based on condition using Open API - Note: layers are filtered based on conditions of user input ( Open API Dialog )

     	currentIRDOOTemplate.addLayerFilter(conditionalLayer);
    

    reportDiagramDetails.addTemplate(currentIRDOOTemplate);

  4. Generate the document programmatically

     `ApplicationManager.instance().getDocumentationManager().generateDocComposerWord(reportDiagramUIModel, new File(docName), null);`
    
  5. Open it directly automatically in front of user - something like

     	ApplicationManager.instance().getViewManager().showMessage("Generated at path: "+docName);
     	
     	if (Desktop.isDesktopSupported()) {
                 Desktop.getDesktop().open(new File(docName));
     	}