Quantcast
Channel: Open XML Format SDK forum
Viewing all articles
Browse latest Browse all 1288

Get Page Number of Comment using Open XML SDK

$
0
0

Can anyone help me in getting the page numbers of comments entered in a word document using Open XML SDK in C#

Extract from my code:

using (WordprocessingDocument wordDoc =
                            WordprocessingDocument.Open("C:/temp/doc1.docx", false)) {
                            WordprocessingCommentsPart commentsPart =
                                wordDoc.MainDocumentPart.WordprocessingCommentsPart;

                            if (commentsPart != null && commentsPart.Comments != null) {
                                foreach (Comment comment in commentsPart.Comments.Elements<Comment>()) {

                                    SPList list = web.Lists["UserFeedback"];

                                    SPListItem itemToAdd = list.Items.Add();

                                    itemToAdd["Title"] = filename.Name.ToString();
                                    itemToAdd["Feedback"] = comment.Author.InnerText;
                                    itemToAdd["UserComments"] = comment.InnerText;
                                    itemToAdd["UserInitials"] = comment.Initials;
                                    itemToAdd["PageNumber"] = "";
                                    itemToAdd["Section"] = "";
                                    itemToAdd.Update();
                                }
                            }
                            wordDoc.Close();
                            wordDoc.Dispose();
                        }

Any help is appreciated.

Regards,

Vijay.



Viewing all articles
Browse latest Browse all 1288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>