Hi,I am stuck on an error that XSSFWorkbook throws when cloning an Excel
sheet that contains a threaded comment. Apparently this is a new type of
comment that Microsoft added to Excel around September 2018. What they were
calling 'Comments' in the UI, is now called 'Notes'. Threaded comments allow
users to reply to each other.I have downloaded the latest version of POI,
which is version 4.0.1. It has been released in December 2018._Here is the
stack trace:_org.apache.poi.ooxml.POIXMLException: Can't clone sheet -
unknown relation type found:
http://schemas.microsoft.com/office/2017/10/relationships/threadedComment       
at
org.apache.poi.xssf.usermodel.XSSFWorkbook.addRelation(XSSFWorkbook.java:700)
at
org.apache.poi.xssf.usermodel.XSSFWorkbook.cloneSheet(XSSFWorkbook.java:631)
at
org.apache.poi.xssf.usermodel.XSSFWorkbook.cloneSheet(XSSFWorkbook.java:585)
at testprojects.poi401.poitester.testcloneSheet(poitester.java:26)      at
testprojects.poi401.poitester.main(poitester.java:35)_Here is the code for
this use-case:_import java.io.File;import
org.apache.poi.xssf.usermodel.XSSFSheet;import
org.apache.poi.xssf.usermodel.XSSFWorkbook;public class poitester {       
public static void testcloneSheet(File inFile) {        try {                   
XSSFWorkbook workbook = new XSSFWorkbook(inFile);            XSSFSheet sheet
= workbook.getSheetAt(0);            if( sheet == null )               
System.out.println("Sheet cannot be found");                       
XSSFSheet clonedSheet = workbook.cloneSheet(0);                    } catch(
Throwable t) {            t.printStackTrace();        }    }        public
static void main(String[] args) {        File f = new File
("/Users/yleguenic/Desktop/WorkbookWithThreadedComment.xlsx");       
testcloneSheet(f);    }    } WorkbookWithThreadedComment.xlsx
<http://apache-poi.1045710.n5.nabble.com/file/t340656/WorkbookWithThreadedComment.xlsx>
 
The WorkbookWithThreadedComment.xlsx workbook contains one sheet that has a
'Note' on cell A1 and a 'Threaded Comment' on cell B1.If anyone knows a way
to prevent the cloning of the sheet from crashing, even if it implies to
loose the  threaded comments, this would make my day !Regards,Yann.



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

Reply via email to