OpenXML SDK(C#): Copy all comments from one Excel workbook to another -


i have 1 workbook has data comments - , have copy of same workbook without comments.

i want put comments in second workbook. tried appending comments 1 file , it's not working.

here have tried far...

spreadsheetdocument docwithcomments = spreadsheetdocument.open(@"...\comments.xlsx", true); spreadsheetdocument docwithoutcomments = spreadsheetdocument.open(@"...\nocomments.xlsx", true); workbookpart wbpwithcomments = docwithcomments.workbookpart; workbookpart wbpwithoutcomments = docwithoutcomments.workbookpart;  (int = 0; < wbpwithcomments.worksheetparts.count(); i++) {     if (wbpwithoutcomments.worksheetparts.elementat(i).worksheetcommentspart == null)     {         wbpwithoutcomments.worksheetparts.elementat(i).addnewpart<worksheetcommentspart>();         wbpwithoutcomments.worksheetparts.elementat(i).worksheetcommentspart.comments = new comments();         wbpwithoutcomments.worksheetparts.elementat(i).worksheetcommentspart.comments.commentlist = new commentlist();     }     (int j = 0; j < wbpwithcomments.worksheetparts.elementat(i).worksheetcommentspart.comments.count(); j++)     {         var = wbpwithcomments.worksheetparts.elementat(i).worksheetcommentspart.comments.commentlist.elementat(j);         wbpwithoutcomments.worksheetparts.elementat(i).worksheetcommentspart.comments.commentlist.append(a.clonenode(true));         var b = wbpwithoutcomments.worksheetparts.elementat(i).worksheetcommentspart.comments.commentlist.elementat(j);     } } 

this code running without errors second workbook not showing comments.

tell me if there better way available complete task? in advance.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -