summaryrefslogtreecommitdiff
path: root/comment.go
diff options
context:
space:
mode:
authorRad Cirskis <nad2000@gmail.com>2018-06-30 22:37:14 +1200
committerRad Cirskis <nad2000@gmail.com>2018-06-30 22:37:14 +1200
commite3050d21e7c645ba8ee88c9e0f32dd241e1c4cc3 (patch)
tree1305c661345cbb9f9e31213495ade8b49b7405eb /comment.go
parent9cb0e9308b7e65d5a277b0c6af9fa0e8680b3658 (diff)
added retieval of worksheet comments
Diffstat (limited to 'comment.go')
-rw-r--r--comment.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/comment.go b/comment.go
index 9548d78..bab7370 100644
--- a/comment.go
+++ b/comment.go
@@ -19,6 +19,23 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) {
return &format, err
}
+// GetComments retrievs all comments and returns a map
+// of worksheet name to the worksheet comments.
+func (f *File) GetComments() (comments map[string]*xlsxComments) {
+ comments = map[string]*xlsxComments{}
+ for n := range f.sheetMap {
+ commentID := f.GetSheetIndex(n)
+ commentsXML := "xl/comments" + strconv.Itoa(commentID) + ".xml"
+ c, ok := f.XLSX[commentsXML]
+ if ok {
+ d := xlsxComments{}
+ xml.Unmarshal([]byte(c), &d)
+ comments[n] = &d
+ }
+ }
+ return
+}
+
// AddComment provides the method to add comment in a sheet by given worksheet
// index, cell and format set (such as author and text). Note that the max
// author length is 255 and the max text length is 32512. For example, add a