Created attachment 37461 [details] Payload file Hi, I am using POI 4.1.1 and latest Excel format (Office 365 Excel version : 16.39). My Excel sheet has cells with some comments in it, when I try to clone this sheet it fails with following error. Can you please suggest a solution for this. Exception in thread "main" 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:696) at org.apache.poi.xssf.usermodel.XSSFWorkbook.cloneSheet(XSSFWorkbook.java:627) at org.apache.poi.xssf.usermodel.XSSFWorkbook.cloneSheet(XSSFWorkbook.java:581) at org.apache.poi.xssf.usermodel.XSSFWorkbook.cloneSheet(XSSFWorkbook.java:118) at poi.main(poi.java:14) ----------------------------------------------------------------------------- public static void main(String[] args) throws Exception { Workbook workbook = WorkbookFactory.create(new FileInputStream("Sample.xlsx")); Sheet cloned = workbook.cloneSheet(0); System.out.println("Clone Successful : "+ cloned); }
Bug #56205 updates to a newer edition of the OOXML schema, however even the 5th edition of the standard is from 2015, so without taking a closer look this one likely is still not included as it has "2017" in the type-URI.
this issue is still happening in trunk - test-data/spreadsheet/right-to-left.xlsx exhibits the problem
It might take a while before we uptake a newer set of xsds. In meantime, we could change the XSSF clone sheet code to skip this threaded comment relationship or maybe support a minimal parse of the threaded comment XML that then discards the threaded comments and adds them as legacy style comments. Excel adds legacy style comments but with annoying intro text on each comment. xl/threadedComments/threadedComment2.xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ThreadedComments xmlns="http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><threadedComment ref="A3" dT="2021-07-20T11:25:36.59" personId="{BE6ACDFA-0497-4A79-9C68-85A5ACE46D65}" id="{6C66603E-E14F-425E-9A8E-DADD82BA9B49}"><text>تعليق الاختبار</text></threadedComment></ThreadedComments> xl/comments2.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="xr" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"><authors><author>tc={6C66603E-E14F-425E-9A8E-DADD82BA9B49}</author></authors><commentList><comment ref="A3" authorId="0" shapeId="0" xr:uid="{6C66603E-E14F-425E-9A8E-DADD82BA9B49}"><text><t>[Threaded comment] Your version of Excel allows you to read this threaded comment; however, any edits to it will get removed if the file is opened in a newer version of Excel. Learn more: https://go.microsoft.com/fwlink/?linkid=870924 Comment: تعليق الاختبار</t></text></comment></commentList></comments>
implemented a change in r1891722