A node.js service for running Word Macros remotely

Word macros allow document creators to correct document  errors and fine tune the document formatting. Running the macros programatically through Word automation allows to automate the process for added benefits. There are a number of tools and processes that do this with  RPE being one of them.

Running macros is limited to the Windows platform  and it’s subject to additional limitations such as Word automation not being supported from NT Services ( as it’s the case for running RPE/RRDG running in WAS or Tomcat in Service mode).

To enable macros to run in situations where Word or Word automation is not available the solution is to execute the macros remotely by a dedicated service. Microsoft offers such a service in the form of Word Automation Services. Another solution, the one described in this article, is to a service that runs the macros through Word automation. The caveat of this service is that it cannot run as an NT service, it must run in an interactive desktop ( Apache Tomcat in console mode or node.js).

DISCLAIMER: The solution described in this article is provided as-is without warranty of any kind, express or implied. The service is not part of RPE and it is not supported by IBM.

Continue reading “A node.js service for running Word Macros remotely”

Advertisements

Generate PowerPoint ready documents with RPE

RPE does not generate PowerPoint natively. However Word can export a document in PowerPoint and PowerPoint can load Word documents as presentations. This means that you can get the CLM/DOORS 9/Rhapsody data in PowerPoint format via Microsoft Word with RPE.

output_powerpoint
A PowerPoint presentation from a Word document

Continue reading “Generate PowerPoint ready documents with RPE”

Rhapsody Diagrams in EMF format

When producing a document from Rhapsody the diagrams will be generated in JPG format. For large/dense diagrams this is sub-optimal as the details of the diagrams become difficult to distinguish.

The solution for this is to request the diagrams in EMF format which is a combination of vector and bitmap graphics. Rhapsody’s Reportable REST API is set to generate JPG images by default but it can be made to return EMF instead.

Continue reading “Rhapsody Diagrams in EMF format”

A node.js chart service powered by Excel

Updated 17:15 EEST: added a diagram of the flow and updated chartServer.js

In a previous article I have shown how to use Excel to generate image charts with Microsoft Excel. In this article I will take this one step further and add a HTTP interface to that script so you can invoke it from a browser.

The ingredients are node.js and Microsoft Excel.  node.js offers an extremely lightweight ( 5.5 MB) framework to run a JavaScript server that receives HTTP requests, dispatches the requests to excelPieChart.vbs which in turn produces image charts via Excel. These images are served back as the response for the HTTP requests.

node_js

Installing and starting this server should take less than 2 minutes, with the biggest part of it being the download of node.js. The solution does not require any node.js modules other than the standard ones.

Using the service is even simpler:

Request

http://giediprime:8000/chart?labels="High|Medium|Low"&data="2|25|8"&title="node.js chart example"

Response
rpeactual_nodeJsCharts

Continue reading “A node.js chart service powered by Excel”

Charts in RPE Documents – the Excel OLE way

Expanding the solution described in Charts in RPE Documents – the Excel way it is possible to generate Excel chart and embed them in the RPE output Word document as an OLE object. For PDF a snapshot image of the OLE will be automatically generated by RPE.

rpeactual_ExcelOLEChart

This solution has several distinct advantages over the initial image based approach:

  1. the image scales better with the page size
  2. the chart can be further processed
  3. simpler to code and maintain in RPE
  4. greatly improved progress tracking and error information in the RPE console view

The example template and VB Script are available on the RPE devWorks examples wiki page: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Rational Publishing Engine/page/Examples

Continue reading “Charts in RPE Documents – the Excel OLE way”

Charts in RPE Documents – the Excel way

Updated on 2014.08.20, 20:00 EEST

RPE does not have native support for drawing charts so you need an external tool to generate the chart. Google Chart Tools: Image Charts have been used successfully in the past but it has been deprecated by Google in  2012 and it is unknown how it will work past 2015.

There are other online providers or applications that can be installed in LAN to provide a REST API for generating image charts. But these solutions may present security/confidentiality risks or additional effort in installing and maintaining them.

An alternative to this is using Microsoft Excel to create charts as Excel can be fully automated through Visual Basic Script which in turn can be invoked from RPE.

rpeactual_chart

Continue reading “Charts in RPE Documents – the Excel way”

JavaScript in RPE – tips,tricks and best practices

Continuing the series on using JavaScript in RPE I’d like to cover today some best practices on using JavaScript and some code snippets I found useful.

Best practices

A good set of best practices is described here and there are many other Web sites that document such practices:

I would like to highlight some of them and add a few that I found useful in my day to day usage:

  • indent the code
  • always declare the variables even if JavaScript does not require that
  • use a consistent naming convention. camelCase is a popular naming convention but any convention is good as long it is consistently used
  • even if not required you should always end each line with a semicolon
  • catch exceptions when using Java code ( see below)

Continue reading “JavaScript in RPE – tips,tricks and best practices”