What I want to do is to copy a table from one document to another, and that table contains a cell that has a footnote reference. I used the following code, that compiles, but when I try to open the document it gives an error saying "One or more footnotes referenced in the document are missing or corrupt."
- Code: Select all
// Get a list of tables from the source document
List<Object> listOfTables= getAllElementFromObject(sourceDocument.getMainDocumentPart(), Tbl.class);
// Select the table at index 0, containing the cell having footnote reference
Tbl footNoteTable = (Tbl)referenceTables.get(0);
// Make a deep copy of that table
Object footNoteTableCopy = XmlUtils.deepCopy(footNoteTable);
// This function places the copied table below placeholder text in destination
insertTable(destinationDocument, "Placeholder Text", (Tbl)footNoteTableCopy);
Any help would be welcomed!