Maybe now someone has a clue for me?
As said in my previous mail, I tried to append a template sheet to a
spreadsheet document. But the appendSheet method of the class
SpreadsheetDocument gives me back the following error:
java.lang.NullPointerException
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(Unknown
Source)
at java.lang.reflect.Field.get(Unknown Source)
at
org.odftoolkit.odfdom.pkg.OdfFileDom.newOdfElement(OdfFileDom.java:340)
at org.odftoolkit.odfdom.pkg.OdfElement.cloneNode(OdfElement.java:297)
at org.odftoolkit.odfdom.pkg.OdfElement.cloneNode(OdfElement.java:316)
at
org.odftoolkit.simple.SpreadsheetDocument.appendSheet(SpreadsheetDocument.java:315)
What I do is:
document.appendSheet(documenttemplate.getSheetByIndex(0), "name");
where document is the document I want to create and documenttemplate is
the document with the template sheet.
Surely I did something wrong, but I can't see what it is. I hope that
someone can help me.
Regards,
Philipp
On 01.10.2014 16:22, Philipp Thöricht wrote:
> Hi,
>
> I'm searching for help how to handle templates with the odftoolkit.
> I want to load a template document (spreadsheet), then create a new
> spreadsheet document and add several sheets to it based on the sheet of
> the template.
> I tried methods like appendSheet(templatesheet, "name"),
> insertSheet(templatesheet, 0) on the new created document, but they all
> threw a NullPointerExceptions.
>
> Maybe someone has a code example how one can get this done?
>
> Regards,
> Philipp
>