Fix golint errors under confidence 0.1
This commit is contained in:
parent
99c9d04f67
commit
b4a6e61ec3
8
cell.go
8
cell.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
8
chart.go
8
chart.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
8
col.go
8
col.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -128,7 +136,7 @@ func (dd *DataValidation) SetSqrefDropList(sqref string, isCurrentSheet bool) er
|
||||||
}
|
}
|
||||||
|
|
||||||
//isCurrentSheet = false Cross-sheet sqref cell use extLst xml node unrealized
|
//isCurrentSheet = false Cross-sheet sqref cell use extLst xml node unrealized
|
||||||
return fmt.Errorf("Cross-sheet sqref cell are not supported")
|
return fmt.Errorf("cross-sheet sqref cell are not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSqref provides function to set data validation range in drop list.
|
// SetSqref provides function to set data validation range in drop list.
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
8
date.go
8
date.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
10
file.go
10
file.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -43,7 +51,7 @@ func NewFile() *File {
|
||||||
// Save provides a function to override the xlsx file with origin path.
|
// Save provides a function to override the xlsx file with origin path.
|
||||||
func (f *File) Save() error {
|
func (f *File) Save() error {
|
||||||
if f.Path == "" {
|
if f.Path == "" {
|
||||||
return fmt.Errorf("No path defined for file, consider File.WriteTo or File.Write")
|
return fmt.Errorf("no path defined for file, consider File.WriteTo or File.Write")
|
||||||
}
|
}
|
||||||
return f.SaveAs(f.Path)
|
return f.SaveAs(f.Path)
|
||||||
}
|
}
|
||||||
|
|
62
hsl.go
62
hsl.go
|
@ -1,33 +1,35 @@
|
||||||
/*
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
Copyright (c) 2012 Rodrigo Moraes. All rights reserved.
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
Redistribution and use in source and binary forms, with or without
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
modification, are permitted provided that the following conditions are
|
//
|
||||||
met:
|
// Copyright (c) 2012 Rodrigo Moraes. All rights reserved.
|
||||||
|
//
|
||||||
* Redistributions of source code must retain the above copyright
|
// Redistribution and use in source and binary forms, with or without
|
||||||
notice, this list of conditions and the following disclaimer.
|
// modification, are permitted provided that the following conditions are
|
||||||
* Redistributions in binary form must reproduce the above
|
// met:
|
||||||
copyright notice, this list of conditions and the following disclaimer
|
//
|
||||||
in the documentation and/or other materials provided with the
|
// * Redistributions of source code must retain the above copyright
|
||||||
distribution.
|
// notice, this list of conditions and the following disclaimer.
|
||||||
* Neither the name of Google Inc. nor the names of its
|
// * Redistributions in binary form must reproduce the above
|
||||||
contributors may be used to endorse or promote products derived from
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
this software without specific prior written permission.
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
// contributors may be used to endorse or promote products derived from
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
// this software without specific prior written permission.
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
//
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
*/
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
8
lib.go
8
lib.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
12
picture.go
12
picture.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -86,10 +94,10 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error {
|
||||||
}
|
}
|
||||||
ext, ok := supportImageTypes[path.Ext(picture)]
|
ext, ok := supportImageTypes[path.Ext(picture)]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("Unsupported image extension")
|
return errors.New("unsupported image extension")
|
||||||
}
|
}
|
||||||
readFile, err := os.Open(picture)
|
readFile, err := os.Open(picture)
|
||||||
if err!=nil{
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer readFile.Close()
|
defer readFile.Close()
|
||||||
|
|
8
rows.go
8
rows.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
8
shape.go
8
shape.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
12
sheet.go
12
sheet.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -371,7 +379,7 @@ func (f *File) SetSheetBackground(sheet, picture string) error {
|
||||||
}
|
}
|
||||||
ext, ok := supportImageTypes[path.Ext(picture)]
|
ext, ok := supportImageTypes[path.Ext(picture)]
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("Unsupported image extension")
|
return errors.New("unsupported image extension")
|
||||||
}
|
}
|
||||||
pictureID := f.countMedia() + 1
|
pictureID := f.countMedia() + 1
|
||||||
rID := f.addSheetRelationships(sheet, SourceRelationshipImage, "../media/image"+strconv.Itoa(pictureID)+ext, "")
|
rID := f.addSheetRelationships(sheet, SourceRelationshipImage, "../media/image"+strconv.Itoa(pictureID)+ext, "")
|
||||||
|
@ -441,7 +449,7 @@ func (f *File) deleteSheetFromContentTypes(target string) {
|
||||||
//
|
//
|
||||||
func (f *File) CopySheet(from, to int) error {
|
func (f *File) CopySheet(from, to int) error {
|
||||||
if from < 1 || to < 1 || from == to || f.GetSheetName(from) == "" || f.GetSheetName(to) == "" {
|
if from < 1 || to < 1 || from == to || f.GetSheetName(from) == "" || f.GetSheetName(to) == "" {
|
||||||
return errors.New("Invalid worksheet index")
|
return errors.New("invalid worksheet index")
|
||||||
}
|
}
|
||||||
f.copySheet(from, to)
|
f.copySheet(from, to)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
// SheetPrOption is an option of a view of a worksheet. See SetSheetPrOptions().
|
// SheetPrOption is an option of a view of a worksheet. See SetSheetPrOptions().
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
64
styles.go
64
styles.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -798,35 +806,35 @@ var validType = map[string]string{
|
||||||
|
|
||||||
// criteriaType defined the list of valid criteria types.
|
// criteriaType defined the list of valid criteria types.
|
||||||
var criteriaType = map[string]string{
|
var criteriaType = map[string]string{
|
||||||
"between": "between",
|
"between": "between",
|
||||||
"not between": "notBetween",
|
"not between": "notBetween",
|
||||||
"equal to": "equal",
|
"equal to": "equal",
|
||||||
"=": "equal",
|
"=": "equal",
|
||||||
"==": "equal",
|
"==": "equal",
|
||||||
"not equal to": "notEqual",
|
"not equal to": "notEqual",
|
||||||
"!=": "notEqual",
|
"!=": "notEqual",
|
||||||
"<>": "notEqual",
|
"<>": "notEqual",
|
||||||
"greater than": "greaterThan",
|
"greater than": "greaterThan",
|
||||||
">": "greaterThan",
|
">": "greaterThan",
|
||||||
"less than": "lessThan",
|
"less than": "lessThan",
|
||||||
"<": "lessThan",
|
"<": "lessThan",
|
||||||
"greater than or equal to": "greaterThanOrEqual",
|
"greater than or equal to": "greaterThanOrEqual",
|
||||||
">=": "greaterThanOrEqual",
|
">=": "greaterThanOrEqual",
|
||||||
"less than or equal to": "lessThanOrEqual",
|
"less than or equal to": "lessThanOrEqual",
|
||||||
"<=": "lessThanOrEqual",
|
"<=": "lessThanOrEqual",
|
||||||
"containing": "containsText",
|
"containing": "containsText",
|
||||||
"not containing": "notContains",
|
"not containing": "notContains",
|
||||||
"begins with": "beginsWith",
|
"begins with": "beginsWith",
|
||||||
"ends with": "endsWith",
|
"ends with": "endsWith",
|
||||||
"yesterday": "yesterday",
|
"yesterday": "yesterday",
|
||||||
"today": "today",
|
"today": "today",
|
||||||
"last 7 days": "last7Days",
|
"last 7 days": "last7Days",
|
||||||
"last week": "lastWeek",
|
"last week": "lastWeek",
|
||||||
"this week": "thisWeek",
|
"this week": "thisWeek",
|
||||||
"continue week": "continueWeek",
|
"continue week": "continueWeek",
|
||||||
"last month": "lastMonth",
|
"last month": "lastMonth",
|
||||||
"this month": "thisMonth",
|
"this month": "thisMonth",
|
||||||
"continue month": "continueMonth",
|
"continue month": "continueMonth",
|
||||||
}
|
}
|
||||||
|
|
||||||
// formatToString provides a function to return original string by given
|
// formatToString provides a function to return original string by given
|
||||||
|
|
16
table.go
16
table.go
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -282,7 +290,7 @@ func (f *File) autoFilter(sheet, ref string, refRange, hxAxis int, formatSet *fo
|
||||||
col := TitleToNumber(formatSet.Column)
|
col := TitleToNumber(formatSet.Column)
|
||||||
offset := col - hxAxis
|
offset := col - hxAxis
|
||||||
if offset < 0 || offset > refRange {
|
if offset < 0 || offset > refRange {
|
||||||
return fmt.Errorf("Incorrect index of column '%s'", formatSet.Column)
|
return fmt.Errorf("incorrect index of column '%s'", formatSet.Column)
|
||||||
}
|
}
|
||||||
filter.FilterColumn = &xlsxFilterColumn{
|
filter.FilterColumn = &xlsxFilterColumn{
|
||||||
ColID: offset,
|
ColID: offset,
|
||||||
|
@ -290,7 +298,7 @@ func (f *File) autoFilter(sheet, ref string, refRange, hxAxis int, formatSet *fo
|
||||||
re := regexp.MustCompile(`"(?:[^"]|"")*"|\S+`)
|
re := regexp.MustCompile(`"(?:[^"]|"")*"|\S+`)
|
||||||
token := re.FindAllString(formatSet.Expression, -1)
|
token := re.FindAllString(formatSet.Expression, -1)
|
||||||
if len(token) != 3 && len(token) != 7 {
|
if len(token) != 3 && len(token) != 7 {
|
||||||
return fmt.Errorf("Incorrect number of tokens in criteria '%s'", formatSet.Expression)
|
return fmt.Errorf("incorrect number of tokens in criteria '%s'", formatSet.Expression)
|
||||||
}
|
}
|
||||||
expressions, tokens, err := f.parseFilterExpression(formatSet.Expression, token)
|
expressions, tokens, err := f.parseFilterExpression(formatSet.Expression, token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -415,7 +423,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str
|
||||||
operator, ok := operators[strings.ToLower(tokens[1])]
|
operator, ok := operators[strings.ToLower(tokens[1])]
|
||||||
if !ok {
|
if !ok {
|
||||||
// Convert the operator from a number to a descriptive string.
|
// Convert the operator from a number to a descriptive string.
|
||||||
return []int{}, "", fmt.Errorf("Unknown operator: %s", tokens[1])
|
return []int{}, "", fmt.Errorf("unknown operator: %s", tokens[1])
|
||||||
}
|
}
|
||||||
token := tokens[2]
|
token := tokens[2]
|
||||||
// Special handling for Blanks/NonBlanks.
|
// Special handling for Blanks/NonBlanks.
|
||||||
|
@ -423,7 +431,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str
|
||||||
if re {
|
if re {
|
||||||
// Only allow Equals or NotEqual in this context.
|
// Only allow Equals or NotEqual in this context.
|
||||||
if operator != 2 && operator != 5 {
|
if operator != 2 && operator != 5 {
|
||||||
return []int{operator}, token, fmt.Errorf("The operator '%s' in expression '%s' is not valid in relation to Blanks/NonBlanks'", tokens[1], expression)
|
return []int{operator}, token, fmt.Errorf("the operator '%s' in expression '%s' is not valid in relation to Blanks/NonBlanks'", tokens[1], expression)
|
||||||
}
|
}
|
||||||
token = strings.ToLower(token)
|
token = strings.ToLower(token)
|
||||||
// The operator should always be 2 (=) to flag a "simple" equality in
|
// The operator should always be 2 (=) to flag a "simple" equality in
|
||||||
|
|
10
templates.go
10
templates.go
|
@ -1,6 +1,14 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
|
//
|
||||||
// This file contains default templates for XML files we don't yet populated
|
// This file contains default templates for XML files we don't yet populated
|
||||||
// based on content.
|
// based on content.
|
||||||
|
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
// XMLHeader define an XML declaration can also contain a standalone declaration.
|
// XMLHeader define an XML declaration can also contain a standalone declaration.
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// Package excelize providing a set of functions that allow you to write to
|
||||||
|
// and read from XLSX files. Support reads and writes XLSX file generated by
|
||||||
|
// Microsoft Excel™ 2007 and later. Support save file without losing original
|
||||||
|
// charts of XLSX. This library needs Go version 1.8 or later.
|
||||||
|
//
|
||||||
|
// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
|
||||||
|
// this source code is governed by a BSD-style license that can be found in
|
||||||
|
// the LICENSE file.
|
||||||
package excelize
|
package excelize
|
||||||
|
|
||||||
import "encoding/xml"
|
import "encoding/xml"
|
||||||
|
|
Loading…
Reference in New Issue