xmlComments.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package excelize
  2. import "encoding/xml"
  3. // xlsxComments directly maps the comments element from the namespace
  4. // http://schemas.openxmlformats.org/spreadsheetml/2006/main. A comment is a
  5. // rich text note that is attached to and associated with a cell, separate from
  6. // other cell content. Comment content is stored separate from the cell, and is
  7. // displayed in a drawing object (like a text box) that is separate from, but
  8. // associated with, a cell. Comments are used as reminders, such as noting how a
  9. // complex formula works, or to provide feedback to other users. Comments can
  10. // also be used to explain assumptions made in a formula or to call out
  11. // something special about the cell.
  12. type xlsxComments struct {
  13. XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main comments"`
  14. Authors []xlsxAuthor `xml:"authors"`
  15. CommentList xlsxCommentList `xml:"commentList"`
  16. }
  17. // xlsxAuthor directly maps the author element. This element holds a string
  18. // representing the name of a single author of comments. Every comment shall
  19. // have an author. The maximum length of the author string is an implementation
  20. // detail, but a good guideline is 255 chars.
  21. type xlsxAuthor struct {
  22. Author string `xml:"author"`
  23. }
  24. // xlsxCommentList (List of Comments) directly maps the xlsxCommentList element.
  25. // This element is a container that holds a list of comments for the sheet.
  26. type xlsxCommentList struct {
  27. Comment []xlsxComment `xml:"comment"`
  28. }
  29. // xlsxComment directly maps the comment element. This element represents a
  30. // single user entered comment. Each comment shall have an author and can
  31. // optionally contain richly formatted text.
  32. type xlsxComment struct {
  33. Ref string `xml:"ref,attr"`
  34. AuthorID int `xml:"authorId,attr"`
  35. Text xlsxText `xml:"text"`
  36. }
  37. // xlsxText directly maps the text element. This element contains rich text
  38. // which represents the text of a comment. The maximum length for this text is a
  39. // spreadsheet application implementation detail. A recommended guideline is
  40. // 32767 chars.
  41. type xlsxText struct {
  42. R []xlsxR `xml:"r"`
  43. }
  44. // formatComment directly maps the format settings of the comment.
  45. type formatComment struct {
  46. Author string `json:"author"`
  47. Text string `json:"text"`
  48. }