Skip to main content



      Home
Home » Archived » BIRT » Generating DOC file using BIRT RE API(Unable to view the generated DOC file in some cases)
Generating DOC file using BIRT RE API [message #657174] Tue, 01 March 2011 14:35 Go to next message
Eclipse UserFriend
Hello,

I was wondering if anyone can help me with this issue.
I was not able to find much documentation on how to create a DOC file using the BIRT RE API.
I have a very simple stand alone JAVA application that uses the BIRT RE API. The code I have, based on my online research is:

----------------------
EngineConfig config = new EngineConfig( );

//Set the logging directory.
String directoryName=null;//when set to null, will log to std out.
config.setLogConfig(directoryName, Level.FINE);

//Start the platform to load the appropriate plugins.
//If using RE API in Eclipse/RCP application this is not needed.
Platform.startup( config );

//
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
engine.changeLogLevel( Level.WARNING );

//Load the report.
IReportRunnable report = engine.openReportDesign("C:\\BIRT_MySQL\\test\\CustomersToEmployees.rptdesign ");
String reportName=report.getReportName();
System.out.println("ReportName=" + reportName);

//Create task to run the report - use the task to execute the report and save to disk.
IRunAndRenderTask task = engine.createRunAndRenderTask(report);

//Set the RenderOption to create a DOC file into the task.
IRenderOption options = new RenderOption();
options.setOutputFileName("C:\\BIRT_MySQL\\test\\CustomersToEmployees.doc ");
options.setOutputFormat("doc");
task.setRenderOption(options);

//run and render report
task.run();
task.close();
//
engine.destroy();
Platform.shutdown();
----------------------

The code does generate the DOC file. When I double click on the generated DOC file, the DOC file opens up and shows contents nicely on my Word 2003.

As another test, when I emailed this file to myself using gmail, and tried to open it using the Google Docs, I get the following error message:
"This file could not be imported because the version of this file format is unsupported."

I have opened up other Word DOCs fine within gmail without any problems.

Does anyone know if I need to set a version within the code? If so, how would I do it? Or, do I need to make other method calls?

Thanks so much in advance,
--Anna
Re: Generating DOC file using BIRT RE API [message #657198 is a reply to message #657174] Tue, 01 March 2011 16:59 Go to previous messageGo to next message
Eclipse UserFriend
Anna,

The word emitter uses WordML xml format. I am not certain google docs
supports this.

Jason

On 3/1/2011 2:35 PM, Anna T. wrote:
> Hello,
>
> I was wondering if anyone can help me with this issue.
> I was not able to find much documentation on how to create a DOC file
> using the BIRT RE API.
> I have a very simple stand alone JAVA application that uses the BIRT RE
> API. The code I have, based on my online research is:
>
> ----------------------
> EngineConfig config = new EngineConfig( );
>
> //Set the logging directory.
> String directoryName=null;//when set to null, will log to std out.
> config.setLogConfig(directoryName, Level.FINE);
>
> //Start the platform to load the appropriate plugins.
> //If using RE API in Eclipse/RCP application this is not needed.
> Platform.startup( config );
>
> //
> IReportEngineFactory factory = (IReportEngineFactory) Platform
> .createFactoryObject(
> IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
> engine = factory.createReportEngine( config );
> engine.changeLogLevel( Level.WARNING );
>
> //Load the report.
> IReportRunnable report =
> engine.openReportDesign("C:\\BIRT_MySQL\\test\\CustomersToEmployees.rptdesign
> ");
> String reportName=report.getReportName();
> System.out.println("ReportName=" + reportName);
>
> //Create task to run the report - use the task to execute the report and
> save to disk.
> IRunAndRenderTask task = engine.createRunAndRenderTask(report);
>
> //Set the RenderOption to create a DOC file into the task.
> IRenderOption options = new RenderOption();
> options.setOutputFileName("C:\\BIRT_MySQL\\test\\CustomersToEmployees.doc ");
>
> options.setOutputFormat("doc");
> task.setRenderOption(options);
>
> //run and render report
> task.run();
> task.close();
> //
> engine.destroy();
> Platform.shutdown();
> ----------------------
>
> The code does generate the DOC file. When I double click on the
> generated DOC file, the DOC file opens up and shows contents nicely on
> my Word 2003.
>
> As another test, when I emailed this file to myself using gmail, and
> tried to open it using the Google Docs, I get the following error message:
> "This file could not be imported because the version of this file format
> is unsupported."
>
> I have opened up other Word DOCs fine within gmail without any problems.
>
> Does anyone know if I need to set a version within the code? If so, how
> would I do it? Or, do I need to make other method calls?
>
> Thanks so much in advance,
> --Anna
Re: Generating DOC file using BIRT RE API [message #657207 is a reply to message #657198] Tue, 01 March 2011 17:51 Go to previous messageGo to next message
Eclipse UserFriend
Hello Jason,

I asked a friend of mine who has Microsoft Word 2002 to try to open the DOC file (that I generated using the RE API).

This time, a Microsoft Word dialog came up with the following error:
"Word cannot start the converter mswrd632.wpc."

Does anybody recognize this error message?

So, for some reason, the DOC file opens fine in Word 2003 but not in Word 2002 nor Google Docs.

Has anyone successfully created a DOC file using the RE API?

Thanks so much,
--Anna
Re: Generating DOC file using BIRT RE API [message #657212 is a reply to message #657207] Tue, 01 March 2011 17:58 Go to previous messageGo to next message
Eclipse UserFriend
Anna,

The format is a word 2003 format and will not open in earlier versions
of word.

Jason

On 3/1/2011 5:51 PM, Anna T. wrote:
> Hello Jason,
>
> I asked a friend of mine who has Microsoft Word 2002 to try to open the
> DOC file (that I generated using the RE API).
>
> This time, a Microsoft Word dialog came up with the following error:
> "Word cannot start the converter mswrd632.wpc."
>
> Does anybody recognize this error message?
>
> So, for some reason, the DOC file opens fine in Word 2003 but not in
> Word 2002 nor Google Docs.
>
> Has anyone successfully created a DOC file using the RE API?
>
> Thanks so much,
> --Anna
>
Re: Generating DOC file using BIRT RE API [message #657216 is a reply to message #657198] Tue, 01 March 2011 18:42 Go to previous messageGo to next message
Eclipse UserFriend
Hello Jason,

Thank you very much again for your insights.
I will research now whether Google Docs supports the WordML xml format.

--Anna
Re: Generating DOC file using BIRT RE API [message #1786771 is a reply to message #657216] Fri, 11 May 2018 02:30 Go to previous message
Eclipse UserFriend
did you make it to open the doc files in google docs ?
Previous Topic:SQL: Combine Multiple rows with the same field
Next Topic:How to run a BIRT report through command line
Goto Forum:
  


Current Time: Mon Apr 14 18:01:26 EDT 2025

Powered by FUDForum. Page generated in 0.03337 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top