- Format code with `gofmt`
This commit is contained in:
parent
8152bbb2ce
commit
551fb8a9e4
|
@ -35,7 +35,6 @@ const (
|
|||
// offset: Number of rows/column to insert/delete negative values indicate deletion
|
||||
//
|
||||
// TODO: adjustPageBreaks, adjustComments, adjustDataValidations, adjustProtectedCells
|
||||
//
|
||||
func (f *File) adjustHelper(sheet string, dir adjustDirection, num, offset int) error {
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
|
6
cell.go
6
cell.go
|
@ -336,7 +336,6 @@ func setCellBool(value bool) (t string, v string) {
|
|||
//
|
||||
// var x float32 = 1.325
|
||||
// f.SetCellFloat("Sheet1", "A1", float64(x), 2, 32)
|
||||
//
|
||||
func (f *File) SetCellFloat(sheet, axis string, value float64, precision, bitSize int) error {
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
@ -588,7 +587,6 @@ type FormulaOpts struct {
|
|||
// fmt.Println(err)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func (f *File) SetCellFormula(sheet, axis, formula string, opts ...FormulaOpts) error {
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
@ -672,7 +670,6 @@ func (ws *xlsxWorksheet) countSharedFormula() (count int) {
|
|||
// For example, get a hyperlink to a 'H6' cell on a worksheet named 'Sheet1':
|
||||
//
|
||||
// link, target, err := f.GetCellHyperLink("Sheet1", "H6")
|
||||
//
|
||||
func (f *File) GetCellHyperLink(sheet, axis string) (bool, string, error) {
|
||||
// Check for correct cell name
|
||||
if _, _, err := SplitCellName(axis); err != nil {
|
||||
|
@ -734,7 +731,6 @@ type HyperlinkOpts struct {
|
|||
// This is another example for "Location":
|
||||
//
|
||||
// err := f.SetCellHyperLink("Sheet1", "A3", "Sheet1!A40", "Location")
|
||||
//
|
||||
func (f *File) SetCellHyperLink(sheet, axis, link, linkType string, opts ...HyperlinkOpts) error {
|
||||
// Check for correct cell name
|
||||
if _, _, err := SplitCellName(axis); err != nil {
|
||||
|
@ -1006,7 +1002,6 @@ func newRpr(fnt *Font) *xlsxRPr {
|
|||
// fmt.Println(err)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func (f *File) SetCellRichText(sheet, cell string, runs []RichTextRun) error {
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
@ -1056,7 +1051,6 @@ func (f *File) SetCellRichText(sheet, cell string, runs []RichTextRun) error {
|
|||
// array to row 6 start with the cell B6 on Sheet1:
|
||||
//
|
||||
// err := f.SetSheetRow("Sheet1", "B6", &[]interface{}{"1", nil, 2})
|
||||
//
|
||||
func (f *File) SetSheetRow(sheet, axis string, slice interface{}) error {
|
||||
col, row, err := CellNameToCoordinates(axis)
|
||||
if err != nil {
|
||||
|
|
1
chart.go
1
chart.go
|
@ -881,7 +881,6 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) {
|
|||
// fmt.Println(err)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func (f *File) AddChart(sheet, cell, format string, combo ...string) error {
|
||||
// Read sheet data.
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
|
|
10
col.go
10
col.go
|
@ -61,7 +61,6 @@ type Cols struct {
|
|||
// }
|
||||
// fmt.Println()
|
||||
// }
|
||||
//
|
||||
func (f *File) GetCols(sheet string, opts ...Options) ([][]string, error) {
|
||||
cols, err := f.Cols(sheet)
|
||||
if err != nil {
|
||||
|
@ -202,7 +201,6 @@ func columnXMLHandler(colIterator *columnXMLIterator, xmlElement *xml.StartEleme
|
|||
// }
|
||||
// fmt.Println()
|
||||
// }
|
||||
//
|
||||
func (f *File) Cols(sheet string) (*Cols, error) {
|
||||
name, ok := f.getSheetXMLPath(sheet)
|
||||
if !ok {
|
||||
|
@ -245,7 +243,6 @@ func (f *File) Cols(sheet string) (*Cols, error) {
|
|||
// in Sheet1:
|
||||
//
|
||||
// visible, err := f.GetColVisible("Sheet1", "D")
|
||||
//
|
||||
func (f *File) GetColVisible(sheet, col string) (bool, error) {
|
||||
colNum, err := ColumnNameToNumber(col)
|
||||
if err != nil {
|
||||
|
@ -278,7 +275,6 @@ func (f *File) GetColVisible(sheet, col string) (bool, error) {
|
|||
// Hide the columns from D to F (included):
|
||||
//
|
||||
// err := f.SetColVisible("Sheet1", "D:F", false)
|
||||
//
|
||||
func (f *File) SetColVisible(sheet, columns string, visible bool) error {
|
||||
start, end, err := f.parseColRange(columns)
|
||||
if err != nil {
|
||||
|
@ -319,7 +315,6 @@ func (f *File) SetColVisible(sheet, columns string, visible bool) error {
|
|||
// level of column D in Sheet1:
|
||||
//
|
||||
// level, err := f.GetColOutlineLevel("Sheet1", "D")
|
||||
//
|
||||
func (f *File) GetColOutlineLevel(sheet, col string) (uint8, error) {
|
||||
level := uint8(0)
|
||||
colNum, err := ColumnNameToNumber(col)
|
||||
|
@ -366,7 +361,6 @@ func (f *File) parseColRange(columns string) (start, end int, err error) {
|
|||
// 'level' is 1-7. For example, set outline level of column D in Sheet1 to 2:
|
||||
//
|
||||
// err := f.SetColOutlineLevel("Sheet1", "D", 2)
|
||||
//
|
||||
func (f *File) SetColOutlineLevel(sheet, col string, level uint8) error {
|
||||
if level > 7 || level < 1 {
|
||||
return ErrOutlineLevel
|
||||
|
@ -416,7 +410,6 @@ func (f *File) SetColOutlineLevel(sheet, col string, level uint8) error {
|
|||
// Set style of columns C:F on Sheet1:
|
||||
//
|
||||
// err = f.SetColStyle("Sheet1", "C:F", style)
|
||||
//
|
||||
func (f *File) SetColStyle(sheet, columns string, styleID int) error {
|
||||
start, end, err := f.parseColRange(columns)
|
||||
if err != nil {
|
||||
|
@ -459,7 +452,6 @@ func (f *File) SetColStyle(sheet, columns string, styleID int) error {
|
|||
//
|
||||
// f := excelize.NewFile()
|
||||
// err := f.SetColWidth("Sheet1", "A", "H", 20)
|
||||
//
|
||||
func (f *File) SetColWidth(sheet, startCol, endCol string, width float64) error {
|
||||
min, err := ColumnNameToNumber(startCol)
|
||||
if err != nil {
|
||||
|
@ -583,7 +575,6 @@ func flatCols(col xlsxCol, cols []xlsxCol, replacer func(fc, c xlsxCol) xlsxCol)
|
|||
//
|
||||
// width # Width of object frame.
|
||||
// height # Height of object frame.
|
||||
//
|
||||
func (f *File) positionObjectPixels(sheet string, col, row, x1, y1, width, height int) (int, int, int, int, int, int) {
|
||||
// Adjust start column for offsets that are greater than the col width.
|
||||
for x1 >= f.getColWidth(sheet, col) {
|
||||
|
@ -670,7 +661,6 @@ func (f *File) GetColWidth(sheet, col string) (float64, error) {
|
|||
// index. For example, create a new column before column C in Sheet1:
|
||||
//
|
||||
// err := f.InsertCol("Sheet1", "C")
|
||||
//
|
||||
func (f *File) InsertCol(sheet, col string) error {
|
||||
num, err := ColumnNameToNumber(col)
|
||||
if err != nil {
|
||||
|
|
|
@ -93,7 +93,6 @@ func (f *File) getSheetComments(sheetFile string) string {
|
|||
// comment in Sheet1!$A$30:
|
||||
//
|
||||
// err := f.AddComment("Sheet1", "A30", `{"author":"Excelize: ","text":"This is a comment."}`)
|
||||
//
|
||||
func (f *File) AddComment(sheet, cell, format string) error {
|
||||
formatSet, err := parseFormatCommentsSet(format)
|
||||
if err != nil {
|
||||
|
|
1
crypt.go
1
crypt.go
|
@ -1178,7 +1178,6 @@ func (c *cfb) writeSAT(MSATBlocks, SATBlocks, SSATBlocks, directoryBlocks, fileB
|
|||
// MSAT - The master sector allocation table
|
||||
// SSAT - The short sector allocation table
|
||||
// SAT - The sector allocation table
|
||||
//
|
||||
func (c *cfb) Writer(encryptionInfoBuffer, encryptedPackage []byte) []byte {
|
||||
var (
|
||||
storage cfb
|
||||
|
|
|
@ -170,7 +170,6 @@ func (dd *DataValidation) SetRange(f1, f2 interface{}, t DataValidationType, o D
|
|||
// dvRange.Sqref = "A7:B8"
|
||||
// dvRange.SetSqrefDropList("$E$1:$E$3")
|
||||
// f.AddDataValidation("Sheet1", dvRange)
|
||||
//
|
||||
func (dd *DataValidation) SetSqrefDropList(sqref string) {
|
||||
dd.Formula1 = fmt.Sprintf("<formula1>%s</formula1>", sqref)
|
||||
dd.Type = convDataValidationType(typeList)
|
||||
|
@ -247,7 +246,6 @@ func convDataValidationOperator(o DataValidationOperator) string {
|
|||
// dvRange.Sqref = "A5:B6"
|
||||
// dvRange.SetDropList([]string{"1", "2", "3"})
|
||||
// err = f.AddDataValidation("Sheet1", dvRange)
|
||||
//
|
||||
func (f *File) AddDataValidation(sheet string, dv *DataValidation) error {
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
|
|
@ -65,7 +65,6 @@ import (
|
|||
// HyperlinksChanged: true,
|
||||
// AppVersion: "16.0000",
|
||||
// })
|
||||
//
|
||||
func (f *File) SetAppProps(appProperties *AppProperties) (err error) {
|
||||
var (
|
||||
app *xlsxProperties
|
||||
|
@ -169,7 +168,6 @@ func (f *File) GetAppProps() (ret *AppProperties, err error) {
|
|||
// Language: "en-US",
|
||||
// Version: "1.0.0",
|
||||
// })
|
||||
//
|
||||
func (f *File) SetDocProps(docProperties *DocProperties) (err error) {
|
||||
var (
|
||||
core *decodeCoreProperties
|
||||
|
|
|
@ -417,7 +417,6 @@ func (f *File) addRels(relPath, relType, target, targetMode string) int {
|
|||
// <f>SUM(Sheet2!D2,Sheet2!D11)</f>
|
||||
// </c>
|
||||
// </row>
|
||||
//
|
||||
func (f *File) UpdateLinkedValue() error {
|
||||
wb := f.workbookReader()
|
||||
// recalculate formulas
|
||||
|
@ -454,7 +453,6 @@ func (f *File) UpdateLinkedValue() error {
|
|||
// if err := f.SaveAs("macros.xlsm"); err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
//
|
||||
func (f *File) AddVBAProject(bin string) error {
|
||||
var err error
|
||||
// Check vbaProject.bin exists first.
|
||||
|
|
1
file.go
1
file.go
|
@ -25,7 +25,6 @@ import (
|
|||
// For example:
|
||||
//
|
||||
// f := NewFile()
|
||||
//
|
||||
func NewFile() *File {
|
||||
f := newFile()
|
||||
f.Pkg.Store("_rels/.rels", []byte(xml.Header+templateRels))
|
||||
|
|
7
lib.go
7
lib.go
|
@ -149,7 +149,6 @@ func readFile(file *zip.File) ([]byte, error) {
|
|||
// Example:
|
||||
//
|
||||
// excelize.SplitCellName("AK74") // return "AK", 74, nil
|
||||
//
|
||||
func SplitCellName(cell string) (string, int, error) {
|
||||
alpha := func(r rune) bool {
|
||||
return ('A' <= r && r <= 'Z') || ('a' <= r && r <= 'z') || (r == 36)
|
||||
|
@ -193,7 +192,6 @@ func JoinCellName(col string, row int) (string, error) {
|
|||
// Example:
|
||||
//
|
||||
// excelize.ColumnNameToNumber("AK") // returns 37, nil
|
||||
//
|
||||
func ColumnNameToNumber(name string) (int, error) {
|
||||
if len(name) == 0 {
|
||||
return -1, newInvalidColumnNameError(name)
|
||||
|
@ -223,7 +221,6 @@ func ColumnNameToNumber(name string) (int, error) {
|
|||
// Example:
|
||||
//
|
||||
// excelize.ColumnNumberToName(37) // returns "AK", nil
|
||||
//
|
||||
func ColumnNumberToName(num int) (string, error) {
|
||||
if num < MinColumns || num > MaxColumns {
|
||||
return "", ErrColumnNumber
|
||||
|
@ -243,7 +240,6 @@ func ColumnNumberToName(num int) (string, error) {
|
|||
//
|
||||
// excelize.CellNameToCoordinates("A1") // returns 1, 1, nil
|
||||
// excelize.CellNameToCoordinates("Z3") // returns 26, 3, nil
|
||||
//
|
||||
func CellNameToCoordinates(cell string) (int, int, error) {
|
||||
colName, row, err := SplitCellName(cell)
|
||||
if err != nil {
|
||||
|
@ -263,7 +259,6 @@ func CellNameToCoordinates(cell string) (int, int, error) {
|
|||
//
|
||||
// excelize.CoordinatesToCellName(1, 1) // returns "A1", nil
|
||||
// excelize.CoordinatesToCellName(1, 1, true) // returns "$A$1", nil
|
||||
//
|
||||
func CoordinatesToCellName(col, row int, abs ...bool) (string, error) {
|
||||
if col < 1 || row < 1 {
|
||||
return "", fmt.Errorf("invalid cell coordinates [%d, %d]", col, row)
|
||||
|
@ -641,7 +636,7 @@ func (f *File) replaceNameSpaceBytes(path string, contentMarshal []byte) []byte
|
|||
if attr, ok := f.xmlAttr[path]; ok {
|
||||
newXmlns = []byte(genXMLNamespace(attr))
|
||||
}
|
||||
return bytesReplace(contentMarshal, oldXmlns, newXmlns, -1)
|
||||
return bytesReplace(contentMarshal, oldXmlns, bytes.ReplaceAll(newXmlns, []byte(" mc:Ignorable=\"r\""), []byte{}), -1)
|
||||
}
|
||||
|
||||
// addNameSpaces provides a function to add an XML attribute by the given
|
||||
|
|
1
merge.go
1
merge.go
|
@ -45,7 +45,6 @@ func (mc *xlsxMergeCell) Rect() ([]int, error) {
|
|||
// | |
|
||||
// |A8(x3,y4) C8(x4,y4)|
|
||||
// +------------------------+
|
||||
//
|
||||
func (f *File) MergeCell(sheet, hCell, vCell string) error {
|
||||
rect, err := areaRefToCoordinates(hCell + ":" + vCell)
|
||||
if err != nil {
|
||||
|
|
|
@ -106,7 +106,6 @@ func parseFormatPictureSet(formatSet string) (*formatPicture, error) {
|
|||
//
|
||||
// The optional parameter "y_scale" specifies the vertical scale of images,
|
||||
// the default value of that is 1.0 which presents 100%.
|
||||
//
|
||||
func (f *File) AddPicture(sheet, cell, picture, format string) error {
|
||||
var err error
|
||||
// Check picture exists first.
|
||||
|
@ -150,7 +149,6 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error {
|
|||
// fmt.Println(err)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func (f *File) AddPictureFromBytes(sheet, cell, format, name, extension string, file []byte) error {
|
||||
var drawingHyperlinkRID int
|
||||
var hyperlinkType string
|
||||
|
@ -492,7 +490,6 @@ func (f *File) getSheetRelationshipsTargetByID(sheet, rID string) string {
|
|||
// if err := ioutil.WriteFile(file, raw, 0644); err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
//
|
||||
func (f *File) GetPicture(sheet, cell string) (string, []byte, error) {
|
||||
col, row, err := CellNameToCoordinates(cell)
|
||||
if err != nil {
|
||||
|
|
|
@ -25,7 +25,6 @@ import (
|
|||
// PivotStyleLight1 - PivotStyleLight28
|
||||
// PivotStyleMedium1 - PivotStyleMedium28
|
||||
// PivotStyleDark1 - PivotStyleDark28
|
||||
//
|
||||
type PivotTableOption struct {
|
||||
pivotTableSheetName string
|
||||
DataRange string
|
||||
|
@ -129,7 +128,6 @@ type PivotTableField struct {
|
|||
// fmt.Println(err)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func (f *File) AddPivotTable(opt *PivotTableOption) error {
|
||||
// parameter validation
|
||||
_, pivotTableSheetPath, err := f.parseFormatPivotTableSet(opt)
|
||||
|
|
9
rows.go
9
rows.go
|
@ -48,7 +48,6 @@ import (
|
|||
// }
|
||||
// fmt.Println()
|
||||
// }
|
||||
//
|
||||
func (f *File) GetRows(sheet string, opts ...Options) ([][]string, error) {
|
||||
rows, err := f.Rows(sheet)
|
||||
if err != nil {
|
||||
|
@ -258,7 +257,6 @@ func (rows *Rows) rowXMLHandler(rowIterator *rowXMLIterator, xmlElement *xml.Sta
|
|||
// if err = rows.Close(); err != nil {
|
||||
// fmt.Println(err)
|
||||
// }
|
||||
//
|
||||
func (f *File) Rows(sheet string) (*Rows, error) {
|
||||
name, ok := f.getSheetXMLPath(sheet)
|
||||
if !ok {
|
||||
|
@ -345,7 +343,6 @@ func (f *File) xmlDecoder(name string) (bool, *xml.Decoder, *os.File, error) {
|
|||
// example, set the height of the first row in Sheet1:
|
||||
//
|
||||
// err := f.SetRowHeight("Sheet1", 1, 50)
|
||||
//
|
||||
func (f *File) SetRowHeight(sheet string, row int, height float64) error {
|
||||
if row < 1 {
|
||||
return newInvalidRowNumberError(row)
|
||||
|
@ -386,7 +383,6 @@ func (f *File) getRowHeight(sheet string, row int) int {
|
|||
// and row number. For example, get the height of the first row in Sheet1:
|
||||
//
|
||||
// height, err := f.GetRowHeight("Sheet1", 1)
|
||||
//
|
||||
func (f *File) GetRowHeight(sheet string, row int) (float64, error) {
|
||||
if row < 1 {
|
||||
return defaultRowHeightPixels, newInvalidRowNumberError(row)
|
||||
|
@ -518,7 +514,6 @@ func roundPrecision(text string, prec int) string {
|
|||
// worksheet name and Excel row number. For example, hide row 2 in Sheet1:
|
||||
//
|
||||
// err := f.SetRowVisible("Sheet1", 2, false)
|
||||
//
|
||||
func (f *File) SetRowVisible(sheet string, row int, visible bool) error {
|
||||
if row < 1 {
|
||||
return newInvalidRowNumberError(row)
|
||||
|
@ -538,7 +533,6 @@ func (f *File) SetRowVisible(sheet string, row int, visible bool) error {
|
|||
// 2 in Sheet1:
|
||||
//
|
||||
// visible, err := f.GetRowVisible("Sheet1", 2)
|
||||
//
|
||||
func (f *File) GetRowVisible(sheet string, row int) (bool, error) {
|
||||
if row < 1 {
|
||||
return false, newInvalidRowNumberError(row)
|
||||
|
@ -559,7 +553,6 @@ func (f *File) GetRowVisible(sheet string, row int) (bool, error) {
|
|||
// parameter 'level' is 1-7. For example, outline row 2 in Sheet1 to level 1:
|
||||
//
|
||||
// err := f.SetRowOutlineLevel("Sheet1", 2, 1)
|
||||
//
|
||||
func (f *File) SetRowOutlineLevel(sheet string, row int, level uint8) error {
|
||||
if row < 1 {
|
||||
return newInvalidRowNumberError(row)
|
||||
|
@ -581,7 +574,6 @@ func (f *File) SetRowOutlineLevel(sheet string, row int, level uint8) error {
|
|||
// outline number of row 2 in Sheet1:
|
||||
//
|
||||
// level, err := f.GetRowOutlineLevel("Sheet1", 2)
|
||||
//
|
||||
func (f *File) GetRowOutlineLevel(sheet string, row int) (uint8, error) {
|
||||
if row < 1 {
|
||||
return 0, newInvalidRowNumberError(row)
|
||||
|
@ -848,7 +840,6 @@ func checkRow(ws *xlsxWorksheet) error {
|
|||
// Set style of rows 1 to 10 on Sheet1:
|
||||
//
|
||||
// err = f.SetRowStyle("Sheet1", 1, 10, styleID)
|
||||
//
|
||||
func (f *File) SetRowStyle(sheet string, start, end, styleID int) error {
|
||||
if end < start {
|
||||
start, end = end, start
|
||||
|
|
1
shape.go
1
shape.go
|
@ -277,7 +277,6 @@ func parseFormatShapeSet(formatSet string) (*formatShape, error) {
|
|||
// wavy
|
||||
// wavyHeavy
|
||||
// wavyDbl
|
||||
//
|
||||
func (f *File) AddShape(sheet, cell, format string) error {
|
||||
formatSet, err := parseFormatShapeSet(format)
|
||||
if err != nil {
|
||||
|
|
12
sheet.go
12
sheet.go
|
@ -404,7 +404,6 @@ func (f *File) GetSheetIndex(sheet string) int {
|
|||
// for index, name := range f.GetSheetMap() {
|
||||
// fmt.Println(index, name)
|
||||
// }
|
||||
//
|
||||
func (f *File) GetSheetMap() map[int]string {
|
||||
wb := f.workbookReader()
|
||||
sheetMap := map[int]string{}
|
||||
|
@ -592,7 +591,6 @@ func (f *File) deleteSheetFromContentTypes(target string) {
|
|||
// index := f.NewSheet("Sheet2")
|
||||
// err := f.CopySheet(1, index)
|
||||
// return err
|
||||
//
|
||||
func (f *File) CopySheet(from, to int) error {
|
||||
if from < 0 || to < 0 || from == to || f.GetSheetName(from) == "" || f.GetSheetName(to) == "" {
|
||||
return ErrSheetIdx
|
||||
|
@ -641,7 +639,6 @@ func (f *File) copySheet(from, to int) error {
|
|||
// For example, hide Sheet1:
|
||||
//
|
||||
// err := f.SetSheetVisible("Sheet1", false)
|
||||
//
|
||||
func (f *File) SetSheetVisible(sheet string, visible bool) error {
|
||||
sheet = trimSheetName(sheet)
|
||||
content := f.workbookReader()
|
||||
|
@ -766,7 +763,6 @@ func parseFormatPanesSet(formatSet string) (*formatPanes, error) {
|
|||
// An example of how to unfreeze and remove all panes on Sheet1:
|
||||
//
|
||||
// f.SetPanes("Sheet1", `{"freeze":false,"split":false}`)
|
||||
//
|
||||
func (f *File) SetPanes(sheet, panes string) error {
|
||||
fs, _ := parseFormatPanesSet(panes)
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
|
@ -807,7 +803,6 @@ func (f *File) SetPanes(sheet, panes string) error {
|
|||
// name. For example, get visible state of Sheet1:
|
||||
//
|
||||
// f.GetSheetVisible("Sheet1")
|
||||
//
|
||||
func (f *File) GetSheetVisible(sheet string) bool {
|
||||
content, name, visible := f.workbookReader(), trimSheetName(sheet), false
|
||||
for k, v := range content.Sheets.Sheet {
|
||||
|
@ -834,7 +829,6 @@ func (f *File) GetSheetVisible(sheet string) bool {
|
|||
// of "0-9" of Sheet1 is described:
|
||||
//
|
||||
// result, err := f.SearchSheet("Sheet1", "[0-9]", true)
|
||||
//
|
||||
func (f *File) SearchSheet(sheet, value string, reg ...bool) ([]string, error) {
|
||||
var (
|
||||
regSearch bool
|
||||
|
@ -1071,7 +1065,6 @@ func attrValToBool(name string, attrs []xml.Attr) (val bool, err error) {
|
|||
// that same page
|
||||
//
|
||||
// - No footer on the first page
|
||||
//
|
||||
func (f *File) SetHeaderFooter(sheet string, settings *FormatHeaderFooter) error {
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
@ -1117,7 +1110,6 @@ func (f *File) SetHeaderFooter(sheet string, settings *FormatHeaderFooter) error
|
|||
// Password: "password",
|
||||
// EditScenarios: false,
|
||||
// })
|
||||
//
|
||||
func (f *File) ProtectSheet(sheet string, settings *FormatSheetProtection) error {
|
||||
ws, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
@ -1505,7 +1497,6 @@ func (p *PageLayoutScale) getPageLayout(ps *xlsxPageSetUp) {
|
|||
// 116 | PRC Envelope #8 Rotated (309 mm x 120 mm)
|
||||
// 117 | PRC Envelope #9 Rotated (324 mm x 229 mm)
|
||||
// 118 | PRC Envelope #10 Rotated (458 mm x 324 mm)
|
||||
//
|
||||
func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error {
|
||||
s, err := f.workSheetReader(sheet)
|
||||
if err != nil {
|
||||
|
@ -1526,6 +1517,7 @@ func (f *File) SetPageLayout(sheet string, opts ...PageLayoutOption) error {
|
|||
// GetPageLayout provides a function to gets worksheet page layout.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// PageLayoutOrientation(string)
|
||||
// PageLayoutPaperSize(int)
|
||||
// FitToHeight(int)
|
||||
|
@ -1553,7 +1545,6 @@ func (f *File) GetPageLayout(sheet string, opts ...PageLayoutOptionPtr) error {
|
|||
// Comment: "defined name comment",
|
||||
// Scope: "Sheet2",
|
||||
// })
|
||||
//
|
||||
func (f *File) SetDefinedName(definedName *DefinedName) error {
|
||||
wb := f.workbookReader()
|
||||
d := xlsxDefinedName{
|
||||
|
@ -1593,7 +1584,6 @@ func (f *File) SetDefinedName(definedName *DefinedName) error {
|
|||
// Name: "Amount",
|
||||
// Scope: "Sheet2",
|
||||
// })
|
||||
//
|
||||
func (f *File) DeleteDefinedName(definedName *DefinedName) error {
|
||||
wb := f.workbookReader()
|
||||
if wb.DefinedNames != nil {
|
||||
|
|
|
@ -238,6 +238,7 @@ func (o *AutoPageBreaks) getSheetPrOption(pr *xlsxSheetPr) {
|
|||
// SetSheetPrOptions provides a function to sets worksheet properties.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// CodeName(string)
|
||||
// EnableFormatConditionsCalculation(bool)
|
||||
// Published(bool)
|
||||
|
@ -268,6 +269,7 @@ func (f *File) SetSheetPrOptions(sheet string, opts ...SheetPrOption) error {
|
|||
// GetSheetPrOptions provides a function to gets worksheet properties.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// CodeName(string)
|
||||
// EnableFormatConditionsCalculation(bool)
|
||||
// Published(bool)
|
||||
|
@ -412,6 +414,7 @@ type PageMarginsOptionsPtr interface {
|
|||
// SetPageMargins provides a function to set worksheet page margins.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// PageMarginBottom(float64)
|
||||
// PageMarginFooter(float64)
|
||||
// PageMarginHeader(float64)
|
||||
|
@ -438,6 +441,7 @@ func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error {
|
|||
// GetPageMargins provides a function to get worksheet page margins.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// PageMarginBottom(float64)
|
||||
// PageMarginFooter(float64)
|
||||
// PageMarginHeader(float64)
|
||||
|
@ -605,6 +609,7 @@ func (p *ThickBottom) getSheetFormatPr(fp *xlsxSheetFormatPr) {
|
|||
// SetSheetFormatPr provides a function to set worksheet formatting properties.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// BaseColWidth(uint8)
|
||||
// DefaultColWidth(float64)
|
||||
// DefaultRowHeight(float64)
|
||||
|
@ -631,6 +636,7 @@ func (f *File) SetSheetFormatPr(sheet string, opts ...SheetFormatPrOptions) erro
|
|||
// GetSheetFormatPr provides a function to get worksheet formatting properties.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// BaseColWidth(uint8)
|
||||
// DefaultColWidth(float64)
|
||||
// DefaultRowHeight(float64)
|
||||
|
|
|
@ -199,7 +199,6 @@ func (f *File) getSheetView(sheet string, viewIndex int) (*xlsxSheetView, error)
|
|||
// Example:
|
||||
//
|
||||
// err = f.SetSheetViewOptions("Sheet1", -1, ShowGridLines(false))
|
||||
//
|
||||
func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOption) error {
|
||||
view, err := f.getSheetView(sheet, viewIndex)
|
||||
if err != nil {
|
||||
|
@ -232,7 +231,6 @@ func (f *File) SetSheetViewOptions(sheet string, viewIndex int, opts ...SheetVie
|
|||
//
|
||||
// var showGridLines excelize.ShowGridLines
|
||||
// err = f.GetSheetViewOptions("Sheet1", -1, &showGridLines)
|
||||
//
|
||||
func (f *File) GetSheetViewOptions(sheet string, viewIndex int, opts ...SheetViewOptionPtr) error {
|
||||
view, err := f.getSheetView(sheet, viewIndex)
|
||||
if err != nil {
|
||||
|
|
|
@ -387,7 +387,6 @@ func (f *File) addSparklineGroupByStyle(ID int) *xlsxX14SparklineGroup {
|
|||
// Markers | Toggle sparkline markers
|
||||
// ColorAxis | An RGB Color is specified as RRGGBB
|
||||
// Axis | Show sparkline axis
|
||||
//
|
||||
func (f *File) AddSparkline(sheet string, opt *SparklineOption) (err error) {
|
||||
var (
|
||||
ws *xlsxWorksheet
|
||||
|
|
|
@ -89,7 +89,6 @@ type StreamWriter struct {
|
|||
// err := streamWriter.SetRow("A1", []interface{}{
|
||||
// excelize.Cell{Value: 1}},
|
||||
// excelize.RowOpts{StyleID: styleID, Height: 20, Hidden: false});
|
||||
//
|
||||
func (f *File) NewStreamWriter(sheet string) (*StreamWriter, error) {
|
||||
sheetID := f.getSheetID(sheet)
|
||||
if sheetID == -1 {
|
||||
|
@ -385,7 +384,6 @@ func marshalRowAttrs(opts ...RowOpts) (attrs string, err error) {
|
|||
// the width column B:C as 20:
|
||||
//
|
||||
// err := streamWriter.SetColWidth(2, 3, 20)
|
||||
//
|
||||
func (sw *StreamWriter) SetColWidth(min, max int, width float64) error {
|
||||
if sw.sheetWritten {
|
||||
return ErrStreamSetColWidth
|
||||
|
|
|
@ -1841,7 +1841,6 @@ func parseFormatStyleSet(style interface{}) (*Style, error) {
|
|||
// err = f.SetCellStyle("Sheet1", "A6", "A6", style)
|
||||
//
|
||||
// Cell Sheet1!A6 in the Excel Application: martes, 04 de Julio de 2017
|
||||
//
|
||||
func (f *File) NewStyle(style interface{}) (int, error) {
|
||||
var fs *Style
|
||||
var err error
|
||||
|
@ -2571,7 +2570,6 @@ func (f *File) GetCellStyle(sheet, axis string) (int, error) {
|
|||
// fmt.Println(err)
|
||||
// }
|
||||
// err = f.SetCellStyle("Sheet1", "H9", "H9", style)
|
||||
//
|
||||
func (f *File) SetCellStyle(sheet, hCell, vCell string, styleID int) error {
|
||||
hCol, hRow, err := CellNameToCoordinates(hCell)
|
||||
if err != nil {
|
||||
|
@ -2824,7 +2822,6 @@ func (f *File) SetCellStyle(sheet, hCell, vCell string, styleID int) error {
|
|||
// max_color - Same as min_color, see above.
|
||||
//
|
||||
// bar_color - Used for data_bar. Same as min_color, see above.
|
||||
//
|
||||
func (f *File) SetConditionalFormat(sheet, area, formatSet string) error {
|
||||
var format []*formatConditional
|
||||
err := json.Unmarshal([]byte(formatSet), &format)
|
||||
|
|
3
table.go
3
table.go
|
@ -57,7 +57,6 @@ func parseFormatTableSet(formatSet string) (*formatTable, error) {
|
|||
// TableStyleLight1 - TableStyleLight21
|
||||
// TableStyleMedium1 - TableStyleMedium28
|
||||
// TableStyleDark1 - TableStyleDark11
|
||||
//
|
||||
func (f *File) AddTable(sheet, hCell, vCell, format string) error {
|
||||
formatSet, err := parseFormatTableSet(format)
|
||||
if err != nil {
|
||||
|
@ -280,7 +279,6 @@ func parseAutoFilterSet(formatSet string) (*formatAutoFilter, error) {
|
|||
// x < 2000
|
||||
// col < 2000
|
||||
// Price < 2000
|
||||
//
|
||||
func (f *File) AutoFilter(sheet, hCell, vCell, format string) error {
|
||||
hCol, hRow, err := CellNameToCoordinates(hCell)
|
||||
if err != nil {
|
||||
|
@ -438,7 +436,6 @@ func (f *File) writeCustomFilter(filter *xlsxAutoFilter, operator int, val strin
|
|||
//
|
||||
// ('x', '==', 2000) -> exp1
|
||||
// ('x', '>', 2000, 'and', 'x', '<', 5000) -> exp1 and exp2
|
||||
//
|
||||
func (f *File) parseFilterExpression(expression string, tokens []string) ([]int, []string, error) {
|
||||
var expressions []int
|
||||
var t []string
|
||||
|
|
|
@ -120,6 +120,7 @@ func (f *File) workBookWriter() {
|
|||
// SetWorkbookPrOptions provides a function to sets workbook properties.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// Date1904(bool)
|
||||
// FilterPrivacy(bool)
|
||||
// CodeName(string)
|
||||
|
@ -154,6 +155,7 @@ func (o CodeName) setWorkbookPrOption(pr *xlsxWorkbookPr) {
|
|||
// GetWorkbookPrOptions provides a function to gets workbook properties.
|
||||
//
|
||||
// Available options:
|
||||
//
|
||||
// Date1904(bool)
|
||||
// FilterPrivacy(bool)
|
||||
// CodeName(string)
|
||||
|
|
|
@ -74,7 +74,6 @@ type xlsxCalcChain struct {
|
|||
// | a new thread, false otherwise.The possible values for
|
||||
// | this attribute is defined by the W3C XML Schema
|
||||
// | boolean datatype.
|
||||
//
|
||||
type xlsxCalcChainC struct {
|
||||
R string `xml:"r,attr"`
|
||||
I int `xml:"i,attr"`
|
||||
|
|
|
@ -458,7 +458,6 @@ type DataValidation struct {
|
|||
// n (Number) | Cell containing a number.
|
||||
// s (Shared String) | Cell containing a shared string.
|
||||
// str (String) | Cell containing a formula string.
|
||||
//
|
||||
type xlsxC struct {
|
||||
XMLName xml.Name `xml:"c"`
|
||||
XMLSpace xml.Attr `xml:"space,attr,omitempty"`
|
||||
|
@ -650,7 +649,6 @@ type xlsxHyperlink struct {
|
|||
// <tablePart r:id="rId1" />
|
||||
// </tableParts>
|
||||
// </worksheet>
|
||||
//
|
||||
type xlsxTableParts struct {
|
||||
XMLName xml.Name `xml:"tableParts"`
|
||||
Count int `xml:"count,attr,omitempty"`
|
||||
|
@ -668,7 +666,6 @@ type xlsxTablePart struct {
|
|||
// image. For example:
|
||||
//
|
||||
// <picture r:id="rId1"/>
|
||||
//
|
||||
type xlsxPicture struct {
|
||||
XMLName xml.Name `xml:"picture"`
|
||||
RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
|
||||
|
|
Loading…
Reference in New Issue