Hi Jason,
Thanks for your reply,
I tired the same way and was getting following exception
- Code: Select all
[com.sun.istack.internal.SAXException2: unable to marshal type "org.xlsx4j.sml.CTTable" as an element because it is missing an @XmlRootElement annotation]
To over come the above exception I tried the solution provided in forum
http://www.docx4java.org/forums/pptx-java-f14/editing-charts-and-spreadsheet-with-pptx4j-t1238.html. Added the @XmlRootElement(name = "table") in CTTable.java, compiled the class and added the class file to docx4j jar. So, the CTTable.java annotations now look as follows:
- Code: Select all
@XmlRootElement(name = "table")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_Table", propOrder = {
"autoFilter",
"sortState",
"tableColumns",
"tableStyleInfo",
"extLst"
})
With this I am able to overcome the above mentioned exception and I am able to set the binary data back to embedded part.
Now the issue that I am facing is, while trying to edit the chart data using MS Word, it is not opening the editable embedded excel file.
I extracted the .docx and tried opening the embedded Microsoft_Office_Excel_Worksheet1.xlsx.
MS Excel is throwing an error "Excel found unreadable content in Microsoft_Office_Excel_Worksheet1.xlsx. Do you want to recover the contents of this workbook?"
When I said yes to above, it opened the excel with message "Repaired Records: Table from /xl/tables/table1.xml part (Table)".
Content of table1.xml is as follows:
- Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" tableBorderDxfId="0" totalsRowShown="false" ref="A1:B4" displayName="Table1" name="Table1" id="1">
<tableColumns count="2">
<tableColumn name="" id="1" />
<tableColumn name="Severity Chart" id="2" />
</tableColumns>
<tableStyleInfo showColumnStripes="false" showRowStripes="true" showLastColumn="false" showFirstColumn="false" />
</table>
Can you please let me know what could have gone wrong and how make the embedded excel working with out any issues.
Note: I did not update any thing in embedded excel programatically, I got the binary data and then just set it back again with out modifying anything.
Thanks,
KSN Pavan.