Hi,
We are trying to generate an Excel through the following steps(Attached is the code used for file generation) :-
1.) An Excel file is saved in the system and is being used as the template for the final output.
2.)The template is being converted into a workbook using Aspose API.
3.)The workbook is then saved into an outputstream and then subsequently in a byte array format using Apose API.
4.)Using the Byte Array the Excel is being generated.
Code:-
try{
// TemplatePage.getString(“pyFileSource”) contains the base64EncodedString of the template which is then decoded to a byte array
byte[] tempBytes = new com.pega.pegarules.pub.util.Base64Util().decodeToByteArray(TemplatePage.getString(“pyFileSource”));
//reading the data from byte arrays(tempBytes) as streams
java.io.InputStream tempIS = new java.io.ByteArrayInputStream(tempBytes);
//Creating the workbook
com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook(tempIS);
//capturing the data written to a stream
java.io.ByteArrayOutputStream outStream = new java.io.ByteArrayOutputStream();
//Saving the Workbook
workbook.save(outStream, com.aspose.cells.SaveFormat.
//Converting outStream to byteArray
byte[] xlBytes = outStream.toByteArray();
//Sending file to browser
String result=tools.sendFile(xlBytes,FileName,false,null,true);
}catch(Exception e){System.out.println(“Exception”+e);}
Error:- When the generated file is opened it through an error stating that Excel found unreadable content in Generated file.
Attached is the original Excel File that was being used as a template and will display no error while opening.
Along with that the generated file is also attached that displays the error on opening the file.
The version of Aspose Cells being used is 8.8.0.0
Please provide a resolution for the same.
Aspose Cells Issue.zip (1.7 MB)