Generate Electronic Reporting Format as Byte Array

In this article, we will show you how to generate an Electronic reporting format in its original file format as a byte array. If this original file format is Excel or Word, you will be able to print the ER Format to memory in PDF format as well.

One would think that printing ER Formats to memory is easy to achieve. Wrong! It's actually quite complex to understand and implement, so we created a helper class to make it easier for you.

Helper class DocERFormatGenerator

This helper class is called DocERFormatGenerator and uses:

  • ERFileDestinationMemory - the Memory print destination, which is not visible on the ER destination settings form, but you can use it for custom scenarios, when you need to print a report to memory.
  • Microsoft Office Conversion Service - to convert Word and Excel documents to PDF, if you require so.

The DocERFormatGenerator class extends SysOperationServiceBase and it requires the ER report controller and data contract, while it bypasses the ER report service class. Instead, DocERFormatGenerator generates the report using the ERFormatMappingRun class with the built-in ERFileDestinationMemory destination:

The DocERFormatGenerator class works only for SysOperation-based ER reports, and you cannot use it for ERReportLauncher-based ER reports.

Learn more about ERReportLauncher reports >>

How to use the DocERFormatGenerator class

We also created a tutorial class, DocTutorialERFormatGenerator, which demonstrates on the example of the Fixed asset roll forward report (AssetRollForward), how to use the DocERFormatGenerator class.

AssetRollForward is an ER report, based on the SysOperation framework. Let's take a walkthrough on how to print this report to memory using DocERFormatGenerator. This helper class is an abstract class, so basically you need to extend it and implement three abstract methods, as we did in the DocTutorialERFormatGenerator class for the AssetRollForward report.

We also included the main() method, to demonstrate printing to Memory in action.

Both DocERFormatGenerator and DocTutorialERFormatGenerator classes are part of Docentric Free Edition, which you can download and use completely for free.

Leave a Reply

Your email address will not be published. Required fields are marked *


Docentric respects your privacy. Learn how your comment data is processed >>

Docentric respects your privacy. Learn how your comment data is processed >>