Page 1 of 1

Adding Comments to Xlsx

PostPosted: Fri Oct 11, 2013 4:02 am
by iCool
Hello,

I have been trying for a while to add comments to my xslx file generated using xslx4j.
Comments.xml is getting adde to package with the right content but somehow comments are not shown in xslx.
Im using docx4j 2.8.1

Here is my code :

final WorksheetPart worksheet =
pkg.createWorksheetPart( new PartName( "/xl/worksheets/sheet1.xml" ),
"Sheet1", 1 );
final CommentsPart commentsPart = new CommentsPart();
CTComments comments = Context.getsmlObjectFactory().createCTComments();
CTCommentList commentlist = Context.getsmlObjectFactory().createCTCommentList();
commentlist.getComment().add(createComment());
comments.setCommentList(commentlist);
commentsPart.setJaxbElement( comments );
worksheet.addTargetPart( commentsPart );


Pls point me out whats going wrong here.

Thanks.

Re: Adding Comments to Xlsx

PostPosted: Thu Oct 17, 2013 9:09 pm
by jason
Having just created a sample in excel, I see it includes a vmlDrawing presumably for the comment box.

If i delete the vml drawing part from the xlsx zip file (and the reference to it from the worksheet), the comment disappears.

So looks like you can't get away without that :-(