2022-01-09 00:20:42 +08:00
|
|
|
// Copyright 2016 - 2022 The excelize Authors. All rights reserved. Use of
|
2018-09-14 00:44:23 +08:00
|
|
|
// this source code is governed by a BSD-style license that can be found in
|
|
|
|
// the LICENSE file.
|
|
|
|
//
|
2022-02-17 00:09:11 +08:00
|
|
|
// Package excelize providing a set of functions that allow you to write to and
|
|
|
|
// read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
|
|
|
|
// writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
|
|
|
|
// Supports complex components by high compatibility, and provided streaming
|
|
|
|
// API for generating or reading data from a worksheet with huge amounts of
|
|
|
|
// data. This library needs Go version 1.15 or later.
|
2018-09-14 00:58:48 +08:00
|
|
|
|
2017-05-13 13:28:21 +08:00
|
|
|
package excelize
|
|
|
|
|
|
|
|
import "encoding/xml"
|
|
|
|
|
|
|
|
// xlsxComments directly maps the comments element from the namespace
|
|
|
|
// http://schemas.openxmlformats.org/spreadsheetml/2006/main. A comment is a
|
|
|
|
// rich text note that is attached to and associated with a cell, separate from
|
|
|
|
// other cell content. Comment content is stored separate from the cell, and is
|
|
|
|
// displayed in a drawing object (like a text box) that is separate from, but
|
|
|
|
// associated with, a cell. Comments are used as reminders, such as noting how a
|
|
|
|
// complex formula works, or to provide feedback to other users. Comments can
|
|
|
|
// also be used to explain assumptions made in a formula or to call out
|
|
|
|
// something special about the cell.
|
|
|
|
type xlsxComments struct {
|
|
|
|
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main comments"`
|
2021-04-27 12:46:51 +08:00
|
|
|
Authors xlsxAuthor `xml:"authors"`
|
2017-05-13 13:28:21 +08:00
|
|
|
CommentList xlsxCommentList `xml:"commentList"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// xlsxAuthor directly maps the author element. This element holds a string
|
|
|
|
// representing the name of a single author of comments. Every comment shall
|
|
|
|
// have an author. The maximum length of the author string is an implementation
|
|
|
|
// detail, but a good guideline is 255 chars.
|
|
|
|
type xlsxAuthor struct {
|
2021-04-27 12:46:51 +08:00
|
|
|
Author []string `xml:"author"`
|
2017-05-13 13:28:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// xlsxCommentList (List of Comments) directly maps the xlsxCommentList element.
|
|
|
|
// This element is a container that holds a list of comments for the sheet.
|
|
|
|
type xlsxCommentList struct {
|
|
|
|
Comment []xlsxComment `xml:"comment"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// xlsxComment directly maps the comment element. This element represents a
|
|
|
|
// single user entered comment. Each comment shall have an author and can
|
|
|
|
// optionally contain richly formatted text.
|
|
|
|
type xlsxComment struct {
|
|
|
|
Ref string `xml:"ref,attr"`
|
|
|
|
AuthorID int `xml:"authorId,attr"`
|
|
|
|
Text xlsxText `xml:"text"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// xlsxText directly maps the text element. This element contains rich text
|
|
|
|
// which represents the text of a comment. The maximum length for this text is a
|
|
|
|
// spreadsheet application implementation detail. A recommended guideline is
|
|
|
|
// 32767 chars.
|
|
|
|
type xlsxText struct {
|
2019-07-14 13:13:10 +08:00
|
|
|
T *string `xml:"t"`
|
|
|
|
R []xlsxR `xml:"r"`
|
|
|
|
RPh *xlsxPhoneticRun `xml:"rPh"`
|
|
|
|
PhoneticPr *xlsxPhoneticPr `xml:"phoneticPr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// xlsxPhoneticRun element represents a run of text which displays a phonetic
|
|
|
|
// hint for this String Item (si). Phonetic hints are used to give information
|
|
|
|
// about the pronunciation of an East Asian language. The hints are displayed
|
|
|
|
// as text within the spreadsheet cells across the top portion of the cell.
|
|
|
|
type xlsxPhoneticRun struct {
|
|
|
|
Sb uint32 `xml:"sb,attr"`
|
|
|
|
Eb uint32 `xml:"eb,attr"`
|
2020-09-03 23:44:43 +08:00
|
|
|
T string `xml:"t"`
|
2017-05-13 13:28:21 +08:00
|
|
|
}
|
|
|
|
|
2018-09-14 00:24:49 +08:00
|
|
|
// Comment directly maps the comment information.
|
|
|
|
type Comment struct {
|
Breaking change: changed the function signature for 11 exported functions
* Change
`func (f *File) NewConditionalStyle(style string) (int, error)`
to
`func (f *File) NewConditionalStyle(style *Style) (int, error)`
* Change
`func (f *File) NewStyle(style interface{}) (int, error)`
to
`func (f *File) NewStyle(style *Style) (int, error)`
* Change
`func (f *File) AddChart(sheet, cell, opts string, combo ...string) error`
to
`func (f *File) AddChart(sheet, cell string, chart *ChartOptions, combo ...*ChartOptions) error`
* Change
`func (f *File) AddChartSheet(sheet, opts string, combo ...string) error`
to
`func (f *File) AddChartSheet(sheet string, chart *ChartOptions, combo ...*ChartOptions) error`
* Change
`func (f *File) AddShape(sheet, cell, opts string) error`
to
`func (f *File) AddShape(sheet, cell string, opts *Shape) error`
* Change
`func (f *File) AddPictureFromBytes(sheet, cell, opts, name, extension string, file []byte) error`
to
`func (f *File) AddPictureFromBytes(sheet, cell, name, extension string, file []byte, opts *PictureOptions) error`
* Change
`func (f *File) AddTable(sheet, hCell, vCell, opts string) error`
to
`func (f *File) AddTable(sheet, reference string, opts *TableOptions) error`
* Change
`func (sw *StreamWriter) AddTable(hCell, vCell, opts string) error`
to
`func (sw *StreamWriter) AddTable(reference string, opts *TableOptions) error`
* Change
`func (f *File) AutoFilter(sheet, hCell, vCell, opts string) error`
to
`func (f *File) AutoFilter(sheet, reference string, opts *AutoFilterOptions) error`
* Change
`func (f *File) SetPanes(sheet, panes string) error`
to
`func (f *File) SetPanes(sheet string, panes *Panes) error`
* Change
`func (sw *StreamWriter) AddTable(hCell, vCell, opts string) error`
to
`func (sw *StreamWriter) AddTable(reference string, opts *TableOptions) error`
* Change
`func (f *File) SetConditionalFormat(sheet, reference, opts string) error`
to
`func (f *File) SetConditionalFormat(sheet, reference string, opts []ConditionalFormatOptions) error`
* Add exported types:
* AutoFilterListOptions
* AutoFilterOptions
* Chart
* ChartAxis
* ChartDimension
* ChartLegend
* ChartLine
* ChartMarker
* ChartPlotArea
* ChartSeries
* ChartTitle
* ConditionalFormatOptions
* PaneOptions
* Panes
* PictureOptions
* Shape
* ShapeColor
* ShapeLine
* ShapeParagraph
* TableOptions
* This added support for set sheet visible as very hidden
* Return error when missing required parameters for set defined name
* Update unit test and comments
2022-12-30 00:50:08 +08:00
|
|
|
Author string
|
|
|
|
AuthorID int
|
|
|
|
Cell string
|
|
|
|
Text string
|
|
|
|
Runs []RichTextRun
|
2018-09-14 00:24:49 +08:00
|
|
|
}
|