diff options
| author | xuri <xuri.me@gmail.com> | 2018-07-10 10:10:38 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-10 10:10:38 +0800 |
| commit | 58a7b23d11ef36156af6f694a1753715df8ae2fc (patch) | |
| tree | f4c7431fa3e313d3ecbc6c7adc951e585aa760e5 /comment.go | |
| parent | d6468fc114217678e8bc8b4324fd6185794e0182 (diff) | |
| parent | 1a953b6601df2484a39203edff59943e41e3f438 (diff) | |
Merge pull request #246 from nad2000/retrieve-comments
added retrieval of worksheet comments
Diffstat (limited to 'comment.go')
| -rw-r--r-- | comment.go | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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 |
