When loading and editing an existing xlsx file, is there a way to easily duplicate an existing worksheet? I tried just giving it the same SheetData object, but obviously then changes to one sheet would be reflected in the other sheet as well, which is not what I want.
1. create a new WorksheetPart 2. clone the existing worksheet's contents using XmlUtils.deepCopy; set the new worksheet's contents 3. use addTargetPart to add the part to the WorkbookPart 4. add the part to the list of parts in the workbook part (see xlsx-java-f15/how-to-remove-a-sheet-from-a-loaded-xlsx-template-t1027.html )
That's all there is to it, if you aren't using shared strings and the source part doesn't reference other parts.