Has anyone ever had any luck figuring out how to add a comment to Excel using the Open XML SDK 2.0? I couldn’t find any documentation on where to get started on this issue.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The below code will take the worksheet that you want to add comments to and then iterate over the commentsToAdd dictionary. The dictionary key is the cell reference (ie. A1) and the value is the comment text to be added.
Helper method that will create the VML XML for the Shape:
Helpers to figure out the Column Index and coordinates for the comment Shape:
Don’t forget to save your worksheet and workbook once you are done in order to see the changes.