Free Support Forum - aspose.com

Text formatting not showing

Hi there,

We are attempting to demo your product with the intention to purchase. However the demo is not behaving as we expect. The font styling (bold/italic etc) appears to be lost . The text just appears as not bold/italic. i.e. ‘this’ appears as ‘this’.

We are converting from Jasper report to PPT (NOT PPTX). We are compiling using iReport 3.0.0 and using jasperreports-3.0.1.jar. I believe this meets your system requirements ( http://www.aspose.com/documentation/jasperreports-exporters/aspose.slides-for-jasperreports/system-requirements.html ).

The code we use is as follows:

Controller:-

public void genReport(HttpServletRequest request, HttpServletResponse response){
response.setHeader(“Pragma”, “public”);
response.setContentType(“application/mspowerpoint”);
response.setHeader(“content-disposition”, “attachment; filename=vTest.ppt”);
JasperPrint print = reportService.genJapserPrint();
try {
pbReportService.pdfToPpt(print, response.getOutputStream());

} catch (IOException e) {
throw new RuntimeException(e);
}
}


Service:-
public void pdfToPpt(JasperPrint print, OutputStream os){
JRPptExporter exporter = new JRPptExporter();
exporter.reset();
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.exportReport();
}

public JasperPrint genJapserPrint(){
Properties prop = UView.getInstance().applicationProperties;
String path = prop.getProperty(“templatesdir”) + “/jasper/”;
String reportname = “simple”;
JasperPrint print = null;
try {
print = JasperFillManager.fillReport(path + reportname + “.jasper”, null, new JREmptyDataSource());
} catch (JRException e) {
throw new RuntimeException(e);
}
return print;
}


Are we missing something?

Thanks for any help in advanced,
Craig

Hi Craig,

Thanks for your interest in Aspose.Slides.

I have tried to understand your problem statement and based on my understanding, I have created a sample netbeens project for you. Please find the code and exported ppt file with Aspose.Slides for Jasper Reports in attachment. The zip file also contains jrxml file.

Hi there,

Thanks for the reply. My work environment means that I can only use eclipse. I have imported the source and added the required jars to the project build path. I however get the following exception:-

Exception in thread “main” java.lang.NoSuchMethodError: net.sf.jasperreports.engine.JRCommonElement.getMode()B

when using jasperreports-4.1.2.jar

Please could you point me in the right direction?

Thanks,
Craig

Hi Craig,

Please accept my apology for late response. This exception shows, you are missing some .Jar files. If you are unable to identify the specific jar file, please add all jar files related to jasper reports and check the code. You can see in code and generated presentation file that text bold is working with Aspose.Slides.

Please let me know, If you still face problem so that I will setup eclipse at my end and share the eclipse project with you.

Hi there,

If you could please attach the eclipse project that would be much appreciated.

Thanks,
Craig

Hi again,

After further investigation I have noticed that the version of Jasper I was previously using was not compatible (http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRCommonElement.html). The method getValue() has been renamed to getModeValue() in later versions of JasperReports. So I have used an earlier version of Jasper Reports (3.7.1) where the method getValue() is still as named (http://www.jarvana.com/jarvana/view/net/sf/jasperreports/jasperreports/3.7.1/jasperreports-3.7.1-javadoc.jar!/net/sf/jasperreports/engine/JRCommonElement.html).

The code compiles and executes. A PPT is produced. However, we still have the same problem! The font styling is lost…

I have checked to see if there is a problem with the JasperPrint object by adding the following line of code:

JasperExportManager.exportReportToHtmlFile(jasperPrint,“C:/Users/User/Documents/_work/pb/BoldPresentation.html”);

The HTML produced has kept the font styling (bold/underlined). So I think we can conclude that the JasperPrint object is in the correct state (i.e. contains the font style attributes - bold/underline).

It is important that we get to the bottom of this as we have the intention of purchasing an OEM license with support.

Thanks for your help,
Craig


Hi Craig,

Please find the hotfix of Aspose.Slides for Jasper Reports in attachment. Use the attached jar file in your project and let me know, If you still face any problem.

This appears to have resolved our problems.

I’ll get back to you if we have any further problems.

Thanks,
Craig