Bug 64759 - Can't clone sheet - unknown relation type found: http://schemas.microsoft.com/office/2017/10/relationships/threadedComment
Summary: Can't clone sheet - unknown relation type found: http://schemas.microsoft.com...
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.1.1-FINAL
Hardware: Macintosh All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on: 56205
Blocks:
  Show dependency tree
 
Reported: 2020-09-21 18:44 UTC by PC
Modified: 2021-07-22 20:12 UTC (History)
0 users



Attachments
Payload file (11.41 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2020-09-21 18:44 UTC, PC
Details

Note You need to log in before you can comment on or make changes to this bug.
Description PC 2020-09-21 18:44:08 UTC
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);
    }
Comment 1 Dominik Stadler 2020-12-13 09:56:28 UTC
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.
Comment 2 PJ Fanning 2021-07-20 13:25:10 UTC
this issue is still happening in trunk - test-data/spreadsheet/right-to-left.xlsx exhibits the problem
Comment 3 PJ Fanning 2021-07-20 14:30:07 UTC
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>
Comment 4 PJ Fanning 2021-07-22 20:12:07 UTC
implemented a change in r1891722