It seems that doing this causes a NullPointerException when saving the Master. I have a List of Workbooks that i want to combine into a master workbook. I then want to save the master workbook. Note: The List of workbooks were created in memory and will not be saved on to disk. Only the master workbook will be saved.
However, if I save each individual workbook prior to combining it to the master, saving the master will then work.
So if I have workbooks Child 1 WB, Child 2 WB, Child 3 WB in memory. I create a new Workbook "MasterWorkBook".
If i do a MasterWorkBook.combine(Child 1 WB);MasterWorkBook.combine(Child 2 WB);MasterWorkBook.combine(Child 1 WB);MasterWorkBook.save. It will fail.
However, If i do a Child1WB.save. Child2WB.save. Child3WB.save. MasterWorkbook.combine(Child1WB);MasterWorkBook.combine(Child2WB);MasterWorkBook.combine(Child3WB);MasterWorkBook.save. It works.
It seems that when you do a workbook combine, it loses some state information - unless you save the workbook first.
The exception is below
java.lang.NullPointerException at com.aspose.cells.yB.a(Unknown Source) at com.aspose.cells.ah.a(Unknown Source) at com.aspose.cells.Bb.a(Unknown Source) at com.aspose.cells.Bb.b(Unknown Source) at com.aspose.cells.Bb.a(Unknown Source) at com.aspose.cells.Workbook.a(Unknown Source) at com.aspose.cells.Workbook.save(Unknown Source) at com.aspose.cells.Workbook.save(Unknown Source)
Could you please attach your template Excel files and also paste your runnable JAVA program to reproduce the issue on our end, we will check your issue soon.
FYI, the above works, but only if you're input format and your output format are the same. If you reading an xlsx template, and then saving to a xls file, then the exception will still occur.
This is for the input stream constructor only. If you specify an asbolute path, then everything is fine.