Creating a report with pre-defined elements via OpenAPI

Hi,

I am currently writing a plugin that will create a project with a custom model structure and a couple of pre-defined template reports.

For example,

Plugin call ‘Create New Basic Project’ creates a new project with three models - Analysis, Design, Implementation and Deployment.
The project and three empty models have some generic company-related text.

This I have been able to implement easily.

The next function of my plugin is to create a number of report that have a number of elements pre-added.

For example,

Plugin call ‘Create Basic Reports’ creates a new report with the following elements pre-added:

Table of contents
Page Break
Revision Log (matching the default available via VP directly, but built programmatically)
page break
Text block (Has heading as 'heading 1 (VP), then from next line text with no style)
page break
etc…

having problems with creating some elements

My questions are:

  1. The revision log - I wished to use the default style available through the report diagram interface via right click>Insert>Revision Log, since this is sufficient, but I seem to have to build this through code myself - see below (please note that the method call to addRevisionLogColumn is a method I create that creates a new IRDRevisionLogColumn object with a specified name and adds it to the passed IReportDiagramDetails object)

	protected static void addEmptyRevisionLog(IReportDiagramDetails reportDiagramDetails) {
		IRDRevisionLogTemplate revisionLogTemplate = reportDiagramDetails.createRDRevisionLogTemplate();
		addRevisionLogColumn(revisionLogTemplate, "Version");
		addRevisionLogColumn(revisionLogTemplate, "Date");
		addRevisionLogColumn(revisionLogTemplate, "A/C/D\n(Add, Change, Delete)");
		addRevisionLogColumn(revisionLogTemplate, "Author");
		addRevisionLogColumn(revisionLogTemplate, "Document Section #");
		addRevisionLogColumn(revisionLogTemplate, "Description");
		
		IRDRevisionLogRow row = revisionLogTemplate.createRDRevisionLogRow();
		revisionLogTemplate.addRow(row);
		
		IRDStyleRepository styleRepository = reportDiagramDetails.createRDStyleRepository();
		ApplicationManager.instance().getReportManager().initDefaultRDStyleRepository(styleRepository);
		IRDStyle headerStyle = styleRepository.getRDStyleByName("Revision Log Header");
		revisionLogTemplate.setHeaderStyle(headerStyle.getName());
				
		reportDiagramDetails.addTemplate(revisionLogTemplate);
	}

Is there an OpenAPI method call to produce the default version, rather than re-creating it ourselves?

  1. I am having problems adding a ‘text block’ with varying styles(mainly through lack of relevant tutorials or API javadoc). I enclose a screen shot of what I am trying to achieve programmatically. i am trying to do this via the code below:

protected static void addText(IReportDiagramDetails reportDiagramDetails) {
		IRDOOTemplate template = reportDiagramDetails.createRDOOTemplate();
		IRDText text = template.createRDText();
		text.setHtmlContent(false);
		text.setStyle("Heading 1 (VP)");
		text.setContent("This is some text");
		text.setFontSize(16);
		IRDGroupItem groupItem = template.createRDGroupItem();
		groupItem.addRDText(text);
		template.addRDGroupItem(groupItem);
		
		reportDiagramDetails.addTemplate(template);
	}
	

All i get is an ‘empty’ element on the report - see other screen shot.

can anyone help me with these two questions?

Thanks
Paddy

stuff.png
stuff2.png