Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 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 19:35 Go to next message
anna.w.teittinen is currently offline anna.w.teittinen
Messages: 23
Registered: February 2011
Junior Member
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 21:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

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 22:51 Go to previous messageGo to next message
anna.w.teittinen is currently offline anna.w.teittinen
Messages: 23
Registered: February 2011
Junior Member
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 22:58 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

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 23:42 Go to previous message
anna.w.teittinen is currently offline anna.w.teittinen
Messages: 23
Registered: February 2011
Junior Member
Hello Jason,

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

--Anna
Previous Topic:Complex algorithm for generating a BIRT table
Next Topic:How to update a PriChart with new datas
Goto Forum:
  


Current Time: Mon Oct 20 11:28:32 GMT 2014

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

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