Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
PPT file via engine API 2.6.2
mby
hi,
i upgrade my BIRT to v6.2.6 (i have 2.5.0 before) and try to generate PPT report via the BIRT enginge API.
and get the following error:
"The output format ppt is not supported".
(in the code wrote: renderOption.setOutputFormat("ppt"))
any idea?
thanks.
Find more posts tagged with
Comments
mwilliams
Can you post all of your code?
mby
see the function below:
try
{
IReportDocument reportDocument = birtEngineRef.openReportDocument(rptDocumentFileName);
IRenderTask renderTask = birtEngineRef.createRenderTask(reportDocument);
setTaskAppContext(renderTask.getAppContext(), 200); // max memory usage per report should be 200 MB
renderOption.setOutputFileName(generatedReportFileName);
renderOption.setOutputFormat("ppt");
renderOption.setSupportedImageFormats(supportedImageFormats);
renderTask.setRenderOption(renderOption) ; -- of type RenderOption
//generate
renderTask.render();
renderTask.close();
//update DB (RPT_W_GENERATED_REPORTS table) with end time and status of report generation
m_rptReportDao.updateReportGenerationStatus(ReportGenerationStatus.COMPLETED_SUCCESSFULLY, generatedId,
getReportfileSizeInKB(generatedReportFileName));
}
catch(Exception engineException)
{
m_rptReportDao.updateReportGenerationStatus(ReportGenerationStatus.FAILURE, generatedId, EMPTY_REPORT_SIZE);
throw engineException;
}
thanks!
JasonW
Are you trying to use versionT 2.6.2 or BIRT 3.7?
Did you upgrade/replace all libs? If you are using 2.6.2 did you replace the plugins folder in birt home and clear the configuration directory of everything but the config.ini?
Jason
mby
i replace the all BIRT runtime directory with the last 2.6.2 engine,
JasonW
So you point to the 2.6.2 runtime with the
config.setBIRTHome("C:\\birt-runtime-2_6_2\\ReportEngine"); ?
Did you update the classpath for the app to have the jars in the following directory in your classpath:
C:\birt-runtime-2_6_2\ReportEngine\lib ?
Jason
SudhakarA
Hi,
I'm using Birt Engine 3.7 and can able to generate PDF reports by invoking the Birt design file from Java code.
But can't able to generate report output in ppt file.
Can I get any sample Java code to generate report in PPT?
Thanks,
Sudhakar
JasonW
What render option are you using? This looks like it may be a bug. You should be able to use the generic class RenderOption, but that does not work. Can you log a bug for this. It should work if you use:
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFileName("output/resample/external5.ppt");
options.setOutputFormat("ppt");
Jason
SudhakarA
Thanks for the suggestion.
By your provided code, I can able to generate PPT report using Birt Engine 3.7. But no Charts are getting displayed, as it displays red x with the message as below -
"The image cannot be displayed, Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your system, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again."
I cross checked restarting my system, but no use, the problem still remains.
Tried executing the java file with "-Xmx512m" option as below, but still the problem remains same.
#] java -Xmx512m -cp ".:./lib/*" GenerateReport
Can you please provide your suggestions, for how to resolve this problem.
Thanks,
Sudhakar
SudhakarA
FYI...
My system is running with 4GB RAM, having enough memory space.
SudhakarA
FYI...
But the same if I'm doing for PDF report generation, its working and the charts are displayed, but the problem is with PPT report generation.
JasonW
What format are the charts in?
Can you try the attached TopNPercent report. It worked on my laptop with 3.7.
I did not set this argument for the API but you may want to add -XX:MaxPermSize=256M to the jvm args
Jason
SudhakarA
Hi Jason,
I tested with the below code with Birt Engine 3.7
HTMLRenderOption options = new HTMLRenderOption();
//options = new PDFRenderOption();
options.setImageHandler(new HTMLServerImageHandler());
options.setSupportedImageFormats("JPG;PNG;BMP;SVG;GIF");
options.setOutputStream(outputStream);
options.setOutputFormat("ppt");
And using the above code I can able to generate PPT file, but Charts are not getting displayed. I'm using MS Office 2007, attached PPT file I generated through Birt Engine 3.7 using Java code.
Problem in Details:
1) Generated PPT file was able to open in MS Office 2007, but charts are not getting displayed.
2) Generated PPT file was not at all able to open MS Office 2010.
3) It seems the geneated PPT format type is "Microsoft Office PowerPoint 97-2003 Presentation", and unfortunately I don't have MS Office 2003 to test.
I can't able to attach Generated PPT file in the forum because there is some restriction it-seems, and as I have Michael Williams email id (your colleague), I sent him the attachment, can you please check with him.
Waiting for your suggestions.
Thanks,
Sudhakar
JasonW
Sudhakar,
I was able to reproduce your issue by adding these two lines:
options.setImageHandler(new HTMLServerImageHandler());
options.setSupportedImageFormats("JPG;PNG;BMP;SVG;GIF");
Can your try and remove them.
When I removed them it worked for me.
Also can you log a bug for this?
Jason
SudhakarA
Thank you Jason.<br />
<br />
I works as you said. But can't able to open in "Microsoft Office Power Point 2010".<br />
<br />
How can I log bug on this, what is the URL for to log bug?<br />
<br />
Thanks,<br />
Sudhakar<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="81095" data-time="1312464551" data-date="04 August 2011 - 06:29 AM"><p>
Sudhakar,<br />
<br />
I was able to reproduce your issue by adding these two lines:<br />
<br />
options.setImageHandler(new HTMLServerImageHandler());<br />
options.setSupportedImageFormats("JPG;PNG;BMP;SVG;GIF");<br />
<br />
Can your try and remove them. <br />
When I removed them it worked for me.<br />
<br />
Also can you log a bug for this?<br />
<br />
<br />
Jason<br /></p></blockquote>
JasonW
Take a look at this link:
http://www.eclipse.org/birt/phoenix/community.php
Jason
SudhakarA
In the Birt 3.7, generated report which is in the ppt file, the "page counter" is showing wrong. First page "Page count" in the footer shows as "Page 1 of 1" and for second page "Page 2 of 2" and so on...
But whereas using the same birt design file when the report was generated in the PDF, the page counter works as expected like "Page 1 of 10", "Page 2 of 10" and so on... .
What might be the problem, do anything I need to do in the birt rptdesign file.
Thanks,
Sudhakar
JasonW
Are you viewing the report in the viewer and then exporting to pdf?
Can you reproduce the issue with the sample data and post the report?
Jason
SudhakarA
Using birt scripted data set and java code as eventhandler, I'm generating the reports.
Generated report in pdf format is good comparatively with PPT for the page counter.
SudhakarA
Hi,<br />
<br />
Below is the code which I'm using for PPT report generation and I'm getting page count wrongly.<br />
<br />
<em class='bbc'>String designFileName = engine.getConfig().getResourcePath() + reportDesignFileName;<br />
Object designFile = new Object();<br />
design = engine.openReportDesign(designFileName);<br />
IRunAndRenderTask task = engine.createRunAndRenderTask(design);<br />
task.setParameterValue("param_msp_id", String.valueOf(mspId));<br />
task.setParameterValue("param_client_id", String.valueOf(clientId));<br />
<br />
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();<br />
HTMLRenderOption options = new HTMLRenderOption();<br />
options.setOutputStream(outputStream);<br />
options.setOutputFormat("ppt");<br />
</em><br />
<br />
Please let me know, what I need to do in the code to make ppt page count coming correctly.
SudhakarA
Can I get any solutions for the above addressed issue?
Thanks,
Sudhakar
SudhakarA
Hi,
Can I get any solution on the above addressed issue?
Thanks,
Sudhakar
JasonW
Sorry for the delay. I have been out of the office. Can you try a run task then a render task instead of a runandrender task?
Jason
SudhakarA
Hi,
I even tried with "Task" instead of "Render", but this time I can't able to open the ppt file itself (I'm using Microsoft Office 2007).
String designFileName = "mytestfile.rptdesign"
Object designFile = new Object();
design = engine.openReportDesign(designFileName);
IRunTask task = engine.createRunTask(design);
task.setParameterValue("param_id", id);
task.run("output.ppt");
task.close();
Can you please provide me the appropriate code for to generate ppt report with proper Page Numbering?
JasonW
Try this (Make sure to change birt home):
package REAPI;
import java.util.Locale;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IRenderTask;
import org.eclipse.birt.report.engine.api.IReportDocument;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunTask;
public class RunThenRender {
public void runReport() throws EngineException
{
IReportEngine engine=null;
EngineConfig config = null;
IReportDocument document = null;
try{
config = new EngineConfig( );
config.setBIRTHome("C:\\birt\\birt-runtime-2_6_1\\birt-runtime-2_6_1\\reportEngine");
Platform.startup( config );
IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
engine = factory.createReportEngine( config );
IReportRunnable design = null;
design = engine.openReportDesign("Reports/TopNPercent.rptdesign");
IRunTask task = engine.createRunTask(design);
task.setLocale(new Locale("en", "US"));
task.run("output/resample/TopNPercent.rptdocument");
task.close();
document = engine.openReportDocument("output/resample/TopNPercent.rptdocument");
HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat("ppt");
options.setOutputFileName("output/resample/topnpercent.ppt");
options.setSupportedImageFormats("PNG;GIF;JPG;BMP;SWF;SVG");
IRenderTask rtask = engine.createRenderTask(document);
rtask.setLocale(new Locale("en", "US"));
rtask.setRenderOption(options);
rtask.render();
rtask.close();
document.close();
engine.destroy();
System.out.println("Finished");
}catch( Exception ex){
ex.printStackTrace();
}
finally
{
Platform.shutdown( );
System.out.println("Finished");
}
}
/**
*
@param
args
*/
public static void main(String[] args) {
try
{
RunThenRender ex = new RunThenRender( );
ex.runReport();
}
catch ( Exception e )
{
e.printStackTrace();
}
}
}
Jason
SudhakarA
Hi Jason,
Thanks for the code, but the code works perfect for displaying page numbers from 1 to 10 in the ppt and after the 10th slide the page numbers are displaying as "Page 11 of 11", "Page 12 of 12", "Page 13 of 13" and etc...
Can you please check and let me know if we have a fix for this.
Thank you,
Sudhakar
JasonW
Can you create a report using the sample data that shows this issue so I can run and test it?
Jason
SudhakarA
Please execute the attached birt design file using the sample code which you send for PPT report generation.
You will observe the page number difference while scrolling down to the last slides.
--Sudhakar
JasonW
I do not see an attachment.
Jason
SudhakarA
Sorry I missed to click on "Attach This File" button, assumed "Add Reply" will attach the uploaded file.
Can you please check and help us to get any solution for this.
Thanks,
Sudhakar
JasonW
Ok the report you posted was written in BIRT 3.7 so I used the 3.7 runtime and the API program posted above (commented out the set birt home line) and the ppt produced fine. It produced 64 slides all numbered correctly.
Jason