Hi there
I am generating an excel-template report using the SpireXLS for Java workbook.saveToStream() method. When I generate the report as excel it works fine, but when I generate it as PDF it fails.
The excel-template contains images, and when I remove the images then it generates fine as PDF. So the issue seems to be directly to do with the images being in the excel file.
I am running as an Azure App Service, with my Java application running in a Tomcat 9.0 instance. When I run locally on my Windows machine the report generates correctly in both excel and PDF format. So the issue is also related to running in Azure.
I have tried different browsers but this does not make a difference.
I have certain required font files stored in a file directory within my app service home folder - these are only needed when generating the report as PDF. This does not seem to be causing an error and the fonts are working fine.
It seems to be a combination of pdf, images and Azure causing the error but I cannot figure out why, or what to do to fix it.
I have attached a very simple excel-template which fails ... the stack trace is not very helpful (I assume the class names are obfuscated):
java.lang.NoClassDefFoundError: Could not initialize class com.spire.xls.packages.sprmlg
at com.spire.xls.packages.sprbgg.<init>(Unknown Source)
at com.spire.xls.packages.sprbgg.<init>(Unknown Source)
at com.spire.xls.packages.sprzgg.spr‡┘(Unknown Source)
at com.spire.xls.packages.sprogf.spr⁆⌬(Unknown Source)
at com.spire.xls.packages.sprsrj.spr∮╃(Unknown Source)
at com.spire.xls.packages.sprzhj.sprㆁ╁(Unknown Source)
at com.spire.xls.packages.sprzhj.spr┳╂(Unknown Source)
at com.spire.xls.packages.sprzhj.spr┴╂(Unknown Source)
at com.spire.xls.packages.sprzhj.spr⅙╁(Unknown Source)
at com.spire.xls.packages.sprzhj.spr╁╂(Unknown Source)
at com.spire.xls.packages.sprzhj.spr┞╂(Unknown Source)
at com.spire.xls.packages.sprnqp.spr▀┩(Unknown Source)
at com.spire.xls.packages.sprdoj.spr⅕╁(Unknown Source)
at com.spire.xls.packages.sprdoj.spr⌻≌(Unknown Source)
at com.spire.xls.core.spreadsheet.XlsWorkbook.spr⌻≌(Unknown Source)
at com.spire.xls.Workbook.spr◍╆(Unknown Source)
at com.spire.xls.Workbook.saveToStream(Unknown Source)
at nz.co.dairyinsight.dairydata.report.ExcelReportProcessingService.formatWorkbookForDownload(ExcelReportProcessingService.java:461)
I have checked and class sprmlg is present in the jar file, but can't be initialised and not sure why. I am using the latest version of SpireXLS for Java - 5.3.1.
Also attached is a screenshot of the Java code I'm running.