Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[birt-news] Excel Format - Image not displaying

Hi,
 
I am trying to generate a Excel report with an image.
But the image is not there in the generated report.
 
I have created rptdesign file with an image in it.
Then I wrote a java program using report engine APIs to generate excel report in the specified report.
Report is gettinng generated in excel format. But still the imga is not there.
 
I am using BIRT 2.2.0 version which is supporting excel format.
 
I am attaching my code which is used for report generation
 
 
 
import java.util.HashMap;
import java.util.logging.Level;
 
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLActionHandler;
import org.eclipse.birt.report.engine.api.EngineConstants;
 
import org.eclipse.birt.report.engine.api.RenderOption;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.HTMLServerImageHandler;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
 
public class Example {
 
 public Example() {
  System.out.println("-------------Inside constructor");
 }
 
 public static void main(String[] args) {
  System.out.println("-------------Inside main method");
  Example reportRunner = new Example();
  reportRunner.runReport();
 }
 
 private void runReport() {
  System.out.println("Inside Report Generation");
  IReportEngine engine = null;
  IRunAndRenderTask task = null;
 
  try {
   EngineConfig config = new EngineConfig();
   IReportRunnable design = null;
 
   config.setEngineHome("D:/ProgramFiles/birt/birt-runtime-2_2_0/ReportEngine");
   config.setLogConfig("D:/ProgramFiles/birt/log", Level.ALL);
 
   Platform.startup( config );
   IReportEngineFactory factory = (IReportEngineFactory) Platform
     .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
   System.out.println(" ---FACTORY CREATED");
 
   engine = factory.createReportEngine( config );
   System.out.println(" ---REPORT ENGINE CREATED");
   engine.changeLogLevel( Level.WARNING );
 
   //Open the report design
   design = engine.openReportDesign("D:/Workarea/Report-workspace/MyReport/ExampleScript.rptdesign");
   System.out.println(" ------------ DESIGN CREATED");
 
   //Create task to run and render the report,
   task = engine.createRunAndRenderTask(design);
   System.out.println(" ------------ TASK CREATED");
 
            HTMLRenderOption options = new HTMLRenderOption();
 
   //Set ouptut location
   options.setOutputFileName("D:/ProgramFiles/birt/output/ExampleSciptExcel.xls");
 
   //Set output format
   options.setOutputFormat("xls");
   //options.setEmitterID("xls");
   task.setRenderOption(options);
 
   //run the report and destroy the engine
   task.run();
 
   System.out.println(" ------------ TASK RUNNING");
 
  }
  catch( Exception exception){
   exception.printStackTrace();
  }
  finally {
   task.close();
   engine.shutdown();
   Platform.shutdown();
  }
  System.out.println("Finished");
 }
}
 
Could anybody help me in solving this problem.
 
Regards,
Shomy

 

 
DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

Back to the top