From 2132de1a0848794a49225470e42f91e9c34bb6da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Thu, 14 Jun 2018 17:00:00 +0200 Subject: Extract WriteTo method (see io.WriterTo) to expose bytes written Extract a WriteTo() method (see io.WriterTo) that exposes the count of bytes written and rewrite Write() to use it. --- file.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/file.go b/file.go index 39798e1..4f06d1e 100644 --- a/file.go +++ b/file.go @@ -60,6 +60,12 @@ func (f *File) SaveAs(name string) error { // Write provides function to write to an io.Writer. func (f *File) Write(w io.Writer) error { + _, err := f.WriteTo(w) + return err +} + +// WriteTo implements io.WriterTo to write the file. +func (f *File) WriteTo(w io.Writer) (int64, error) { buf := new(bytes.Buffer) zw := zip.NewWriter(buf) f.contentTypesWriter() @@ -70,21 +76,17 @@ func (f *File) Write(w io.Writer) error { for path, content := range f.XLSX { fi, err := zw.Create(path) if err != nil { - return err + return 0, err } _, err = fi.Write(content) if err != nil { - return err + return 0, err } } err := zw.Close() if err != nil { - return err - } - - if _, err := buf.WriteTo(w); err != nil { - return err + return 0, err } - return nil + return buf.WriteTo(w) } -- cgit v1.2.1 From 4a1b4064568189d6f819f5fe19ff9bf6d6e8de95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Fri, 17 Nov 2017 12:56:58 +0100 Subject: CopySheet() using reflect instead of encoding/gob Use github.com/mohae/deepcopy to deep copy worksheets instead of the internal deepcopy function that was using encoding/gob serialization and deserialization. Rationale: 1/ using `encoding/gob` is much slower than [`mohae/deepcopy`](https://github.com/mohae/deepcopy/) 2/ When building an application this implementation of `deepcopy` drags the `encoding/gob` package into the binary. And this package is much bigger than `mohae/deepcopy` (which only depends on `time` and `reflect`). ``` $ LC_ALL=C stat -f "%6z %N" $(go env GOPATH)/pkg/$(go env GOOS)_$(go env GOARCH)/github.com/mohae/deepcopy.a $(go env GOROOT)/pkg/$(go env GOOS)_$(go env GOARCH)/encoding/gob.a 10508 .../pkg/darwin_amd64/github.com/mohae/deepcopy.a 541818 .../pkg/darwin_amd64/encoding/gob.a ``` --- excelize_test.go | 1 - lib.go | 12 ------------ sheet.go | 16 +++++++--------- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/excelize_test.go b/excelize_test.go index 4dbc709..aca33b4 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -88,7 +88,6 @@ func TestOpenFile(t *testing.T) { xlsx.SetCellValue("Sheet2", "F16", true) xlsx.SetCellValue("Sheet2", "F17", complex64(5+10i)) t.Log(letterOnlyMapF('x')) - t.Log(deepCopy(nil, nil)) shiftJulianToNoon(1, -0.6) timeFromExcelTime(61, true) timeFromExcelTime(62, true) diff --git a/lib.go b/lib.go index fc95b23..4379be4 100644 --- a/lib.go +++ b/lib.go @@ -3,7 +3,6 @@ package excelize import ( "archive/zip" "bytes" - "encoding/gob" "io" "log" "math" @@ -115,17 +114,6 @@ func intOnlyMapF(rune rune) rune { return -1 } -// deepCopy provides method to creates a deep copy of whatever is passed to it -// and returns the copy in an interface. The returned value will need to be -// asserted to the correct type. -func deepCopy(dst, src interface{}) error { - var buf bytes.Buffer - if err := gob.NewEncoder(&buf).Encode(src); err != nil { - return err - } - return gob.NewDecoder(bytes.NewBuffer(buf.Bytes())).Decode(dst) -} - // boolPtr returns a pointer to a bool with the given value. func boolPtr(b bool) *bool { return &b } diff --git a/sheet.go b/sheet.go index 9e8f4c9..5350235 100644 --- a/sheet.go +++ b/sheet.go @@ -10,6 +10,8 @@ import ( "strconv" "strings" "unicode/utf8" + + "github.com/mohae/deepcopy" ) // NewSheet provides function to create a new sheet by given worksheet name, @@ -433,18 +435,15 @@ func (f *File) CopySheet(from, to int) error { if from < 1 || to < 1 || from == to || f.GetSheetName(from) == "" || f.GetSheetName(to) == "" { return errors.New("Invalid worksheet index") } - return f.copySheet(from, to) + f.copySheet(from, to) + return nil } // copySheet provides function to duplicate a worksheet by gave source and // target worksheet name. -func (f *File) copySheet(from, to int) error { +func (f *File) copySheet(from, to int) { sheet := f.workSheetReader("sheet" + strconv.Itoa(from)) - worksheet := xlsxWorksheet{} - err := deepCopy(&worksheet, &sheet) - if err != nil { - return err - } + worksheet := deepcopy.Copy(sheet).(*xlsxWorksheet) path := "xl/worksheets/sheet" + strconv.Itoa(to) + ".xml" if len(worksheet.SheetViews.SheetView) > 0 { worksheet.SheetViews.SheetView[0].TabSelected = false @@ -452,14 +451,13 @@ func (f *File) copySheet(from, to int) error { worksheet.Drawing = nil worksheet.TableParts = nil worksheet.PageSetUp = nil - f.Sheet[path] = &worksheet + f.Sheet[path] = worksheet toRels := "xl/worksheets/_rels/sheet" + strconv.Itoa(to) + ".xml.rels" fromRels := "xl/worksheets/_rels/sheet" + strconv.Itoa(from) + ".xml.rels" _, ok := f.XLSX[fromRels] if ok { f.XLSX[toRels] = f.XLSX[fromRels] } - return err } // SetSheetVisible provides function to set worksheet visible by given worksheet -- cgit v1.2.1 From 37c470e8c0df99bd47f7054834e0db93b75ab073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C4=81rti=C5=86=C5=A1?= Date: Tue, 19 Jun 2018 15:28:40 +0300 Subject: Ability to parse dates further in future Golangs time.Duration uses nanoseconds, thus it is limited to approximately 290 years. --- date.go | 23 ++++++++++++++++++++++- date_test.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 date_test.go diff --git a/date.go b/date.go index a493866..e078374 100644 --- a/date.go +++ b/date.go @@ -15,7 +15,20 @@ func timeToUTCTime(t time.Time) time.Time { // timeToExcelTime provides function to convert time to Excel time. func timeToExcelTime(t time.Time) float64 { - return float64(t.UnixNano())/8.64e13 + 25569.0 + // TODO in future this should probably also handle date1904 and like TimeFromExcelTime + var excelTime float64 + excelTime = 0 + // check if UnixNano would be out of int64 range + for t.Unix() > 9223372036 { + // reduce by aprox. 290 years, which is max for int64 nanoseconds + deltaDays := 290 * 364 + delta := time.Duration(deltaDays * 8.64e13) + excelTime = excelTime + float64(deltaDays) + t = t.Add(-delta) + } + // finally add remainder of UnixNano to keep nano precision + // and 25569 which is days between 1900 and 1970 + return excelTime + float64(t.UnixNano())/8.64e13 + 25569.0 } // shiftJulianToNoon provides function to process julian date to noon. @@ -90,6 +103,7 @@ func doTheFliegelAndVanFlandernAlgorithm(jd int) (day, month, year int) { // timeFromExcelTime provides function to convert an excelTime representation // (stored as a floating point number) to a time.Time. func timeFromExcelTime(excelTime float64, date1904 bool) time.Time { + const MDD int64 = 106750 // Max time.Duration Days, aprox. 290 years var date time.Time var intPart = int64(excelTime) // Excel uses Julian dates prior to March 1st 1900, and Gregorian @@ -113,6 +127,13 @@ func timeFromExcelTime(excelTime float64, date1904 bool) time.Time { } else { date = time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC) } + + // Duration is limited to aprox. 290 years + for intPart > MDD { + durationDays := time.Duration(MDD) * time.Hour * 24 + date = date.Add(durationDays) + intPart = intPart - MDD + } durationDays := time.Duration(intPart) * time.Hour * 24 durationPart := time.Duration(dayNanoSeconds * floatPart) return date.Add(durationDays).Add(durationPart) diff --git a/date_test.go b/date_test.go new file mode 100644 index 0000000..bf071e0 --- /dev/null +++ b/date_test.go @@ -0,0 +1,42 @@ +package excelize + +import ( + "testing" + "time" +) + +type dateTest struct { + ExcelValue float64 + GoValue time.Time +} + +func TestTimeToExcelTime(t *testing.T) { + trueExpectedInputList := []dateTest { + {0.0, time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC)}, + {25569.0, time.Unix(0, 0)}, + {43269.0, time.Date(2018, 6, 18, 0, 0, 0, 0, time.UTC)}, + {401769.0, time.Date(3000, 1, 1, 0, 0, 0, 0, time.UTC)}, + } + + for _, test := range trueExpectedInputList { + if test.ExcelValue != timeToExcelTime(test.GoValue) { + t.Fatalf("Expected %v from %v = true, got %v\n", test.ExcelValue, test.GoValue, timeToExcelTime(test.GoValue)) + } + } +} + +func TestTimeFromExcelTime(t *testing.T) { + trueExpectedInputList := []dateTest { + {0.0, time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC)}, + {60.0, time.Date(1900, 2, 28, 0, 0, 0, 0, time.UTC)}, + {61.0, time.Date(1900, 3, 1, 0, 0, 0, 0, time.UTC)}, + {41275.0, time.Date(2013, 1, 1, 0, 0, 0, 0, time.UTC)}, + {401769.0, time.Date(3000, 1, 1, 0, 0, 0, 0, time.UTC)}, + } + + for _, test := range trueExpectedInputList { + if test.GoValue != timeFromExcelTime(test.ExcelValue, false) { + t.Fatalf("Expected %v from %v = true, got %v\n", test.GoValue, test.ExcelValue, timeFromExcelTime(test.ExcelValue, false)) + } + } +} -- cgit v1.2.1 From 741810a8635d51b639a9a279211386a75a7b046f Mon Sep 17 00:00:00 2001 From: Rad Cirskis Date: Sat, 23 Jun 2018 23:35:27 +1200 Subject: improved commenting formatting --- comment.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/comment.go b/comment.go index b597da1..b1853ad 100644 --- a/comment.go +++ b/comment.go @@ -3,6 +3,7 @@ package excelize import ( "encoding/json" "encoding/xml" + "fmt" "strconv" "strings" ) @@ -49,14 +50,23 @@ func (f *File) AddComment(sheet, cell, format string) error { } commentsXML := "xl/comments" + strconv.Itoa(commentID) + ".xml" f.addComment(commentsXML, cell, formatSet) - f.addDrawingVML(commentID, drawingVML, cell) + var colCount int + for i, l := range strings.Split(formatSet.Text, "\n") { + if ll := len(l); ll > colCount { + if i == 0 { + ll += len(formatSet.Author) + } + colCount = ll + } + } + f.addDrawingVML(commentID, drawingVML, cell, strings.Count(formatSet.Text, "\n")+1, colCount) f.addContentTypePart(commentID, "comments") return err } // addDrawingVML provides function to create comment as // xl/drawings/vmlDrawing%d.vml by given commit ID and cell. -func (f *File) addDrawingVML(commentID int, drawingVML, cell string) { +func (f *File) addDrawingVML(commentID int, drawingVML, cell string, lineCount, colCount int) { col := string(strings.Map(letterOnlyMapF, cell)) row, _ := strconv.Atoi(strings.Map(intOnlyMapF, cell)) xAxis := row - 1 @@ -83,7 +93,7 @@ func (f *File) addDrawingVML(commentID int, drawingVML, cell string) { }, VPath: &vPath{ Gradientshapeok: "t", - Connecttype: "rect", + Connecttype: "miter", }, }, } @@ -113,10 +123,12 @@ func (f *File) addDrawingVML(commentID int, drawingVML, cell string) { }, ClientData: &xClientData{ ObjectType: "Note", - Anchor: "3, 15, 8, 6, 4, 54, 13, 2", - AutoFill: "False", - Row: xAxis, - Column: yAxis, + Anchor: fmt.Sprintf( + "%d, 23, %d, 0, %d, %d, %d, 5", + 1+yAxis, 1+xAxis, 1+yAxis+lineCount, (colCount*991)/175+5, 2+xAxis), + AutoFill: "True", + Row: xAxis, + Column: yAxis, }, } s, _ := xml.Marshal(sp) -- cgit v1.2.1 From 4855a43bc6a4724c5518634ffec3967d03c45663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C4=81rti=C5=86=C5=A1?= Date: Tue, 26 Jun 2018 16:33:21 +0300 Subject: Restore date 32bit compatibility, be more verbose Do not use large int64 constants that are not available in GOARCH=386 Fix #239 --- date.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/date.go b/date.go index e078374..f3db0ee 100644 --- a/date.go +++ b/date.go @@ -17,12 +17,13 @@ func timeToUTCTime(t time.Time) time.Time { func timeToExcelTime(t time.Time) float64 { // TODO in future this should probably also handle date1904 and like TimeFromExcelTime var excelTime float64 + var deltaDays int64 excelTime = 0 + deltaDays = 290 * 364 // check if UnixNano would be out of int64 range - for t.Unix() > 9223372036 { + for t.Unix() > deltaDays*24*60*60 { // reduce by aprox. 290 years, which is max for int64 nanoseconds - deltaDays := 290 * 364 - delta := time.Duration(deltaDays * 8.64e13) + delta := time.Duration(deltaDays) * 24 * time.Hour excelTime = excelTime + float64(deltaDays) t = t.Add(-delta) } @@ -103,7 +104,7 @@ func doTheFliegelAndVanFlandernAlgorithm(jd int) (day, month, year int) { // timeFromExcelTime provides function to convert an excelTime representation // (stored as a floating point number) to a time.Time. func timeFromExcelTime(excelTime float64, date1904 bool) time.Time { - const MDD int64 = 106750 // Max time.Duration Days, aprox. 290 years + const MDD int64 = 106750 // Max time.Duration Days, aprox. 290 years var date time.Time var intPart = int64(excelTime) // Excel uses Julian dates prior to March 1st 1900, and Gregorian @@ -127,7 +128,7 @@ func timeFromExcelTime(excelTime float64, date1904 bool) time.Time { } else { date = time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC) } - + // Duration is limited to aprox. 290 years for intPart > MDD { durationDays := time.Duration(MDD) * time.Hour * 24 -- cgit v1.2.1 From 74c6091cfc4e023975018fb434a3a492fdcb5c76 Mon Sep 17 00:00:00 2001 From: xuri Date: Thu, 28 Jun 2018 10:03:53 +0800 Subject: Update comment.go make the comment box's height auto and having the minimum height. --- comment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comment.go b/comment.go index b1853ad..9548d78 100644 --- a/comment.go +++ b/comment.go @@ -125,7 +125,7 @@ func (f *File) addDrawingVML(commentID int, drawingVML, cell string, lineCount, ObjectType: "Note", Anchor: fmt.Sprintf( "%d, 23, %d, 0, %d, %d, %d, 5", - 1+yAxis, 1+xAxis, 1+yAxis+lineCount, (colCount*991)/175+5, 2+xAxis), + 1+yAxis, 1+xAxis, 2+yAxis+lineCount, colCount+yAxis, 2+xAxis+lineCount), AutoFill: "True", Row: xAxis, Column: yAxis, -- cgit v1.2.1 From 9cb0e9308b7e65d5a277b0c6af9fa0e8680b3658 Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 30 Jun 2018 16:44:09 +0800 Subject: - Update Travis CI to include GOARCH=386 tests, relate issue #239 and #244; - Fix doc typo --- .travis.yml | 10 ++++++++++ styles.go | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f4e5c0c..26ca7b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,16 @@ install: go: - 1.8.x - 1.9.x + - 1.10.x + +os: + - linux + - osx + +env: + matrix: + - GOARCH=amd64 + - GOARCH=386 script: - go vet ./... diff --git a/styles.go b/styles.go index b919475..32350ca 100644 --- a/styles.go +++ b/styles.go @@ -1404,7 +1404,7 @@ func parseFormatStyleSet(style string) (*formatStyle, error) { // 173 | $ English (New Zealand) // 174 | $ English (Singapore) // 175 | $ English (Trinidad & Tobago) -// 176 | $ English (U.S. Vigin Islands) +// 176 | $ English (U.S. Virgin Islands) // 177 | $ English (United States) // 178 | $ French (Canada) // 179 | $ Hawaiian (United States) -- cgit v1.2.1 From e3050d21e7c645ba8ee88c9e0f32dd241e1c4cc3 Mon Sep 17 00:00:00 2001 From: Rad Cirskis Date: Sat, 30 Jun 2018 22:37:14 +1200 Subject: added retieval of worksheet comments --- comment.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/comment.go b/comment.go index 9548d78..bab7370 100644 --- a/comment.go +++ b/comment.go @@ -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 -- cgit v1.2.1 From 1a953b6601df2484a39203edff59943e41e3f438 Mon Sep 17 00:00:00 2001 From: Rad Cirskis Date: Sat, 30 Jun 2018 22:55:14 +1200 Subject: added unit tests --- excelize_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/excelize_test.go b/excelize_test.go index aca33b4..0bcb16d 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -816,6 +816,11 @@ func TestAddComments(t *testing.T) { if err != nil { t.Error(err) } + allComments := xlsx.GetComments() + if len(allComments) != 2 { + t.Error("Expected 2 comment entry elements.") + } + } func TestAutoFilter(t *testing.T) { -- cgit v1.2.1 From d6468fc114217678e8bc8b4324fd6185794e0182 Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 7 Jul 2018 15:59:48 +0800 Subject: - Initialize theme support; - RGBA, HSL color convert has been added; - go test updated --- excelize.go | 2 + excelize_test.go | 26 ++++++++++ file.go | 1 + hsl.go | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ styles.go | 26 ++++++++++ xmlTheme.go | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 336 insertions(+) create mode 100644 hsl.go create mode 100644 xmlTheme.go diff --git a/excelize.go b/excelize.go index 0972e96..99243a7 100644 --- a/excelize.go +++ b/excelize.go @@ -21,6 +21,7 @@ type File struct { Sheet map[string]*xlsxWorksheet SheetCount int Styles *xlsxStyleSheet + Theme *xlsxTheme WorkBook *xlsxWorkbook WorkBookRels *xlsxWorkbookRels XLSX map[string][]byte @@ -66,6 +67,7 @@ func OpenReader(r io.Reader) (*File, error) { } f.sheetMap = f.getSheetMap() f.Styles = f.stylesReader() + f.Theme = f.themeReader() return f, nil } diff --git a/excelize_test.go b/excelize_test.go index aca33b4..549190c 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -2,6 +2,7 @@ package excelize import ( "fmt" + "image/color" _ "image/gif" _ "image/jpeg" _ "image/png" @@ -1145,6 +1146,31 @@ func TestOutlineLevel(t *testing.T) { xlsx.SetColOutlineLevel("Sheet2", "B", 2) } +func TestThemeColor(t *testing.T) { + t.Log(ThemeColor("000000", -0.1)) + t.Log(ThemeColor("000000", 0)) + t.Log(ThemeColor("000000", 1)) +} + +func TestHSL(t *testing.T) { + var hsl HSL + t.Log(hsl.RGBA()) + t.Log(hslModel(hsl)) + t.Log(hslModel(color.Gray16{Y: uint16(1)})) + t.Log(HSLToRGB(0, 1, 0.4)) + t.Log(HSLToRGB(0, 1, 0.6)) + t.Log(hueToRGB(0, 0, -1)) + t.Log(hueToRGB(0, 0, 2)) + t.Log(hueToRGB(0, 0, 1.0/7)) + t.Log(hueToRGB(0, 0, 0.4)) + t.Log(hueToRGB(0, 0, 2.0/4)) + t.Log(RGBToHSL(255, 255, 0)) + t.Log(RGBToHSL(0, 255, 255)) + t.Log(RGBToHSL(250, 100, 50)) + t.Log(RGBToHSL(50, 100, 250)) + t.Log(RGBToHSL(250, 50, 100)) +} + func trimSliceSpace(s []string) []string { for { if len(s) > 0 && s[len(s)-1] == "" { diff --git a/file.go b/file.go index 4f06d1e..2b1f1e0 100644 --- a/file.go +++ b/file.go @@ -36,6 +36,7 @@ func NewFile() *File { f.WorkBookRels = f.workbookRelsReader() f.Sheet["xl/worksheets/sheet1.xml"] = f.workSheetReader("Sheet1") f.sheetMap["Sheet1"] = "xl/worksheets/sheet1.xml" + f.Theme = f.themeReader() return f } diff --git a/hsl.go b/hsl.go new file mode 100644 index 0000000..bd868b1 --- /dev/null +++ b/hsl.go @@ -0,0 +1,141 @@ +/* +Copyright (c) 2012 Rodrigo Moraes. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +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 + +import ( + "image/color" + "math" +) + +// HSLModel converts any color.Color to a HSL color. +var HSLModel = color.ModelFunc(hslModel) + +// HSL represents a cylindrical coordinate of points in an RGB color model. +// +// Values are in the range 0 to 1. +type HSL struct { + H, S, L float64 +} + +// RGBA returns the alpha-premultiplied red, green, blue and alpha values +// for the HSL. +func (c HSL) RGBA() (uint32, uint32, uint32, uint32) { + r, g, b := HSLToRGB(c.H, c.S, c.L) + return uint32(r) * 0x101, uint32(g) * 0x101, uint32(b) * 0x101, 0xffff +} + +// hslModel converts a color.Color to HSL. +func hslModel(c color.Color) color.Color { + if _, ok := c.(HSL); ok { + return c + } + r, g, b, _ := c.RGBA() + h, s, l := RGBToHSL(uint8(r>>8), uint8(g>>8), uint8(b>>8)) + return HSL{h, s, l} +} + +// RGBToHSL converts an RGB triple to a HSL triple. +func RGBToHSL(r, g, b uint8) (h, s, l float64) { + fR := float64(r) / 255 + fG := float64(g) / 255 + fB := float64(b) / 255 + max := math.Max(math.Max(fR, fG), fB) + min := math.Min(math.Min(fR, fG), fB) + l = (max + min) / 2 + if max == min { + // Achromatic. + h, s = 0, 0 + } else { + // Chromatic. + d := max - min + if l > 0.5 { + s = d / (2.0 - max - min) + } else { + s = d / (max + min) + } + switch max { + case fR: + h = (fG - fB) / d + if fG < fB { + h += 6 + } + case fG: + h = (fB-fR)/d + 2 + case fB: + h = (fR-fG)/d + 4 + } + h /= 6 + } + return +} + +// HSLToRGB converts an HSL triple to a RGB triple. +func HSLToRGB(h, s, l float64) (r, g, b uint8) { + var fR, fG, fB float64 + if s == 0 { + fR, fG, fB = l, l, l + } else { + var q float64 + if l < 0.5 { + q = l * (1 + s) + } else { + q = l + s - s*l + } + p := 2*l - q + fR = hueToRGB(p, q, h+1.0/3) + fG = hueToRGB(p, q, h) + fB = hueToRGB(p, q, h-1.0/3) + } + r = uint8((fR * 255) + 0.5) + g = uint8((fG * 255) + 0.5) + b = uint8((fB * 255) + 0.5) + return +} + +// hueToRGB is a helper function for HSLToRGB. +func hueToRGB(p, q, t float64) float64 { + if t < 0 { + t++ + } + if t > 1 { + t-- + } + if t < 1.0/6 { + return p + (q-p)*6*t + } + if t < 0.5 { + return q + } + if t < 2.0/3 { + return p + (q-p)*(2.0/3-t)*6 + } + return p +} diff --git a/styles.go b/styles.go index 32350ca..e2a1ae6 100644 --- a/styles.go +++ b/styles.go @@ -2723,3 +2723,29 @@ func drawConfFmtExp(p int, ct string, format *formatConditional) *xlsxCfRule { func getPaletteColor(color string) string { return "FF" + strings.Replace(strings.ToUpper(color), "#", "", -1) } + +// themeReader provides function to get the pointer to the xl/theme/theme1.xml +// structure after deserialization. +func (f *File) themeReader() *xlsxTheme { + var theme xlsxTheme + _ = xml.Unmarshal([]byte(f.readXML("xl/theme/theme1.xml")), &theme) + return &theme +} + +// ThemeColor applied the color with tint value. +func ThemeColor(baseColor string, tint float64) string { + if tint == 0 { + return "FF" + baseColor + } + r, _ := strconv.ParseInt(baseColor[0:2], 16, 64) + g, _ := strconv.ParseInt(baseColor[2:4], 16, 64) + b, _ := strconv.ParseInt(baseColor[4:6], 16, 64) + h, s, l := RGBToHSL(uint8(r), uint8(g), uint8(b)) + if tint < 0 { + l *= (1 + tint) + } else { + l = l*(1-tint) + (1 - (1 - tint)) + } + br, bg, bb := HSLToRGB(h, s, l) + return fmt.Sprintf("FF%02X%02X%02X", br, bg, bb) +} diff --git a/xmlTheme.go b/xmlTheme.go new file mode 100644 index 0000000..d2ab343 --- /dev/null +++ b/xmlTheme.go @@ -0,0 +1,140 @@ +package excelize + +import "encoding/xml" + +// xlsxTheme directly maps the theme element in the namespace +// http://schemas.openxmlformats.org/drawingml/2006/main +type xlsxTheme struct { + ThemeElements xlsxThemeElements `xml:"themeElements"` + ObjectDefaults xlsxObjectDefaults `xml:"objectDefaults"` + ExtraClrSchemeLst xlsxExtraClrSchemeLst `xml:"extraClrSchemeLst"` + ExtLst *xlsxExtLst `xml:"extLst"` +} + +// objectDefaults element allows for the definition of default shape, line, +// and textbox formatting properties. An application can use this information +// to format a shape (or text) initially on insertion into a document. +type xlsxObjectDefaults struct { + ObjectDefaults string `xml:",innerxml"` +} + +// xlsxExtraClrSchemeLst element is a container for the list of extra color +// schemes present in a document. +type xlsxExtraClrSchemeLst struct { + ExtraClrSchemeLst string `xml:",innerxml"` +} + +// xlsxThemeElements directly maps the element defines the theme formatting +// options for the theme and is the workhorse of the theme. This is where the +// bulk of the shared theme information is contained and used by a document. +// This element contains the color scheme, font scheme, and format scheme +// elements which define the different formatting aspects of what a theme +// defines. +type xlsxThemeElements struct { + ClrScheme xlsxClrScheme `xml:"clrScheme"` + FontScheme xlsxFontScheme `xml:"fontScheme"` + FmtScheme xlsxFmtScheme `xml:"fmtScheme"` +} + +// xlsxClrScheme element specifies the theme color, stored in the document's +// Theme part to which the value of this theme color shall be mapped. This +// mapping enables multiple theme colors to be chained together. +type xlsxClrScheme struct { + Name string `xml:"name,attr"` + Children []xlsxClrSchemeEl `xml:",any"` +} + +// xlsxFontScheme element defines the font scheme within the theme. The font +// scheme consists of a pair of major and minor fonts for which to use in a +// document. The major font corresponds well with the heading areas of a +// document, and the minor font corresponds well with the normal text or +// paragraph areas. +type xlsxFontScheme struct { + Name string `xml:"name,attr"` + MajorFont xlsxMajorFont `xml:"majorFont"` + MinorFont xlsxMinorFont `xml:"minorFont"` + ExtLst *xlsxExtLst `xml:"extLst"` +} + +// xlsxMajorFont element defines the set of major fonts which are to be used +// under different languages or locals. +type xlsxMajorFont struct { + Children []xlsxFontSchemeEl `xml:",any"` +} + +// xlsxMinorFont element defines the set of minor fonts that are to be used +// under different languages or locals. +type xlsxMinorFont struct { + Children []xlsxFontSchemeEl `xml:",any"` +} + +// xlsxFmtScheme element contains the background fill styles, effect styles, +// fill styles, and line styles which define the style matrix for a theme. The +// style matrix consists of subtle, moderate, and intense fills, lines, and +// effects. The background fills are not generally thought of to directly be +// associated with the matrix, but do play a role in the style of the overall +// document. Usually, a given object chooses a single line style, a single +// fill style, and a single effect style in order to define the overall final +// look of the object. +type xlsxFmtScheme struct { + Name string `xml:"name,attr"` + FillStyleLst xlsxFillStyleLst `xml:"fillStyleLst"` + LnStyleLst xlsxLnStyleLst `xml:"lnStyleLst"` + EffectStyleLst xlsxEffectStyleLst `xml:"effectStyleLst"` + BgFillStyleLst xlsxBgFillStyleLst `xml:"bgFillStyleLst"` +} + +// xlsxFillStyleLst element defines a set of three fill styles that are used +// within a theme. The three fill styles are arranged in order from subtle to +// moderate to intense. +type xlsxFillStyleLst struct { + FillStyleLst string `xml:",innerxml"` +} + +// xlsxLnStyleLst element defines a list of three line styles for use within a +// theme. The three line styles are arranged in order from subtle to moderate +// to intense versions of lines. This list makes up part of the style matrix. +type xlsxLnStyleLst struct { + LnStyleLst string `xml:",innerxml"` +} + +// xlsxEffectStyleLst element defines a set of three effect styles that create +// the effect style list for a theme. The effect styles are arranged in order +// of subtle to moderate to intense. +type xlsxEffectStyleLst struct { + EffectStyleLst string `xml:",innerxml"` +} + +// xlsxBgFillStyleLst element defines a list of background fills that are +// used within a theme. The background fills consist of three fills, arranged +// in order from subtle to moderate to intense. +type xlsxBgFillStyleLst struct { + BgFillStyleLst string `xml:",innerxml"` +} + +// xlsxClrScheme maps to children of the clrScheme element in the namespace +// http://schemas.openxmlformats.org/drawingml/2006/main - currently I have +// not checked it for completeness - it does as much as I need. +type xlsxClrSchemeEl struct { + XMLName xml.Name + SysClr *xlsxSysClr `xml:"sysClr"` + SrgbClr *attrValString `xml:"srgbClr"` +} + +// xlsxFontSchemeEl directly maps the major and minor font of the style's font +// scheme. +type xlsxFontSchemeEl struct { + XMLName xml.Name + Script string `xml:"script,attr,omitempty"` + Typeface string `xml:"typeface,attr"` + Panose string `xml:"panose,attr,omitempty"` + PitchFamily string `xml:"pitchFamily,attr,omitempty"` + Charset string `xml:"charset,attr,omitempty"` +} + +// xlsxSysClr element specifies a color bound to predefined operating system +// elements. +type xlsxSysClr struct { + Val string `xml:"val,attr"` + LastClr string `xml:"lastClr,attr"` +} -- cgit v1.2.1 From 79dfe1c3070b3c4af14a40acaa5bd8cb477acd3e Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 13 Jul 2018 17:40:47 +0800 Subject: GoDoc updated. --- README.md | 2 +- README_zh.md | 2 +- chart.go | 2 ++ comment.go | 4 ++-- lib.go | 9 +++++++++ picture.go | 2 +- styles.go | 2 +- table.go | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 88a67f3..61ac2d6 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## Introduction -Excelize is a library written in pure Go and 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. The full API docs can be seen using go's built-in documentation tool, or online at [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) and [Chinese translation](https://xuri.me/excelize/zh_cn). +Excelize is a library written in pure Go and 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. The full API docs can be seen using go's built-in documentation tool, or online at [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) and [docs reference](https://xuri.me/excelize/). ## Basic Usage diff --git a/README_zh.md b/README_zh.md index ef149b0..49680d1 100644 --- a/README_zh.md +++ b/README_zh.md @@ -11,7 +11,7 @@ ## 简介 -Excelize 是 Go 语言编写的用于操作 Office Excel 文档类库,基于 ECMA-376 Office OpenXML 标准。可以使用它来读取、写入由 Microsoft Excel™ 2007 及以上版本创建的 XLSX 文档。相比较其他的开源类库,Excelize 支持写入原本带有图片(表)、透视表和切片器等复杂样式的文档,还支持向 Excel 文档中插入图片与图表,并且在保存后不会丢失文档原有样式,可以应用于各类报表系统中。使用本类库要求使用的 Go 语言为 1.8 或更高版本,完整的 API 使用文档请访问 [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) 或查看 [中文翻译](https://xuri.me/excelize/zh_cn)。 +Excelize 是 Go 语言编写的用于操作 Office Excel 文档类库,基于 ECMA-376 Office OpenXML 标准。可以使用它来读取、写入由 Microsoft Excel™ 2007 及以上版本创建的 XLSX 文档。相比较其他的开源类库,Excelize 支持写入原本带有图片(表)、透视表和切片器等复杂样式的文档,还支持向 Excel 文档中插入图片与图表,并且在保存后不会丢失文档原有样式,可以应用于各类报表系统中。使用本类库要求使用的 Go 语言为 1.8 或更高版本,完整的 API 使用文档请访问 [godoc.org](https://godoc.org/github.com/360EntSecGroup-Skylar/excelize) 或查看 [参考文档](https://xuri.me/excelize/)。 ## 快速上手 diff --git a/chart.go b/chart.go index 7ba1d91..41354f1 100644 --- a/chart.go +++ b/chart.go @@ -352,7 +352,9 @@ func parseFormatChartSet(formatSet string) (*formatChart, error) { // minimum // // reverse_order: Specifies that the categories or values on reverse order (orientation of the chart). The reverse_order property is optional. The default value is false. +// // maximum: Specifies that the fixed maximum, 0 is auto. The maximum property is optional. The default value is auto. +// // minimum: Specifies that the fixed minimum, 0 is auto. The minimum property is optional. The default value is auto. // // Set chart size by dimension property. The dimension property is optional. The default width is 480, and height is 290. diff --git a/comment.go b/comment.go index bab7370..92dd71d 100644 --- a/comment.go +++ b/comment.go @@ -15,11 +15,11 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) { Author: "Author:", Text: " ", } - err := json.Unmarshal([]byte(formatSet), &format) + err := json.Unmarshal(parseFormatSet(formatSet), &format) return &format, err } -// GetComments retrievs all comments and returns a map +// GetComments retrieves 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{} diff --git a/lib.go b/lib.go index 4379be4..e1b0693 100644 --- a/lib.go +++ b/lib.go @@ -164,3 +164,12 @@ func getCellColRow(cell string) (col, row string) { return cell, "" } + +// parseFormatSet provides a method to convert format string to []byte and +// handle empty string. +func parseFormatSet(formatSet string) []byte { + if formatSet != "" { + return []byte(formatSet) + } + return []byte("{}") +} diff --git a/picture.go b/picture.go index ab72fc8..04d5062 100644 --- a/picture.go +++ b/picture.go @@ -26,7 +26,7 @@ func parseFormatPictureSet(formatSet string) (*formatPicture, error) { XScale: 1.0, YScale: 1.0, } - err := json.Unmarshal([]byte(formatSet), &format) + err := json.Unmarshal(parseFormatSet(formatSet), &format) return &format, err } diff --git a/styles.go b/styles.go index e2a1ae6..251e335 100644 --- a/styles.go +++ b/styles.go @@ -2407,7 +2407,7 @@ func (f *File) SetCellStyle(sheet, hcell, vcell string, styleID int) { // // The criteria parameter is used to set the criteria by which the cell data // will be evaluated. It has no default value. The most common criteria as -// applied to {'type': 'cell'} are: +// applied to {"type":"cell"} are: // // between | // not between | diff --git a/table.go b/table.go index 941b52f..67f9be0 100644 --- a/table.go +++ b/table.go @@ -16,7 +16,7 @@ func parseFormatTableSet(formatSet string) (*formatTable, error) { TableStyle: "", ShowRowStripes: true, } - err := json.Unmarshal([]byte(formatSet), &format) + err := json.Unmarshal(parseFormatSet(formatSet), &format) return &format, err } -- cgit v1.2.1 From a3571ee39bec82d15d9a183aed7f7db39e0a160f Mon Sep 17 00:00:00 2001 From: xuri Date: Tue, 17 Jul 2018 15:28:22 +0800 Subject: Bugfix: create worksheet cause file issue. Relate issue #249. --- comment.go | 2 +- excelize_test.go | 4 ---- sheet.go | 10 +++++++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/comment.go b/comment.go index 92dd71d..ab10310 100644 --- a/comment.go +++ b/comment.go @@ -15,7 +15,7 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) { Author: "Author:", Text: " ", } - err := json.Unmarshal(parseFormatSet(formatSet), &format) + err := json.Unmarshal([]byte(formatSet), &format) return &format, err } diff --git a/excelize_test.go b/excelize_test.go index 94732fe..c9a87d0 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -771,10 +771,6 @@ func TestAddTable(t *testing.T) { if err != nil { t.Error(err) } - err = xlsx.AddTable("Sheet2", "A2", "B5", ``) - if err != nil { - t.Log(err) - } err = xlsx.AddTable("Sheet2", "A2", "B5", `{"table_name":"table","table_style":"TableStyleMedium2", "show_first_column":true,"show_last_column":true,"show_row_stripes":false,"show_column_stripes":true}`) if err != nil { t.Error(err) diff --git a/sheet.go b/sheet.go index 5350235..6029a29 100644 --- a/sheet.go +++ b/sheet.go @@ -132,9 +132,17 @@ func (f *File) setSheet(index int, name string) { // allowed in sheet title. func (f *File) setWorkbook(name string, rid int) { content := f.workbookReader() + rID := 0 + for _, v := range content.Sheets.Sheet { + t, _ := strconv.Atoi(v.SheetID) + if t > rID { + rID = t + } + } + rID++ content.Sheets.Sheet = append(content.Sheets.Sheet, xlsxSheet{ Name: trimSheetName(name), - SheetID: strconv.Itoa(rid), + SheetID: strconv.Itoa(rID), ID: "rId" + strconv.Itoa(rid), }) } -- cgit v1.2.1 From a885bb0fb92dd7a55f27f0fd57d174121db79b0f Mon Sep 17 00:00:00 2001 From: Alex Whitney Date: Wed, 25 Jul 2018 10:40:08 -0400 Subject: Add failing unit tests for issue-252 --- styles_test.go | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 styles_test.go diff --git a/styles_test.go b/styles_test.go new file mode 100644 index 0000000..7a7e228 --- /dev/null +++ b/styles_test.go @@ -0,0 +1,134 @@ +package excelize + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestSetConditionalFormat(t *testing.T) { + cases := []struct { + label string + format string + rules []*xlsxCfRule + }{{ + label: "3_color_scale", + format: `[{ + "type":"3_color_scale", + "criteria":"=", + "min_type":"num", + "mid_type":"num", + "max_type":"num", + "min_value": "-10", + "mid_value": "0", + "max_value": "10", + "min_color":"ff0000", + "mid_color":"00ff00", + "max_color":"0000ff" + }]`, + rules: []*xlsxCfRule{{ + Priority: 1, + Type: "colorScale", + ColorScale: &xlsxColorScale{ + Cfvo: []*xlsxCfvo{{ + Type: "num", + Val: -10, + }, { + Type: "num", + Val: 0, + }, { + Type: "num", + Val: 10, + }}, + Color: []*xlsxColor{{ + RGB: "FFFF0000", + }, { + RGB: "FF00FF00", + }, { + RGB: "FF0000FF", + }}, + }, + }}, + }, { + label: "3_color_scale default min/mid/max", + format: `[{ + "type":"3_color_scale", + "criteria":"=", + "min_type":"num", + "mid_type":"num", + "max_type":"num", + "min_color":"ff0000", + "mid_color":"00ff00", + "max_color":"0000ff" + }]`, + rules: []*xlsxCfRule{{ + Priority: 1, + Type: "colorScale", + ColorScale: &xlsxColorScale{ + Cfvo: []*xlsxCfvo{{ + Type: "num", + Val: 0, + }, { + Type: "num", + Val: 50, + }, { + Type: "num", + Val: 0, + }}, + Color: []*xlsxColor{{ + RGB: "FFFF0000", + }, { + RGB: "FF00FF00", + }, { + RGB: "FF0000FF", + }}, + }, + }}, + }, { + label: "2_color_scale default min/max", + format: `[{ + "type":"2_color_scale", + "criteria":"=", + "min_type":"num", + "max_type":"num", + "min_color":"ff0000", + "max_color":"0000ff" + }]`, + rules: []*xlsxCfRule{{ + Priority: 1, + Type: "colorScale", + ColorScale: &xlsxColorScale{ + Cfvo: []*xlsxCfvo{{ + Type: "num", + Val: 0, + }, { + Type: "num", + Val: 0, + }}, + Color: []*xlsxColor{{ + RGB: "FFFF0000", + }, { + RGB: "FF0000FF", + }}, + }, + }}, + }} + + for _, testCase := range cases { + xl := NewFile() + const sheet = "Sheet1" + const cellRange = "A1:A1" + + err := xl.SetConditionalFormat(sheet, cellRange, testCase.format) + if err != nil { + t.Fatalf("%s", err) + } + + xlsx := xl.workSheetReader(sheet) + cf := xlsx.ConditionalFormatting + assert.Len(t, cf, 1, testCase.label) + assert.Len(t, cf[0].CfRule, 1, testCase.label) + assert.Equal(t, cellRange, cf[0].SQRef, testCase.label) + assert.EqualValues(t, testCase.rules, cf[0].CfRule, testCase.label) + } +} -- cgit v1.2.1 From db7a605cf8384f86dd3d3f766050a201b5f10eec Mon Sep 17 00:00:00 2001 From: Alex Whitney Date: Tue, 24 Jul 2018 16:12:26 -0400 Subject: Use min/mid/max value for 2 and 3 color scale conditional formatting --- styles.go | 19 ++++++++++++++++--- styles_test.go | 16 ++++++++-------- xmlWorksheet.go | 2 +- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/styles.go b/styles.go index 251e335..fdbf932 100644 --- a/styles.go +++ b/styles.go @@ -2674,12 +2674,25 @@ func drawCondFmtDuplicateUniqueValues(p int, ct string, format *formatConditiona // for color scale (include 2 color scale and 3 color scale) by given priority, // criteria type and format settings. func drawCondFmtColorScale(p int, ct string, format *formatConditional) *xlsxCfRule { + minValue := format.MinValue + if minValue == "" { + minValue = "0" + } + maxValue := format.MaxValue + if maxValue == "" { + maxValue = "0" + } + midValue := format.MidValue + if midValue == "" { + midValue = "50" + } + c := &xlsxCfRule{ Priority: p + 1, Type: "colorScale", ColorScale: &xlsxColorScale{ Cfvo: []*xlsxCfvo{ - {Type: format.MinType}, + {Type: format.MinType, Val: minValue}, }, Color: []*xlsxColor{ {RGB: getPaletteColor(format.MinColor)}, @@ -2687,10 +2700,10 @@ func drawCondFmtColorScale(p int, ct string, format *formatConditional) *xlsxCfR }, } if validType[format.Type] == "3_color_scale" { - c.ColorScale.Cfvo = append(c.ColorScale.Cfvo, &xlsxCfvo{Type: format.MidType, Val: 50}) + c.ColorScale.Cfvo = append(c.ColorScale.Cfvo, &xlsxCfvo{Type: format.MidType, Val: midValue}) c.ColorScale.Color = append(c.ColorScale.Color, &xlsxColor{RGB: getPaletteColor(format.MidColor)}) } - c.ColorScale.Cfvo = append(c.ColorScale.Cfvo, &xlsxCfvo{Type: format.MaxType}) + c.ColorScale.Cfvo = append(c.ColorScale.Cfvo, &xlsxCfvo{Type: format.MaxType, Val: maxValue}) c.ColorScale.Color = append(c.ColorScale.Color, &xlsxColor{RGB: getPaletteColor(format.MaxColor)}) return c } diff --git a/styles_test.go b/styles_test.go index 7a7e228..baa66f0 100644 --- a/styles_test.go +++ b/styles_test.go @@ -32,13 +32,13 @@ func TestSetConditionalFormat(t *testing.T) { ColorScale: &xlsxColorScale{ Cfvo: []*xlsxCfvo{{ Type: "num", - Val: -10, + Val: "-10", }, { Type: "num", - Val: 0, + Val: "0", }, { Type: "num", - Val: 10, + Val: "10", }}, Color: []*xlsxColor{{ RGB: "FFFF0000", @@ -67,13 +67,13 @@ func TestSetConditionalFormat(t *testing.T) { ColorScale: &xlsxColorScale{ Cfvo: []*xlsxCfvo{{ Type: "num", - Val: 0, + Val: "0", }, { Type: "num", - Val: 50, + Val: "50", }, { Type: "num", - Val: 0, + Val: "0", }}, Color: []*xlsxColor{{ RGB: "FFFF0000", @@ -100,10 +100,10 @@ func TestSetConditionalFormat(t *testing.T) { ColorScale: &xlsxColorScale{ Cfvo: []*xlsxCfvo{{ Type: "num", - Val: 0, + Val: "0", }, { Type: "num", - Val: 0, + Val: "0", }}, Color: []*xlsxColor{{ RGB: "FFFF0000", diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 37c0d18..87d66a1 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -446,7 +446,7 @@ type xlsxIconSet struct { type xlsxCfvo struct { Gte bool `xml:"gte,attr,omitempty"` Type string `xml:"type,attr,omitempty"` - Val int `xml:"val,attr"` + Val string `xml:"val,attr"` ExtLst *xlsxExtLst `xml:"extLst"` } -- cgit v1.2.1 From b11b95a69a1df3da6b53c7d2955cb13403e805f1 Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 27 Jul 2018 10:11:13 +0800 Subject: Update issue templates Issue templates have been added. --- .github/ISSUE_TEMPLATE/bug_report.md | 44 +++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 44 +++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..a8c31a0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,44 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + + + +**Description** + + + +**Steps to reproduce the issue:** +1. +2. +3. + +**Describe the results you received:** + +**Describe the results you expected:** + +**Output of `go version`:** + +```text +(paste your output here) +``` + +**Excelize version or commit ID:** + +```text +(paste here) +``` + +**Environment details (OS, Microsoft Excel™ version, physical, etc.):** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..1737cd4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,44 @@ +--- +name: Feature request +about: Suggest an idea for this project + +--- + + + +**Description** + + + +**Steps to reproduce the issue:** +1. +2. +3. + +**Describe the results you received:** + +**Describe the results you expected:** + +**Output of `go version`:** + +```text +(paste your output here) +``` + +**Excelize version or commit ID:** + +```text +(paste here) +``` + +**Environment details (OS, Microsoft Excel™ version, physical, etc.):** -- cgit v1.2.1 From df6b0d9ff42e9c216b2bf7a30d36bd0c09def317 Mon Sep 17 00:00:00 2001 From: xuri Date: Sun, 29 Jul 2018 14:00:21 +0800 Subject: Create PULL_REQUEST_TEMPLATE.md --- PULL_REQUEST_TEMPLATE.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 PULL_REQUEST_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..d2ac755 --- /dev/null +++ b/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,45 @@ +# PR Details + + + +## Description + + + +## Related Issue + + + + + + +## Motivation and Context + + + +## How Has This Been Tested + + + + + +## Types of changes + + + +- [ ] Docs change / refactoring / dependency upgrade +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist + + + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I have read the **CONTRIBUTING** document. +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. -- cgit v1.2.1 From efe3219af0c9f8c8248bb5c6ac51e4c7a900396b Mon Sep 17 00:00:00 2001 From: xuri Date: Mon, 30 Jul 2018 10:06:22 +0800 Subject: Delete ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 5d7e931..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,38 +0,0 @@ - - -**Description** - - - -**Steps to reproduce the issue:** -1. -2. -3. - -**Describe the results you received:** - -**Describe the results you expected:** - -**Output of `go version`:** - -```text -(paste your output here) -``` - -**Excelize version or commit ID:** - -```text -(paste here) -``` - -**Environment details (OS, Microsoft Excel™ version, physical, etc.):** -- cgit v1.2.1 From 054885219000f5c94c59fdf989e7c2110a023164 Mon Sep 17 00:00:00 2001 From: rentiansheng Date: Mon, 30 Jul 2018 22:09:41 +0800 Subject: data validation funcation --- datavalidation.go | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ xmlWorksheet.go | 26 ++++++-- 2 files changed, 217 insertions(+), 5 deletions(-) create mode 100644 datavalidation.go diff --git a/datavalidation.go b/datavalidation.go new file mode 100644 index 0000000..5dae7c9 --- /dev/null +++ b/datavalidation.go @@ -0,0 +1,196 @@ +package excelize + +import ( + "fmt" + "strings" +) + +type DataValidationType int + +// Data validation types +const ( + _DataValidationType = iota + typeNone //inline use + DataValidationTypeCustom + DataValidationTypeDate + DataValidationTypeDecimal + typeList //inline use + DataValidationTypeTextLeng + DataValidationTypeTime + // DataValidationTypeWhole Integer + DataValidationTypeWhole +) + +const ( + // dataValidationFormulaStrLen 255 characters+ 2 quotes + dataValidationFormulaStrLen = 257 + // dataValidationFormulaStrLenErr + dataValidationFormulaStrLenErr = "data validation must be 0-255 characters" +) + +type DataValidationErrorStyle int + +// Data validation error styles +const ( + _ DataValidationErrorStyle = iota + DataValidationStyleStop + DataValidationStyleWarning + DataValidationStyleInformation +) + +// Data validation error styles +const ( + styleStop = "stop" + styleWarning = "warning" + styleInformation = "information" +) + +// DataValidationOperator operator enum +type DataValidationOperator int + +// Data validation operators +const ( + _DataValidationOperator = iota + DataValidationOperatorBetween + DataValidationOperatorEqual + DataValidationOperatorGreaterThan + DataValidationOperatorGreaterThanOrEqual + DataValidationOperatorLessThan + DataValidationOperatorLessThanOrEqual + DataValidationOperatorNotBetween + DataValidationOperatorNotEqual +) + +// NewDataValidation return data validation struct +func NewDataValidation(allowBlank bool) *DataValidation { + return &DataValidation{ + AllowBlank: convBoolToStr(allowBlank), + ShowErrorMessage: convBoolToStr(false), + ShowInputMessage: convBoolToStr(false), + } +} + +// SetError set error notice +func (dd *DataValidation) SetError(style DataValidationErrorStyle, title, msg *string) { + dd.Error = msg + dd.ErrorTitle = title + strStyle := styleStop + switch style { + case DataValidationStyleStop: + strStyle = styleStop + case DataValidationStyleWarning: + strStyle = styleWarning + case DataValidationStyleInformation: + strStyle = styleInformation + + } + dd.ShowErrorMessage = convBoolToStr(true) + dd.ErrorStyle = &strStyle +} + +// SetInput set prompt notice +func (dd *DataValidation) SetInput(title, msg *string) { + dd.ShowInputMessage = convBoolToStr(true) + dd.PromptTitle = title + dd.Prompt = msg +} + +// SetDropList data validation list +func (dd *DataValidation) SetDropList(keys []string) error { + dd.Formula1 = "\"" + strings.Join(keys, ",") + "\"" + dd.Type = convDataValidationType(typeList) + return nil +} + +// SetDropList data validation range +func (dd *DataValidation) SetRange(f1, f2 int, t DataValidationType, o DataValidationOperator) error { + formula1 := fmt.Sprintf("%d", f1) + formula2 := fmt.Sprintf("%d", f2) + if dataValidationFormulaStrLen < len(dd.Formula1) || dataValidationFormulaStrLen < len(dd.Formula2) { + return fmt.Errorf(dataValidationFormulaStrLenErr) + } + switch o { + case DataValidationOperatorBetween: + if f1 > f2 { + tmp := formula1 + formula1 = formula2 + formula2 = tmp + } + case DataValidationOperatorNotBetween: + if f1 > f2 { + tmp := formula1 + formula1 = formula2 + formula2 = tmp + } + } + + dd.Formula1 = formula1 + dd.Formula2 = formula2 + dd.Type = convDataValidationType(t) + dd.Operator = convDataValidationOperatior(o) + return nil +} + +// SetDropList data validation range +func (dd *DataValidation) SetSqref(sqref string) { + if dd.Sqref == "" { + dd.Sqref = sqref + } else { + dd.Sqref = fmt.Sprintf("%s %s", dd.Sqref, sqref) + } +} + +// convBoolToStr convert boolean to string , false to 0, true to 1 +func convBoolToStr(bl bool) string { + if bl { + return "1" + } + return "0" +} + +// convDataValidationType get excel data validation type +func convDataValidationType(t DataValidationType) string { + typeMap := map[DataValidationType]string{ + typeNone: "none", + DataValidationTypeCustom: "custom", + DataValidationTypeDate: "date", + DataValidationTypeDecimal: "decimal", + typeList: "list", + DataValidationTypeTextLeng: "textLength", + DataValidationTypeTime: "time", + DataValidationTypeWhole: "whole", + } + + return typeMap[t] + +} + +// convDataValidationOperatior get excel data validation operator +func convDataValidationOperatior(o DataValidationOperator) string { + typeMap := map[DataValidationOperator]string{ + DataValidationOperatorBetween: "between", + DataValidationOperatorEqual: "equal", + DataValidationOperatorGreaterThan: "greaterThan", + DataValidationOperatorGreaterThanOrEqual: "greaterThanOrEqual", + DataValidationOperatorLessThan: "lessThan", + DataValidationOperatorLessThanOrEqual: "lessThanOrEqual", + DataValidationOperatorNotBetween: "notBetween", + DataValidationOperatorNotEqual: "notEqual", + } + + return typeMap[o] + +} + +func (f *File) AddDataValidation(sheet string, dv *DataValidation) { + xlsx := f.workSheetReader(sheet) + if nil == xlsx.DataValidations { + xlsx.DataValidations = new(xlsxDataValidations) + } + xlsx.DataValidations.DataValidation = append(xlsx.DataValidations.DataValidation, dv) + xlsx.DataValidations.Count = len(xlsx.DataValidations.DataValidation) +} + +func (f *File) GetDataValidation(sheet, sqref string) { + +} diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 87d66a1..f2ac9fb 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -294,11 +294,27 @@ type xlsxMergeCells struct { // xlsxDataValidations expresses all data validation information for cells in a // sheet which have data validation features applied. type xlsxDataValidations struct { - Count int `xml:"count,attr,omitempty"` - DisablePrompts bool `xml:"disablePrompts,attr,omitempty"` - XWindow int `xml:"xWindow,attr,omitempty"` - YWindow int `xml:"yWindow,attr,omitempty"` - DataValidation string `xml:",innerxml"` + Count int `xml:"count,attr,omitempty"` + DisablePrompts bool `xml:"disablePrompts,attr,omitempty"` + XWindow int `xml:"xWindow,attr,omitempty"` + YWindow int `xml:"yWindow,attr,omitempty"` + DataValidation []*DataValidation `xml:"dataValidation,innerxml"` +} + +type DataValidation struct { + AllowBlank string `xml:"allowBlank,attr"` // allow empty + ShowInputMessage string `xml:"showInputMessage,attr"` // 1, true,0,false, select cell, Whether the input message is displayed + ShowErrorMessage string `xml:"showErrorMessage,attr"` // 1, true,0,false, input error value, Whether the error message is displayed + ErrorStyle *string `xml:"errorStyle,attr"` //error icon style, warning, infomation,stop + ErrorTitle *string `xml:"errorTitle,attr"` // error title + Operator string `xml:"operator,attr"` // + Error *string `xml:"error,attr"` // input error value, notice message + PromptTitle *string `xml:"promptTitle"` + Prompt *string `xml:"prompt,attr"` + Type string `xml:"type,attr"` //data type, none,custom,date,decimal,list, textLength,time,whole + Sqref string `xml:"sqref,attr"` //Validity of data validation rules, cell and range, eg: A1 OR A1:A20 + Formula1 string `xml:"formula1"` // data validation role + Formula2 string `xml:"formula2"` //data validation role } // xlsxC directly maps the c element in the namespace -- cgit v1.2.1 From ec37b114c3b704a84c66fcf3e135c9df88ffb24d Mon Sep 17 00:00:00 2001 From: xuri Date: Mon, 6 Aug 2018 10:21:24 +0800 Subject: Fixes #256 and format document. --- cell.go | 64 ++++++++++++------------- chart.go | 82 ++++++++++++++++---------------- col.go | 28 +++++------ comment.go | 18 +++---- date.go | 26 +++++------ excelize.go | 34 +++++++------- file.go | 10 ++-- lib.go | 21 +++++---- picture.go | 57 +++++++++++----------- rows.go | 39 ++++++++-------- shape.go | 10 ++-- sheet.go | 54 ++++++++++----------- sheetpr.go | 4 +- styles.go | 153 +++++++++++++++++++++++++++++++----------------------------- table.go | 29 ++++++------ 15 files changed, 320 insertions(+), 309 deletions(-) diff --git a/cell.go b/cell.go index eb265cc..5ec5976 100644 --- a/cell.go +++ b/cell.go @@ -20,7 +20,7 @@ const ( STCellFormulaTypeShared = "shared" ) -// mergeCellsParser provides function to check merged cells in worksheet by +// mergeCellsParser provides a function to check merged cells in worksheet by // given axis. func (f *File) mergeCellsParser(xlsx *xlsxWorksheet, axis string) string { axis = strings.ToUpper(axis) @@ -34,8 +34,8 @@ func (f *File) mergeCellsParser(xlsx *xlsxWorksheet, axis string) string { return axis } -// SetCellValue provides function to set value of a cell. The following shows -// the supported data types: +// SetCellValue provides a function to set value of a cell. The following +// shows the supported data types: // // int // int8 @@ -83,7 +83,7 @@ func (f *File) SetCellValue(sheet, axis string, value interface{}) { } } -// setCellIntValue provides function to set int value of a cell. +// setCellIntValue provides a function to set int value of a cell. func (f *File) setCellIntValue(sheet, axis string, value interface{}) { switch value.(type) { case int: @@ -111,7 +111,7 @@ func (f *File) setCellIntValue(sheet, axis string, value interface{}) { } } -// SetCellBool provides function to set bool type value of a cell by given +// SetCellBool provides a function to set bool type value of a cell by given // worksheet name, cell coordinates and cell value. func (f *File) SetCellBool(sheet, axis string, value bool) { xlsx := f.workSheetReader(sheet) @@ -139,10 +139,10 @@ func (f *File) SetCellBool(sheet, axis string, value bool) { } } -// GetCellValue provides function to get formatted value from cell by given -// worksheet name and axis in XLSX file. If it is possible to apply a format to -// the cell value, it will do so, if not then an error will be returned, along -// with the raw value of the cell. +// GetCellValue provides a function to get formatted value from cell by given +// worksheet name and axis in XLSX file. If it is possible to apply a format +// to the cell value, it will do so, if not then an error will be returned, +// along with the raw value of the cell. func (f *File) GetCellValue(sheet, axis string) string { xlsx := f.workSheetReader(sheet) axis = f.mergeCellsParser(xlsx, axis) @@ -174,9 +174,9 @@ func (f *File) GetCellValue(sheet, axis string) string { return "" } -// formattedValue provides function to returns a value after formatted. If it is -// possible to apply a format to the cell value, it will do so, if not then an -// error will be returned, along with the raw value of the cell. +// formattedValue provides a function to returns a value after formatted. If +// it is possible to apply a format to the cell value, it will do so, if not +// then an error will be returned, along with the raw value of the cell. func (f *File) formattedValue(s int, v string) string { if s == 0 { return v @@ -189,7 +189,7 @@ func (f *File) formattedValue(s int, v string) string { return v } -// GetCellStyle provides function to get cell style index by given worksheet +// GetCellStyle provides a function to get cell style index by given worksheet // name and cell coordinates. func (f *File) GetCellStyle(sheet, axis string) int { xlsx := f.workSheetReader(sheet) @@ -211,8 +211,8 @@ func (f *File) GetCellStyle(sheet, axis string) int { return f.prepareCellStyle(xlsx, cell, xlsx.SheetData.Row[xAxis].C[yAxis].S) } -// GetCellFormula provides function to get formula from cell by given worksheet -// name and axis in XLSX file. +// GetCellFormula provides a function to get formula from cell by given +// worksheet name and axis in XLSX file. func (f *File) GetCellFormula(sheet, axis string) string { xlsx := f.workSheetReader(sheet) axis = f.mergeCellsParser(xlsx, axis) @@ -276,7 +276,7 @@ func getSharedForumula(xlsx *xlsxWorksheet, si string) string { return "" } -// SetCellFormula provides function to set cell formula by given string and +// SetCellFormula provides a function to set cell formula by given string and // worksheet name. func (f *File) SetCellFormula(sheet, axis, formula string) { xlsx := f.workSheetReader(sheet) @@ -305,10 +305,10 @@ func (f *File) SetCellFormula(sheet, axis, formula string) { } } -// SetCellHyperLink provides function to set cell hyperlink by given worksheet -// name and link URL address. LinkType defines two types of hyperlink "External" -// for web site or "Location" for moving to one of cell in this workbook. The -// below is example for external link. +// SetCellHyperLink provides a function to set cell hyperlink by given +// worksheet name and link URL address. LinkType defines two types of +// hyperlink "External" for web site or "Location" for moving to one of cell +// in this workbook. The below is example for external link. // // xlsx.SetCellHyperLink("Sheet1", "A3", "https://github.com/360EntSecGroup-Skylar/excelize", "External") // // Set underline and font color style for the cell. @@ -341,10 +341,10 @@ func (f *File) SetCellHyperLink(sheet, axis, link, linkType string) { xlsx.Hyperlinks.Hyperlink = append(xlsx.Hyperlinks.Hyperlink, hyperlink) } -// GetCellHyperLink provides function to get cell hyperlink by given worksheet -// name and axis. Boolean type value link will be ture if the cell has a -// hyperlink and the target is the address of the hyperlink. Otherwise, the -// value of link will be false and the value of the target will be a blank +// GetCellHyperLink provides a function to get cell hyperlink by given +// worksheet name and axis. Boolean type value link will be ture if the cell +// has a hyperlink and the target is the address of the hyperlink. Otherwise, +// the value of link will be false and the value of the target will be a blank // string. For example get hyperlink of Sheet1!H6: // // link, target := xlsx.GetCellHyperLink("Sheet1", "H6") @@ -369,8 +369,8 @@ func (f *File) GetCellHyperLink(sheet, axis string) (bool, string) { return link, target } -// MergeCell provides function to merge cells by given coordinate area and sheet -// name. For example create a merged cell of D3:E9 on Sheet1: +// MergeCell provides a function to merge cells by given coordinate area and +// sheet name. For example create a merged cell of D3:E9 on Sheet1: // // xlsx.MergeCell("Sheet1", "D3", "E9") // @@ -429,7 +429,7 @@ func (f *File) MergeCell(sheet, hcell, vcell string) { } } -// SetCellInt provides function to set int type value of a cell by given +// SetCellInt provides a function to set int type value of a cell by given // worksheet name, cell coordinates and cell value. func (f *File) SetCellInt(sheet, axis string, value int) { xlsx := f.workSheetReader(sheet) @@ -453,7 +453,7 @@ func (f *File) SetCellInt(sheet, axis string, value int) { xlsx.SheetData.Row[xAxis].C[yAxis].V = strconv.Itoa(value) } -// prepareCellStyle provides function to prepare style index of cell in +// prepareCellStyle provides a function to prepare style index of cell in // worksheet by given column index and style index. func (f *File) prepareCellStyle(xlsx *xlsxWorksheet, col, style int) int { if xlsx.Cols != nil && style == 0 { @@ -466,8 +466,8 @@ func (f *File) prepareCellStyle(xlsx *xlsxWorksheet, col, style int) int { return style } -// SetCellStr provides function to set string type value of a cell. Total number -// of characters that a cell can contain 32767 characters. +// SetCellStr provides a function to set string type value of a cell. Total +// number of characters that a cell can contain 32767 characters. func (f *File) SetCellStr(sheet, axis, value string) { xlsx := f.workSheetReader(sheet) axis = f.mergeCellsParser(xlsx, axis) @@ -502,7 +502,7 @@ func (f *File) SetCellStr(sheet, axis, value string) { xlsx.SheetData.Row[xAxis].C[yAxis].V = value } -// SetCellDefault provides function to set string type value of a cell as +// SetCellDefault provides a function to set string type value of a cell as // default format without escaping the cell. func (f *File) SetCellDefault(sheet, axis, value string) { xlsx := f.workSheetReader(sheet) @@ -567,7 +567,7 @@ func (f *File) SetSheetRow(sheet, axis string, slice interface{}) { } } -// checkCellInArea provides function to determine if a given coordinate is +// checkCellInArea provides a function to determine if a given coordinate is // within an area. func checkCellInArea(cell, area string) bool { cell = strings.ToUpper(cell) diff --git a/chart.go b/chart.go index 41354f1..8e1d7e9 100644 --- a/chart.go +++ b/chart.go @@ -190,7 +190,7 @@ var ( } ) -// parseFormatChartSet provides function to parse the format settings of the +// parseFormatChartSet provides a function to parse the format settings of the // chart with default value. func parseFormatChartSet(formatSet string) (*formatChart, error) { format := formatChart{ @@ -379,7 +379,7 @@ func (f *File) AddChart(sheet, cell, format string) error { return err } -// countCharts provides function to get chart files count storage in the +// countCharts provides a function to get chart files count storage in the // folder xl/charts. func (f *File) countCharts() int { count := 0 @@ -391,7 +391,7 @@ func (f *File) countCharts() int { return count } -// prepareDrawing provides function to prepare drawing ID and XML by given +// prepareDrawing provides a function to prepare drawing ID and XML by given // drawingID, worksheet name and default drawingXML. func (f *File) prepareDrawing(xlsx *xlsxWorksheet, drawingID int, sheet, drawingXML string) (int, string) { sheetRelationshipsDrawingXML := "../drawings/drawing" + strconv.Itoa(drawingID) + ".xml" @@ -408,8 +408,8 @@ func (f *File) prepareDrawing(xlsx *xlsxWorksheet, drawingID int, sheet, drawing return drawingID, drawingXML } -// addChart provides function to create chart as xl/charts/chart%d.xml by given -// format sets. +// addChart provides a function to create chart as xl/charts/chart%d.xml by +// given format sets. func (f *File) addChart(formatSet *formatChart) { count := f.countCharts() xlsxChartSpace := xlsxChartSpace{ @@ -564,7 +564,7 @@ func (f *File) addChart(formatSet *formatChart) { f.saveFileList(media, chart) } -// drawBaseChart provides function to draw the c:plotArea element for bar, +// drawBaseChart provides a function to draw the c:plotArea element for bar, // and column series charts by given format sets. func (f *File) drawBaseChart(formatSet *formatChart) *cPlotArea { c := cCharts{ @@ -661,7 +661,7 @@ func (f *File) drawBaseChart(formatSet *formatChart) *cPlotArea { return charts[formatSet.Type] } -// drawDoughnutChart provides function to draw the c:plotArea element for +// drawDoughnutChart provides a function to draw the c:plotArea element for // doughnut chart by given format sets. func (f *File) drawDoughnutChart(formatSet *formatChart) *cPlotArea { return &cPlotArea{ @@ -675,8 +675,8 @@ func (f *File) drawDoughnutChart(formatSet *formatChart) *cPlotArea { } } -// drawLineChart provides function to draw the c:plotArea element for line chart -// by given format sets. +// drawLineChart provides a function to draw the c:plotArea element for line +// chart by given format sets. func (f *File) drawLineChart(formatSet *formatChart) *cPlotArea { return &cPlotArea{ LineChart: &cCharts{ @@ -701,8 +701,8 @@ func (f *File) drawLineChart(formatSet *formatChart) *cPlotArea { } } -// drawPieChart provides function to draw the c:plotArea element for pie chart -// by given format sets. +// drawPieChart provides a function to draw the c:plotArea element for pie +// chart by given format sets. func (f *File) drawPieChart(formatSet *formatChart) *cPlotArea { return &cPlotArea{ PieChart: &cCharts{ @@ -714,8 +714,8 @@ func (f *File) drawPieChart(formatSet *formatChart) *cPlotArea { } } -// drawPie3DChart provides function to draw the c:plotArea element for 3D pie -// chart by given format sets. +// drawPie3DChart provides a function to draw the c:plotArea element for 3D +// pie chart by given format sets. func (f *File) drawPie3DChart(formatSet *formatChart) *cPlotArea { return &cPlotArea{ Pie3DChart: &cCharts{ @@ -727,7 +727,7 @@ func (f *File) drawPie3DChart(formatSet *formatChart) *cPlotArea { } } -// drawRadarChart provides function to draw the c:plotArea element for radar +// drawRadarChart provides a function to draw the c:plotArea element for radar // chart by given format sets. func (f *File) drawRadarChart(formatSet *formatChart) *cPlotArea { return &cPlotArea{ @@ -750,8 +750,8 @@ func (f *File) drawRadarChart(formatSet *formatChart) *cPlotArea { } } -// drawScatterChart provides function to draw the c:plotArea element for scatter -// chart by given format sets. +// drawScatterChart provides a function to draw the c:plotArea element for +// scatter chart by given format sets. func (f *File) drawScatterChart(formatSet *formatChart) *cPlotArea { return &cPlotArea{ ScatterChart: &cCharts{ @@ -773,8 +773,8 @@ func (f *File) drawScatterChart(formatSet *formatChart) *cPlotArea { } } -// drawChartSeries provides function to draw the c:ser element by given format -// sets. +// drawChartSeries provides a function to draw the c:ser element by given +// format sets. func (f *File) drawChartSeries(formatSet *formatChart) *[]cSer { ser := []cSer{} for k := range formatSet.Series { @@ -799,7 +799,7 @@ func (f *File) drawChartSeries(formatSet *formatChart) *[]cSer { return &ser } -// drawChartSeriesSpPr provides function to draw the c:spPr element by given +// drawChartSeriesSpPr provides a function to draw the c:spPr element by given // format sets. func (f *File) drawChartSeriesSpPr(i int, formatSet *formatChart) *cSpPr { spPrScatter := &cSpPr{ @@ -821,8 +821,8 @@ func (f *File) drawChartSeriesSpPr(i int, formatSet *formatChart) *cSpPr { return chartSeriesSpPr[formatSet.Type] } -// drawChartSeriesDPt provides function to draw the c:dPt element by given data -// index and format sets. +// drawChartSeriesDPt provides a function to draw the c:dPt element by given +// data index and format sets. func (f *File) drawChartSeriesDPt(i int, formatSet *formatChart) []*cDPt { dpt := []*cDPt{{ IDx: &attrValInt{Val: i}, @@ -850,8 +850,8 @@ func (f *File) drawChartSeriesDPt(i int, formatSet *formatChart) []*cDPt { return chartSeriesDPt[formatSet.Type] } -// drawChartSeriesCat provides function to draw the c:cat element by given chart -// series and format sets. +// drawChartSeriesCat provides a function to draw the c:cat element by given +// chart series and format sets. func (f *File) drawChartSeriesCat(v formatChartSeries, formatSet *formatChart) *cCat { cat := &cCat{ StrRef: &cStrRef{ @@ -862,8 +862,8 @@ func (f *File) drawChartSeriesCat(v formatChartSeries, formatSet *formatChart) * return chartSeriesCat[formatSet.Type] } -// drawChartSeriesVal provides function to draw the c:val element by given chart -// series and format sets. +// drawChartSeriesVal provides a function to draw the c:val element by given +// chart series and format sets. func (f *File) drawChartSeriesVal(v formatChartSeries, formatSet *formatChart) *cVal { val := &cVal{ NumRef: &cNumRef{ @@ -874,8 +874,8 @@ func (f *File) drawChartSeriesVal(v formatChartSeries, formatSet *formatChart) * return chartSeriesVal[formatSet.Type] } -// drawChartSeriesMarker provides function to draw the c:marker element by given -// data index and format sets. +// drawChartSeriesMarker provides a function to draw the c:marker element by +// given data index and format sets. func (f *File) drawChartSeriesMarker(i int, formatSet *formatChart) *cMarker { marker := &cMarker{ Symbol: &attrValString{Val: "circle"}, @@ -900,7 +900,7 @@ func (f *File) drawChartSeriesMarker(i int, formatSet *formatChart) *cMarker { return chartSeriesMarker[formatSet.Type] } -// drawChartSeriesXVal provides function to draw the c:xVal element by given +// drawChartSeriesXVal provides a function to draw the c:xVal element by given // chart series and format sets. func (f *File) drawChartSeriesXVal(v formatChartSeries, formatSet *formatChart) *cCat { cat := &cCat{ @@ -912,7 +912,7 @@ func (f *File) drawChartSeriesXVal(v formatChartSeries, formatSet *formatChart) return chartSeriesXVal[formatSet.Type] } -// drawChartSeriesYVal provides function to draw the c:yVal element by given +// drawChartSeriesYVal provides a function to draw the c:yVal element by given // chart series and format sets. func (f *File) drawChartSeriesYVal(v formatChartSeries, formatSet *formatChart) *cVal { val := &cVal{ @@ -924,8 +924,8 @@ func (f *File) drawChartSeriesYVal(v formatChartSeries, formatSet *formatChart) return chartSeriesYVal[formatSet.Type] } -// drawChartDLbls provides function to draw the c:dLbls element by given format -// sets. +// drawChartDLbls provides a function to draw the c:dLbls element by given +// format sets. func (f *File) drawChartDLbls(formatSet *formatChart) *cDLbls { return &cDLbls{ ShowLegendKey: &attrValBool{Val: formatSet.Legend.ShowLegendKey}, @@ -938,15 +938,15 @@ func (f *File) drawChartDLbls(formatSet *formatChart) *cDLbls { } } -// drawChartSeriesDLbls provides function to draw the c:dLbls element by given -// format sets. +// drawChartSeriesDLbls provides a function to draw the c:dLbls element by +// given format sets. func (f *File) drawChartSeriesDLbls(formatSet *formatChart) *cDLbls { dLbls := f.drawChartDLbls(formatSet) chartSeriesDLbls := map[string]*cDLbls{Bar: dLbls, BarStacked: dLbls, BarPercentStacked: dLbls, Bar3DClustered: dLbls, Bar3DStacked: dLbls, Bar3DPercentStacked: dLbls, Col: dLbls, ColStacked: dLbls, ColPercentStacked: dLbls, Col3DClustered: dLbls, Col3D: dLbls, Col3DStacked: dLbls, Col3DPercentStacked: dLbls, Doughnut: dLbls, Line: dLbls, Pie: dLbls, Pie3D: dLbls, Radar: dLbls, Scatter: nil} return chartSeriesDLbls[formatSet.Type] } -// drawPlotAreaCatAx provides function to draw the c:catAx element. +// drawPlotAreaCatAx provides a function to draw the c:catAx element. func (f *File) drawPlotAreaCatAx(formatSet *formatChart) []*cAxs { min := &attrValFloat{Val: formatSet.XAxis.Minimum} max := &attrValFloat{Val: formatSet.XAxis.Maximum} @@ -985,7 +985,7 @@ func (f *File) drawPlotAreaCatAx(formatSet *formatChart) []*cAxs { } } -// drawPlotAreaValAx provides function to draw the c:valAx element. +// drawPlotAreaValAx provides a function to draw the c:valAx element. func (f *File) drawPlotAreaValAx(formatSet *formatChart) []*cAxs { min := &attrValFloat{Val: formatSet.YAxis.Minimum} max := &attrValFloat{Val: formatSet.YAxis.Maximum} @@ -1021,7 +1021,7 @@ func (f *File) drawPlotAreaValAx(formatSet *formatChart) []*cAxs { } } -// drawPlotAreaSpPr provides function to draw the c:spPr element. +// drawPlotAreaSpPr provides a function to draw the c:spPr element. func (f *File) drawPlotAreaSpPr() *cSpPr { return &cSpPr{ Ln: &aLn{ @@ -1040,7 +1040,7 @@ func (f *File) drawPlotAreaSpPr() *cSpPr { } } -// drawPlotAreaTxPr provides function to draw the c:txPr element. +// drawPlotAreaTxPr provides a function to draw the c:txPr element. func (f *File) drawPlotAreaTxPr() *cTxPr { return &cTxPr{ BodyPr: aBodyPr{ @@ -1079,8 +1079,8 @@ func (f *File) drawPlotAreaTxPr() *cTxPr { } } -// drawingParser provides function to parse drawingXML. In order to solve the -// problem that the label structure is changed after serialization and +// drawingParser provides a function to parse drawingXML. In order to solve +// the problem that the label structure is changed after serialization and // deserialization, two different structures: decodeWsDr and encodeWsDr are // defined. func (f *File) drawingParser(drawingXML string, content *xlsxWsDr) int { @@ -1107,8 +1107,8 @@ func (f *File) drawingParser(drawingXML string, content *xlsxWsDr) int { return cNvPrID } -// addDrawingChart provides function to add chart graphic frame by given sheet, -// drawingXML, cell, width, height, relationship index and format sets. +// addDrawingChart provides a function to add chart graphic frame by given +// sheet, drawingXML, cell, width, height, relationship index and format sets. func (f *File) addDrawingChart(sheet, drawingXML, cell string, width, height, rID int, formatSet *formatPicture) { cell = strings.ToUpper(cell) fromCol := string(strings.Map(letterOnlyMapF, cell)) diff --git a/col.go b/col.go index 05ad0cc..e3870ee 100644 --- a/col.go +++ b/col.go @@ -121,8 +121,8 @@ func (f *File) SetColOutlineLevel(sheet, column string, level uint8) { xlsx.Cols.Col = append(xlsx.Cols.Col, col) } -// SetColWidth provides function to set the width of a single column or multiple -// columns. For example: +// SetColWidth provides a function to set the width of a single column or +// multiple columns. For example: // // xlsx := excelize.NewFile() // xlsx.SetColWidth("Sheet1", "A", "H", 20) @@ -259,8 +259,8 @@ func (f *File) positionObjectPixels(sheet string, colStart, rowStart, x1, y1, wi return colStart, rowStart, xAbs, yAbs, colEnd, rowEnd, x2, y2 } -// getColWidth provides function to get column width in pixels by given sheet -// name and column index. +// getColWidth provides a function to get column width in pixels by given +// sheet name and column index. func (f *File) getColWidth(sheet string, col int) int { xlsx := f.workSheetReader(sheet) if xlsx.Cols != nil { @@ -278,8 +278,8 @@ func (f *File) getColWidth(sheet string, col int) int { return int(defaultColWidthPixels) } -// GetColWidth provides function to get column width by given worksheet name and -// column index. +// GetColWidth provides a function to get column width by given worksheet name +// and column index. func (f *File) GetColWidth(sheet, column string) float64 { col := TitleToNumber(strings.ToUpper(column)) + 1 xlsx := f.workSheetReader(sheet) @@ -298,8 +298,8 @@ func (f *File) GetColWidth(sheet, column string) float64 { return defaultColWidthPixels } -// InsertCol provides function to insert a new column before given column index. -// For example, create a new column before column C in Sheet1: +// InsertCol provides a function to insert a new column before given column +// index. For example, create a new column before column C in Sheet1: // // xlsx.InsertCol("Sheet1", "C") // @@ -308,8 +308,8 @@ func (f *File) InsertCol(sheet, column string) { f.adjustHelper(sheet, col, -1, 1) } -// RemoveCol provides function to remove single column by given worksheet name -// and column index. For example, remove column C in Sheet1: +// RemoveCol provides a function to remove single column by given worksheet +// name and column index. For example, remove column C in Sheet1: // // xlsx.RemoveCol("Sheet1", "C") // @@ -346,10 +346,10 @@ func completeCol(xlsx *xlsxWorksheet, row, cell int) { } } -// convertColWidthToPixels provieds function to convert the width of a cell from -// user's units to pixels. Excel rounds the column width to the nearest pixel. -// If the width hasn't been set by the user we use the default value. If the -// column is hidden it has a value of zero. +// convertColWidthToPixels provieds function to convert the width of a cell +// from user's units to pixels. Excel rounds the column width to the nearest +// pixel. If the width hasn't been set by the user we use the default value. +// If the column is hidden it has a value of zero. func convertColWidthToPixels(width float64) float64 { var padding float64 = 5 var pixels float64 diff --git a/comment.go b/comment.go index ab10310..8bf4fd3 100644 --- a/comment.go +++ b/comment.go @@ -8,8 +8,8 @@ import ( "strings" ) -// parseFormatCommentsSet provides function to parse the format settings of the -// comment with default value. +// parseFormatCommentsSet provides a function to parse the format settings of +// the comment with default value. func parseFormatCommentsSet(formatSet string) (*formatComment, error) { format := formatComment{ Author: "Author:", @@ -19,8 +19,8 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) { return &format, err } -// GetComments retrieves all comments and returns a map -// of worksheet name to the worksheet comments. +// GetComments retrieves 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 { @@ -81,7 +81,7 @@ func (f *File) AddComment(sheet, cell, format string) error { return err } -// addDrawingVML provides function to create comment as +// addDrawingVML provides a function to create comment as // xl/drawings/vmlDrawing%d.vml by given commit ID and cell. func (f *File) addDrawingVML(commentID int, drawingVML, cell string, lineCount, colCount int) { col := string(strings.Map(letterOnlyMapF, cell)) @@ -178,8 +178,8 @@ func (f *File) addDrawingVML(commentID int, drawingVML, cell string, lineCount, f.XLSX[drawingVML] = v } -// addComment provides function to create chart as xl/comments%d.xml by given -// cell and format sets. +// addComment provides a function to create chart as xl/comments%d.xml by +// given cell and format sets. func (f *File) addComment(commentsXML, cell string, formatSet *formatComment) { a := formatSet.Author t := formatSet.Text @@ -238,8 +238,8 @@ func (f *File) addComment(commentsXML, cell string, formatSet *formatComment) { f.saveFileList(commentsXML, v) } -// countComments provides function to get comments files count storage in the -// folder xl. +// countComments provides a function to get comments files count storage in +// the folder xl. func (f *File) countComments() int { count := 0 for k := range f.XLSX { diff --git a/date.go b/date.go index f3db0ee..7233661 100644 --- a/date.go +++ b/date.go @@ -8,12 +8,12 @@ import ( // timeLocationUTC defined the UTC time location. var timeLocationUTC, _ = time.LoadLocation("UTC") -// timeToUTCTime provides function to convert time to UTC time. +// timeToUTCTime provides a function to convert time to UTC time. func timeToUTCTime(t time.Time) time.Time { return time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), timeLocationUTC) } -// timeToExcelTime provides function to convert time to Excel time. +// timeToExcelTime provides a function to convert time to Excel time. func timeToExcelTime(t time.Time) float64 { // TODO in future this should probably also handle date1904 and like TimeFromExcelTime var excelTime float64 @@ -32,7 +32,7 @@ func timeToExcelTime(t time.Time) float64 { return excelTime + float64(t.UnixNano())/8.64e13 + 25569.0 } -// shiftJulianToNoon provides function to process julian date to noon. +// shiftJulianToNoon provides a function to process julian date to noon. func shiftJulianToNoon(julianDays, julianFraction float64) (float64, float64) { switch { case -0.5 < julianFraction && julianFraction < 0.5: @@ -47,7 +47,7 @@ func shiftJulianToNoon(julianDays, julianFraction float64) (float64, float64) { return julianDays, julianFraction } -// fractionOfADay provides function to return the integer values for hour, +// fractionOfADay provides a function to return the integer values for hour, // minutes, seconds and nanoseconds that comprised a given fraction of a day. // values would round to 1 us. func fractionOfADay(fraction float64) (hours, minutes, seconds, nanoseconds int) { @@ -68,7 +68,7 @@ func fractionOfADay(fraction float64) (hours, minutes, seconds, nanoseconds int) return } -// julianDateToGregorianTime provides function to convert julian date to +// julianDateToGregorianTime provides a function to convert julian date to // gregorian time. func julianDateToGregorianTime(part1, part2 float64) time.Time { part1I, part1F := math.Modf(part1) @@ -81,12 +81,12 @@ func julianDateToGregorianTime(part1, part2 float64) time.Time { return time.Date(year, time.Month(month), day, hours, minutes, seconds, nanoseconds, time.UTC) } -// By this point generations of programmers have repeated the algorithm sent to -// the editor of "Communications of the ACM" in 1968 (published in CACM, volume -// 11, number 10, October 1968, p.657). None of those programmers seems to have -// found it necessary to explain the constants or variable names set out by -// Henry F. Fliegel and Thomas C. Van Flandern. Maybe one day I'll buy that -// jounal and expand an explanation here - that day is not today. +// By this point generations of programmers have repeated the algorithm sent +// to the editor of "Communications of the ACM" in 1968 (published in CACM, +// volume 11, number 10, October 1968, p.657). None of those programmers seems +// to have found it necessary to explain the constants or variable names set +// out by Henry F. Fliegel and Thomas C. Van Flandern. Maybe one day I'll buy +// that jounal and expand an explanation here - that day is not today. func doTheFliegelAndVanFlandernAlgorithm(jd int) (day, month, year int) { l := jd + 68569 n := (4 * l) / 146097 @@ -101,8 +101,8 @@ func doTheFliegelAndVanFlandernAlgorithm(jd int) (day, month, year int) { return d, m, y } -// timeFromExcelTime provides function to convert an excelTime representation -// (stored as a floating point number) to a time.Time. +// timeFromExcelTime provides a function to convert an excelTime +// representation (stored as a floating point number) to a time.Time. func timeFromExcelTime(excelTime float64, date1904 bool) time.Time { const MDD int64 = 106750 // Max time.Duration Days, aprox. 290 years var date time.Time diff --git a/excelize.go b/excelize.go index 99243a7..0b530ab 100644 --- a/excelize.go +++ b/excelize.go @@ -71,7 +71,7 @@ func OpenReader(r io.Reader) (*File, error) { return f, nil } -// setDefaultTimeStyle provides function to set default numbers format for +// setDefaultTimeStyle provides a function to set default numbers format for // time.Time type cell value by given worksheet name, cell coordinates and // number format code. func (f *File) setDefaultTimeStyle(sheet, axis string, format int) { @@ -81,8 +81,8 @@ func (f *File) setDefaultTimeStyle(sheet, axis string, format int) { } } -// workSheetReader provides function to get the pointer to the structure after -// deserialization by given worksheet name. +// workSheetReader provides a function to get the pointer to the structure +// after deserialization by given worksheet name. func (f *File) workSheetReader(sheet string) *xlsxWorksheet { name, ok := f.sheetMap[trimSheetName(sheet)] if !ok { @@ -105,7 +105,7 @@ func (f *File) workSheetReader(sheet string) *xlsxWorksheet { return f.Sheet[name] } -// checkSheet provides function to fill each row element and make that is +// checkSheet provides a function to fill each row element and make that is // continuous in a worksheet of XML. func checkSheet(xlsx *xlsxWorksheet) { row := len(xlsx.SheetData.Row) @@ -133,7 +133,7 @@ func checkSheet(xlsx *xlsxWorksheet) { xlsx.SheetData = sheetData } -// replaceWorkSheetsRelationshipsNameSpaceBytes provides function to replace +// replaceWorkSheetsRelationshipsNameSpaceBytes provides a function to replace // xl/worksheets/sheet%d.xml XML tags to self-closing for compatible Microsoft // Office Excel 2007. func replaceWorkSheetsRelationshipsNameSpaceBytes(workbookMarshal []byte) []byte { @@ -182,7 +182,7 @@ func (f *File) UpdateLinkedValue() { } } -// adjustHelper provides function to adjust rows and columns dimensions, +// adjustHelper provides a function to adjust rows and columns dimensions, // hyperlinks, merged cells and auto filter when inserting or deleting rows or // columns. // @@ -204,7 +204,7 @@ func (f *File) adjustHelper(sheet string, column, row, offset int) { checkRow(xlsx) } -// adjustColDimensions provides function to update column dimensions when +// adjustColDimensions provides a function to update column dimensions when // inserting or deleting rows or columns. func (f *File) adjustColDimensions(xlsx *xlsxWorksheet, column, offset int) { for i, r := range xlsx.SheetData.Row { @@ -220,8 +220,8 @@ func (f *File) adjustColDimensions(xlsx *xlsxWorksheet, column, offset int) { } } -// adjustRowDimensions provides function to update row dimensions when inserting -// or deleting rows or columns. +// adjustRowDimensions provides a function to update row dimensions when +// inserting or deleting rows or columns. func (f *File) adjustRowDimensions(xlsx *xlsxWorksheet, rowIndex, offset int) { if rowIndex == -1 { return @@ -240,7 +240,7 @@ func (f *File) adjustRowDimensions(xlsx *xlsxWorksheet, rowIndex, offset int) { } } -// adjustHyperlinks provides function to update hyperlinks when inserting or +// adjustHyperlinks provides a function to update hyperlinks when inserting or // deleting rows or columns. func (f *File) adjustHyperlinks(sheet string, column, rowIndex, offset int) { xlsx := f.workSheetReader(sheet) @@ -280,8 +280,8 @@ func (f *File) adjustHyperlinks(sheet string, column, rowIndex, offset int) { } } -// adjustMergeCellsHelper provides function to update merged cells when inserting or -// deleting rows or columns. +// adjustMergeCellsHelper provides a function to update merged cells when +// inserting or deleting rows or columns. func (f *File) adjustMergeCellsHelper(xlsx *xlsxWorksheet, column, rowIndex, offset int) { if xlsx.MergeCells != nil { for k, v := range xlsx.MergeCells.Cells { @@ -321,8 +321,8 @@ func (f *File) adjustMergeCellsHelper(xlsx *xlsxWorksheet, column, rowIndex, off } } -// adjustMergeCells provides function to update merged cells when inserting or -// deleting rows or columns. +// adjustMergeCells provides a function to update merged cells when inserting +// or deleting rows or columns. func (f *File) adjustMergeCells(xlsx *xlsxWorksheet, column, rowIndex, offset int) { f.adjustMergeCellsHelper(xlsx, column, rowIndex, offset) @@ -342,8 +342,8 @@ func (f *File) adjustMergeCells(xlsx *xlsxWorksheet, column, rowIndex, offset in } } -// adjustAutoFilter provides function to update the auto filter when inserting -// or deleting rows or columns. +// adjustAutoFilter provides a function to update the auto filter when +// inserting or deleting rows or columns. func (f *File) adjustAutoFilter(xlsx *xlsxWorksheet, column, rowIndex, offset int) { f.adjustAutoFilterHelper(xlsx, column, rowIndex, offset) @@ -376,7 +376,7 @@ func (f *File) adjustAutoFilter(xlsx *xlsxWorksheet, column, rowIndex, offset in } } -// adjustAutoFilterHelper provides function to update the auto filter when +// adjustAutoFilterHelper provides a function to update the auto filter when // inserting or deleting rows or columns. func (f *File) adjustAutoFilterHelper(xlsx *xlsxWorksheet, column, rowIndex, offset int) { if xlsx.AutoFilter != nil { diff --git a/file.go b/file.go index 2b1f1e0..a45fc28 100644 --- a/file.go +++ b/file.go @@ -8,7 +8,7 @@ import ( "os" ) -// NewFile provides function to create new file by default template. For +// NewFile provides a function to create new file by default template. For // example: // // xlsx := NewFile() @@ -40,7 +40,7 @@ func NewFile() *File { return f } -// Save provides 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 { if f.Path == "" { return fmt.Errorf("No path defined for file, consider File.WriteTo or File.Write") @@ -48,8 +48,8 @@ func (f *File) Save() error { return f.SaveAs(f.Path) } -// SaveAs provides function to create or update to an xlsx file at the provided -// path. +// SaveAs provides a function to create or update to an xlsx file at the +// provided path. func (f *File) SaveAs(name string) error { file, err := os.OpenFile(name, os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0666) if err != nil { @@ -59,7 +59,7 @@ func (f *File) SaveAs(name string) error { return f.Write(file) } -// Write provides function to write to an io.Writer. +// Write provides a function to write to an io.Writer. func (f *File) Write(w io.Writer) error { _, err := f.WriteTo(w) return err diff --git a/lib.go b/lib.go index e1b0693..8013efa 100644 --- a/lib.go +++ b/lib.go @@ -25,7 +25,7 @@ func ReadZipReader(r *zip.Reader) (map[string][]byte, int, error) { return fileList, worksheets, nil } -// readXML provides function to read XML content as string. +// readXML provides a function to read XML content as string. func (f *File) readXML(name string) []byte { if content, ok := f.XLSX[name]; ok { return content @@ -33,8 +33,8 @@ func (f *File) readXML(name string) []byte { return []byte{} } -// saveFileList provides function to update given file content in file list of -// XLSX. +// saveFileList provides a function to update given file content in file list +// of XLSX. func (f *File) saveFileList(name string, content []byte) { newContent := make([]byte, 0, len(XMLHeader)+len(content)) newContent = append(newContent, []byte(XMLHeader)...) @@ -54,7 +54,7 @@ func readFile(file *zip.File) []byte { return buff.Bytes() } -// ToAlphaString provides function to convert integer to Excel sheet column +// ToAlphaString provides a function to convert integer to Excel sheet column // title. For example convert 36 to column title AK: // // excelize.ToAlphaString(36) @@ -72,9 +72,9 @@ func ToAlphaString(value int) string { return ans } -// TitleToNumber provides function to convert Excel sheet column title to int -// (this function doesn't do value check currently). For example convert AK -// and ak to column title 36: +// TitleToNumber provides a function to convert Excel sheet column title to +// int (this function doesn't do value check currently). For example convert +// AK and ak to column title 36: // // excelize.TitleToNumber("AK") // excelize.TitleToNumber("ak") @@ -125,8 +125,8 @@ func defaultTrue(b *bool) bool { return *b } -// axisLowerOrEqualThan returns true if axis1 <= axis2 -// axis1/axis2 can be either a column or a row axis, e.g. "A", "AAE", "42", "1", etc. +// axisLowerOrEqualThan returns true if axis1 <= axis2 axis1/axis2 can be +// either a column or a row axis, e.g. "A", "AAE", "42", "1", etc. // // For instance, the following comparisons are all true: // @@ -147,7 +147,8 @@ func axisLowerOrEqualThan(axis1, axis2 string) bool { } } -// getCellColRow returns the two parts of a cell identifier (its col and row) as strings +// getCellColRow returns the two parts of a cell identifier (its col and row) +// as strings // // For instance: // diff --git a/picture.go b/picture.go index 04d5062..d039ae0 100644 --- a/picture.go +++ b/picture.go @@ -14,8 +14,8 @@ import ( "strings" ) -// parseFormatPictureSet provides function to parse the format settings of the -// picture with default value. +// parseFormatPictureSet provides a function to parse the format settings of +// the picture with default value. func parseFormatPictureSet(formatSet string) (*formatPicture, error) { format := formatPicture{ FPrintsWithSheet: true, @@ -116,7 +116,7 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error { return err } -// addSheetRelationships provides function to add +// addSheetRelationships provides a function to add // xl/worksheets/_rels/sheet%d.xml.rels by given worksheet name, relationship // type and target. func (f *File) addSheetRelationships(sheet, relType, target, targetMode string) int { @@ -149,9 +149,9 @@ func (f *File) addSheetRelationships(sheet, relType, target, targetMode string) return rID } -// deleteSheetRelationships provides function to delete relationships in -// xl/worksheets/_rels/sheet%d.xml.rels by given worksheet name and relationship -// index. +// deleteSheetRelationships provides a function to delete relationships in +// xl/worksheets/_rels/sheet%d.xml.rels by given worksheet name and +// relationship index. func (f *File) deleteSheetRelationships(sheet, rID string) { name, ok := f.sheetMap[trimSheetName(sheet)] if !ok { @@ -169,7 +169,7 @@ func (f *File) deleteSheetRelationships(sheet, rID string) { f.saveFileList(rels, output) } -// addSheetLegacyDrawing provides function to add legacy drawing element to +// addSheetLegacyDrawing provides a function to add legacy drawing element to // xl/worksheets/sheet%d.xml by given worksheet name and relationship index. func (f *File) addSheetLegacyDrawing(sheet string, rID int) { xlsx := f.workSheetReader(sheet) @@ -178,7 +178,7 @@ func (f *File) addSheetLegacyDrawing(sheet string, rID int) { } } -// addSheetDrawing provides function to add drawing element to +// addSheetDrawing provides a function to add drawing element to // xl/worksheets/sheet%d.xml by given worksheet name and relationship index. func (f *File) addSheetDrawing(sheet string, rID int) { xlsx := f.workSheetReader(sheet) @@ -187,7 +187,7 @@ func (f *File) addSheetDrawing(sheet string, rID int) { } } -// addSheetPicture provides function to add picture element to +// addSheetPicture provides a function to add picture element to // xl/worksheets/sheet%d.xml by given worksheet name and relationship index. func (f *File) addSheetPicture(sheet string, rID int) { xlsx := f.workSheetReader(sheet) @@ -196,7 +196,7 @@ func (f *File) addSheetPicture(sheet string, rID int) { } } -// countDrawings provides function to get drawing files count storage in the +// countDrawings provides a function to get drawing files count storage in the // folder xl/drawings. func (f *File) countDrawings() int { count := 0 @@ -208,7 +208,7 @@ func (f *File) countDrawings() int { return count } -// addDrawingPicture provides function to add picture by given sheet, +// addDrawingPicture provides a function to add picture by given sheet, // drawingXML, cell, file name, width, height relationship index and format // sets. func (f *File) addDrawingPicture(sheet, drawingXML, cell, file string, width, height, rID, hyperlinkRID int, formatSet *formatPicture) { @@ -263,8 +263,8 @@ func (f *File) addDrawingPicture(sheet, drawingXML, cell, file string, width, he f.saveFileList(drawingXML, output) } -// addDrawingRelationships provides function to add image part relationships in -// the file xl/drawings/_rels/drawing%d.xml.rels by given drawing index, +// addDrawingRelationships provides a function to add image part relationships +// in the file xl/drawings/_rels/drawing%d.xml.rels by given drawing index, // relationship type and target. func (f *File) addDrawingRelationships(index int, relType, target, targetMode string) int { var rels = "xl/drawings/_rels/drawing" + strconv.Itoa(index) + ".xml.rels" @@ -292,8 +292,8 @@ func (f *File) addDrawingRelationships(index int, relType, target, targetMode st return rID } -// countMedia provides function to get media files count storage in the folder -// xl/media/image. +// countMedia provides a function to get media files count storage in the +// folder xl/media/image. func (f *File) countMedia() int { count := 0 for k := range f.XLSX { @@ -304,8 +304,8 @@ func (f *File) countMedia() int { return count } -// addMedia provides function to add picture into folder xl/media/image by given -// file name and extension name. +// addMedia provides a function to add picture into folder xl/media/image by +// given file name and extension name. func (f *File) addMedia(file, ext string) { count := f.countMedia() dat, _ := ioutil.ReadFile(file) @@ -313,8 +313,8 @@ func (f *File) addMedia(file, ext string) { f.XLSX[media] = dat } -// setContentTypePartImageExtensions provides function to set the content type -// for relationship parts and the Main Document part. +// setContentTypePartImageExtensions provides a function to set the content +// type for relationship parts and the Main Document part. func (f *File) setContentTypePartImageExtensions() { var imageTypes = map[string]bool{"jpeg": false, "png": false, "gif": false} content := f.contentTypesReader() @@ -334,7 +334,7 @@ func (f *File) setContentTypePartImageExtensions() { } } -// setContentTypePartVMLExtensions provides function to set the content type +// setContentTypePartVMLExtensions provides a function to set the content type // for relationship parts and the Main Document part. func (f *File) setContentTypePartVMLExtensions() { vml := false @@ -352,8 +352,8 @@ func (f *File) setContentTypePartVMLExtensions() { } } -// addContentTypePart provides function to add content type part relationships -// in the file [Content_Types].xml by given index. +// addContentTypePart provides a function to add content type part +// relationships in the file [Content_Types].xml by given index. func (f *File) addContentTypePart(index int, contentType string) { setContentType := map[string]func(){ "comments": f.setContentTypePartVMLExtensions, @@ -387,7 +387,7 @@ func (f *File) addContentTypePart(index int, contentType string) { }) } -// getSheetRelationshipsTargetByID provides function to get Target attribute +// getSheetRelationshipsTargetByID provides a function to get Target attribute // value in xl/worksheets/_rels/sheet%d.xml.rels by given worksheet name and // relationship index. func (f *File) getSheetRelationshipsTargetByID(sheet, rID string) string { @@ -406,9 +406,9 @@ func (f *File) getSheetRelationshipsTargetByID(sheet, rID string) string { return "" } -// GetPicture provides function to get picture base name and raw content embed -// in XLSX by given worksheet and cell name. This function returns the file name -// in XLSX and file contents as []byte data types. For example: +// GetPicture provides a function to get picture base name and raw content +// embed in XLSX by given worksheet and cell name. This function returns the +// file name in XLSX and file contents as []byte data types. For example: // // xlsx, err := excelize.OpenFile("./Book1.xlsx") // if err != nil { @@ -463,8 +463,9 @@ func (f *File) GetPicture(sheet, cell string) (string, []byte) { return "", []byte{} } -// getDrawingRelationships provides function to get drawing relationships from -// xl/drawings/_rels/drawing%s.xml.rels by given file name and relationship ID. +// getDrawingRelationships provides a function to get drawing relationships +// from xl/drawings/_rels/drawing%s.xml.rels by given file name and +// relationship ID. func (f *File) getDrawingRelationships(rels, rID string) *xlsxWorkbookRelation { _, ok := f.XLSX[rels] if !ok { diff --git a/rows.go b/rows.go index ba569ad..521a945 100644 --- a/rows.go +++ b/rows.go @@ -132,7 +132,7 @@ func (err ErrSheetNotExist) Error() string { // Rows return a rows iterator. For example: // -// rows, err := xlsx.GetRows("Sheet1") +// rows, err := xlsx.Rows("Sheet1") // for rows.Next() { // for _, colCell := range rows.Columns() { // fmt.Print(colCell, "\t") @@ -202,7 +202,7 @@ func (f *File) SetRowHeight(sheet string, row int, height float64) { xlsx.SheetData.Row[rowIdx].CustomHeight = true } -// getRowHeight provides function to get row height in pixels by given sheet +// getRowHeight provides a function to get row height in pixels by given sheet // name and row index. func (f *File) getRowHeight(sheet string, row int) int { xlsx := f.workSheetReader(sheet) @@ -215,7 +215,7 @@ func (f *File) getRowHeight(sheet string, row int) int { return int(defaultRowHeightPixels) } -// GetRowHeight provides function to get row height by given worksheet name +// GetRowHeight provides a function to get row height by given worksheet name // and row index. For example, get the height of the first row in Sheet1: // // xlsx.GetRowHeight("Sheet1", 1) @@ -231,7 +231,7 @@ func (f *File) GetRowHeight(sheet string, row int) float64 { return defaultRowHeightPixels } -// sharedStringsReader provides function to get the pointer to the structure +// sharedStringsReader provides a function to get the pointer to the structure // after deserialization of xl/sharedStrings.xml. func (f *File) sharedStringsReader() *xlsxSST { if f.SharedStrings == nil { @@ -246,8 +246,9 @@ func (f *File) sharedStringsReader() *xlsxSST { return f.SharedStrings } -// getValueFrom return a value from a column/row cell, this function is inteded -// to be used with for range on rows an argument with the xlsx opened file. +// getValueFrom return a value from a column/row cell, this function is +// inteded to be used with for range on rows an argument with the xlsx opened +// file. func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) { switch xlsx.T { case "s": @@ -315,9 +316,9 @@ func (f *File) SetRowOutlineLevel(sheet string, rowIndex int, level uint8) { xlsx.SheetData.Row[rowIndex].OutlineLevel = level } -// GetRowOutlineLevel provides a function to get outline level number of a single row by given -// worksheet name and row index. For example, get outline number of row 2 in -// Sheet1: +// GetRowOutlineLevel provides a function to get outline level number of a +// single row by given worksheet name and row index. For example, get outline +// number of row 2 in Sheet1: // // xlsx.GetRowOutlineLevel("Sheet1", 2) // @@ -329,8 +330,8 @@ func (f *File) GetRowOutlineLevel(sheet string, rowIndex int) uint8 { return xlsx.SheetData.Row[rowIndex].OutlineLevel } -// RemoveRow provides function to remove single row by given worksheet name and -// row index. For example, remove row 3 in Sheet1: +// RemoveRow provides a function to remove single row by given worksheet name +// and row index. For example, remove row 3 in Sheet1: // // xlsx.RemoveRow("Sheet1", 2) // @@ -349,8 +350,8 @@ func (f *File) RemoveRow(sheet string, row int) { } } -// InsertRow provides function to insert a new row before given row index. For -// example, create a new row before row 3 in Sheet1: +// InsertRow provides a function to insert a new row before given row index. +// For example, create a new row before row 3 in Sheet1: // // xlsx.InsertRow("Sheet1", 2) // @@ -362,8 +363,8 @@ func (f *File) InsertRow(sheet string, row int) { f.adjustHelper(sheet, -1, row, 1) } -// checkRow provides function to check and fill each column element for all rows -// and make that is continuous in a worksheet of XML. For example: +// checkRow provides a function to check and fill each column element for all +// rows and make that is continuous in a worksheet of XML. For example: // // // @@ -416,7 +417,7 @@ func checkRow(xlsx *xlsxWorksheet) { } } -// completeRow provides function to check and fill each column element for a +// completeRow provides a function to check and fill each column element for a // single row and make that is continuous in a worksheet of XML by given row // index and axis. func completeRow(xlsx *xlsxWorksheet, row, cell int) { @@ -448,9 +449,9 @@ func completeRow(xlsx *xlsxWorksheet, row, cell int) { } } -// convertRowHeightToPixels provides function to convert the height of a cell -// from user's units to pixels. If the height hasn't been set by the user we use -// the default value. If the row is hidden it has a value of zero. +// convertRowHeightToPixels provides a function to convert the height of a +// cell from user's units to pixels. If the height hasn't been set by the user +// we use the default value. If the row is hidden it has a value of zero. func convertRowHeightToPixels(height float64) float64 { var pixels float64 if height == 0 { diff --git a/shape.go b/shape.go index 96cedb4..8fbfbcd 100644 --- a/shape.go +++ b/shape.go @@ -7,7 +7,7 @@ import ( "strings" ) -// parseFormatShapeSet provides function to parse the format settings of the +// parseFormatShapeSet provides a function to parse the format settings of the // shape with default value. func parseFormatShapeSet(formatSet string) (*formatShape, error) { format := formatShape{ @@ -29,8 +29,8 @@ func parseFormatShapeSet(formatSet string) (*formatShape, error) { // AddShape provides the method to add shape in a sheet by given worksheet // index, shape format set (such as offset, scale, aspect ratio setting and -// print settings) and properties set. For example, add text box (rect shape) in -// Sheet1: +// print settings) and properties set. For example, add text box (rect shape) +// in Sheet1: // // xlsx.AddShape("Sheet1", "G6", `{"type":"rect","color":{"line":"#4286F4","fill":"#8eb9ff"},"paragraph":[{"text":"Rectangle Shape","font":{"bold":true,"italic":true,"family":"Berlin Sans FB Demi","size":36,"color":"#777777","underline":"sng"}}],"width":180,"height": 90}`) // @@ -272,7 +272,7 @@ func (f *File) AddShape(sheet, cell, format string) error { return err } -// addDrawingShape provides function to add preset geometry by given sheet, +// addDrawingShape provides a function to add preset geometry by given sheet, // drawingXMLand format sets. func (f *File) addDrawingShape(sheet, drawingXML, cell string, formatSet *formatShape) { textUnderlineType := map[string]bool{"none": true, "words": true, "sng": true, "dbl": true, "heavy": true, "dotted": true, "dottedHeavy": true, "dash": true, "dashHeavy": true, "dashLong": true, "dashLongHeavy": true, "dotDash": true, "dotDashHeavy": true, "dotDotDash": true, "dotDotDashHeavy": true, "wavy": true, "wavyHeavy": true, "wavyDbl": true} @@ -397,7 +397,7 @@ func (f *File) addDrawingShape(sheet, drawingXML, cell string, formatSet *format f.saveFileList(drawingXML, output) } -// setShapeRef provides function to set color with hex model by given actual +// setShapeRef provides a function to set color with hex model by given actual // color value. func setShapeRef(color string, i int) *aRef { if color == "" { diff --git a/sheet.go b/sheet.go index 6029a29..011ecb8 100644 --- a/sheet.go +++ b/sheet.go @@ -14,7 +14,7 @@ import ( "github.com/mohae/deepcopy" ) -// NewSheet provides function to create a new sheet by given worksheet name, +// NewSheet provides a function to create a new sheet by given worksheet name, // when creating a new XLSX file, the default sheet will be create, when you // create a new file. func (f *File) NewSheet(name string) int { @@ -36,7 +36,7 @@ func (f *File) NewSheet(name string) int { return f.SheetCount } -// contentTypesReader provides function to get the pointer to the +// contentTypesReader provides a function to get the pointer to the // [Content_Types].xml structure after deserialization. func (f *File) contentTypesReader() *xlsxTypes { if f.ContentTypes == nil { @@ -47,7 +47,7 @@ func (f *File) contentTypesReader() *xlsxTypes { return f.ContentTypes } -// contentTypesWriter provides function to save [Content_Types].xml after +// contentTypesWriter provides a function to save [Content_Types].xml after // serialize structure. func (f *File) contentTypesWriter() { if f.ContentTypes != nil { @@ -56,7 +56,7 @@ func (f *File) contentTypesWriter() { } } -// workbookReader provides function to get the pointer to the xl/workbook.xml +// workbookReader provides a function to get the pointer to the xl/workbook.xml // structure after deserialization. func (f *File) workbookReader() *xlsxWorkbook { if f.WorkBook == nil { @@ -67,7 +67,7 @@ func (f *File) workbookReader() *xlsxWorkbook { return f.WorkBook } -// workbookWriter provides function to save xl/workbook.xml after serialize +// workbookWriter provides a function to save xl/workbook.xml after serialize // structure. func (f *File) workbookWriter() { if f.WorkBook != nil { @@ -76,7 +76,7 @@ func (f *File) workbookWriter() { } } -// worksheetWriter provides function to save xl/worksheets/sheet%d.xml after +// worksheetWriter provides a function to save xl/worksheets/sheet%d.xml after // serialize structure. func (f *File) worksheetWriter() { for path, sheet := range f.Sheet { @@ -94,7 +94,7 @@ func (f *File) worksheetWriter() { } } -// trimCell provides function to trim blank cells which created by completeCol. +// trimCell provides a function to trim blank cells which created by completeCol. func trimCell(column []xlsxC) []xlsxC { col := make([]xlsxC, len(column)) i := 0 @@ -147,7 +147,7 @@ func (f *File) setWorkbook(name string, rid int) { }) } -// workbookRelsReader provides function to read and unmarshal workbook +// workbookRelsReader provides a function to read and unmarshal workbook // relationships of XLSX file. func (f *File) workbookRelsReader() *xlsxWorkbookRels { if f.WorkBookRels == nil { @@ -158,7 +158,7 @@ func (f *File) workbookRelsReader() *xlsxWorkbookRels { return f.WorkBookRels } -// workbookRelsWriter provides function to save xl/_rels/workbook.xml.rels after +// workbookRelsWriter provides a function to save xl/_rels/workbook.xml.rels after // serialize structure. func (f *File) workbookRelsWriter() { if f.WorkBookRels != nil { @@ -211,7 +211,7 @@ func replaceRelationshipsNameSpaceBytes(workbookMarshal []byte) []byte { return bytes.Replace(workbookMarshal, oldXmlns, newXmlns, -1) } -// SetActiveSheet provides function to set default active worksheet of XLSX by +// SetActiveSheet provides a function to set default active worksheet of XLSX by // given index. Note that active index is different with the index that got by // function GetSheetMap, and it should be greater than 0 and less than total // worksheet numbers. @@ -247,7 +247,7 @@ func (f *File) SetActiveSheet(index int) { } } -// GetActiveSheetIndex provides function to get active sheet of XLSX. If not +// GetActiveSheetIndex provides a function to get active sheet of XLSX. If not // found the active sheet will be return integer 0. func (f *File) GetActiveSheetIndex() int { buffer := bytes.Buffer{} @@ -269,7 +269,7 @@ func (f *File) GetActiveSheetIndex() int { return 0 } -// SetSheetName provides function to set the worksheet name be given old and new +// SetSheetName provides a function to set the worksheet name be given old and new // worksheet name. Maximum 31 characters are allowed in sheet title and this // function only changes the name of the sheet and will not update the sheet // name in the formula or reference associated with the cell. So there may be @@ -287,7 +287,7 @@ func (f *File) SetSheetName(oldName, newName string) { } } -// GetSheetName provides function to get worksheet name of XLSX by given +// GetSheetName provides a function to get worksheet name of XLSX by given // worksheet index. If given sheet index is invalid, will return an empty // string. func (f *File) GetSheetName(index int) string { @@ -306,7 +306,7 @@ func (f *File) GetSheetName(index int) string { return "" } -// GetSheetIndex provides function to get worksheet index of XLSX by given sheet +// GetSheetIndex provides a function to get worksheet index of XLSX by given sheet // name. If given worksheet name is invalid, will return an integer type value // 0. func (f *File) GetSheetIndex(name string) int { @@ -325,7 +325,7 @@ func (f *File) GetSheetIndex(name string) int { return 0 } -// GetSheetMap provides function to get worksheet name and index map of XLSX. +// GetSheetMap provides a function to get worksheet name and index map of XLSX. // For example: // // xlsx, err := excelize.OpenFile("./Book1.xlsx") @@ -351,7 +351,7 @@ func (f *File) GetSheetMap() map[int]string { return sheetMap } -// getSheetMap provides function to get worksheet name and XML file path map of +// getSheetMap provides a function to get worksheet name and XML file path map of // XLSX. func (f *File) getSheetMap() map[string]string { maps := make(map[string]string) @@ -361,7 +361,7 @@ func (f *File) getSheetMap() map[string]string { return maps } -// SetSheetBackground provides function to set background picture by given +// SetSheetBackground provides a function to set background picture by given // worksheet name. func (f *File) SetSheetBackground(sheet, picture string) error { var err error @@ -381,7 +381,7 @@ func (f *File) SetSheetBackground(sheet, picture string) error { return err } -// DeleteSheet provides function to delete worksheet in a workbook by given +// DeleteSheet provides a function to delete worksheet in a workbook by given // worksheet name. Use this method with caution, which will affect changes in // references such as formulas, charts, and so on. If there is any referenced // value of the deleted worksheet, it will cause a file error when you open it. @@ -405,7 +405,7 @@ func (f *File) DeleteSheet(name string) { f.SetActiveSheet(len(f.GetSheetMap())) } -// deleteSheetFromWorkbookRels provides function to remove worksheet +// deleteSheetFromWorkbookRels provides a function to remove worksheet // relationships by given relationships ID in the file // xl/_rels/workbook.xml.rels. func (f *File) deleteSheetFromWorkbookRels(rID string) string { @@ -419,7 +419,7 @@ func (f *File) deleteSheetFromWorkbookRels(rID string) string { return "" } -// deleteSheetFromContentTypes provides function to remove worksheet +// deleteSheetFromContentTypes provides a function to remove worksheet // relationships by given target name in the file [Content_Types].xml. func (f *File) deleteSheetFromContentTypes(target string) { content := f.contentTypesReader() @@ -430,7 +430,7 @@ func (f *File) deleteSheetFromContentTypes(target string) { } } -// CopySheet provides function to duplicate a worksheet by gave source and +// CopySheet provides a function to duplicate a worksheet by gave source and // target worksheet index. Note that currently doesn't support duplicate // workbooks that contain tables, charts or pictures. For Example: // @@ -447,7 +447,7 @@ func (f *File) CopySheet(from, to int) error { return nil } -// copySheet provides function to duplicate a worksheet by gave source and +// copySheet provides a function to duplicate a worksheet by gave source and // target worksheet name. func (f *File) copySheet(from, to int) { sheet := f.workSheetReader("sheet" + strconv.Itoa(from)) @@ -468,7 +468,7 @@ func (f *File) copySheet(from, to int) { } } -// SetSheetVisible provides function to set worksheet visible by given worksheet +// SetSheetVisible provides a function to set worksheet visible by given worksheet // name. A workbook must contain at least one visible worksheet. If the given // worksheet has been activated, this setting will be invalidated. Sheet state // values as defined by http://msdn.microsoft.com/en-us/library/office/documentformat.openxml.spreadsheet.sheetstatevalues.aspx @@ -510,14 +510,14 @@ func (f *File) SetSheetVisible(name string, visible bool) { } } -// parseFormatPanesSet provides function to parse the panes settings. +// parseFormatPanesSet provides a function to parse the panes settings. func parseFormatPanesSet(formatSet string) (*formatPanes, error) { format := formatPanes{} err := json.Unmarshal([]byte(formatSet), &format) return &format, err } -// SetPanes provides function to create and remove freeze panes and split panes +// SetPanes provides a function to create and remove freeze panes and split panes // by given worksheet name and panes format set. // // activePane defines the pane that is active. The possible values for this @@ -631,7 +631,7 @@ func (f *File) SetPanes(sheet, panes string) { xlsx.SheetViews.SheetView[len(xlsx.SheetViews.SheetView)-1].Selection = s } -// GetSheetVisible provides function to get worksheet visible by given worksheet +// GetSheetVisible provides a function to get worksheet visible by given worksheet // name. For example, get visible state of Sheet1: // // xlsx.GetSheetVisible("Sheet1") @@ -649,7 +649,7 @@ func (f *File) GetSheetVisible(name string) bool { return visible } -// trimSheetName provides function to trim invaild characters by given worksheet +// trimSheetName provides a function to trim invaild characters by given worksheet // name. func trimSheetName(name string) string { r := []rune{} diff --git a/sheetpr.go b/sheetpr.go index 7b8df54..1601ab1 100644 --- a/sheetpr.go +++ b/sheetpr.go @@ -98,7 +98,7 @@ func (o *AutoPageBreaks) getSheetPrOption(pr *xlsxSheetPr) { *o = AutoPageBreaks(pr.PageSetUpPr.AutoPageBreaks) } -// SetSheetPrOptions provides function to sets worksheet properties. +// SetSheetPrOptions provides a function to sets worksheet properties. // // Available options: // CodeName(string) @@ -120,7 +120,7 @@ func (f *File) SetSheetPrOptions(name string, opts ...SheetPrOption) error { return nil } -// GetSheetPrOptions provides function to gets worksheet properties. +// GetSheetPrOptions provides a function to gets worksheet properties. // // Available options: // CodeName(string) diff --git a/styles.go b/styles.go index fdbf932..a288b37 100644 --- a/styles.go +++ b/styles.go @@ -10,8 +10,8 @@ import ( ) // Excel styles can reference number formats that are built-in, all of which -// have an id less than 164. This is a possibly incomplete list comprised of as -// many of them as I could find. +// have an id less than 164. This is a possibly incomplete list comprised of +// as many of them as I could find. var builtInNumFmt = map[int]string{ 0: "general", 1: "0", @@ -829,14 +829,15 @@ var criteriaType = map[string]string{ "continue month": "continueMonth", } -// formatToString provides function to return original string by given built-in -// number formats code and cell string. +// formatToString provides a function to return original string by given +// built-in number formats code and cell string. func formatToString(i int, v string) string { return v } -// formatToInt provides function to convert original string to integer format as -// string type by given built-in number formats code and cell string. +// formatToInt provides a function to convert original string to integer +// format as string type by given built-in number formats code and cell +// string. func formatToInt(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -845,8 +846,9 @@ func formatToInt(i int, v string) string { return fmt.Sprintf("%d", int(f)) } -// formatToFloat provides function to convert original string to float format as -// string type by given built-in number formats code and cell string. +// formatToFloat provides a function to convert original string to float +// format as string type by given built-in number formats code and cell +// string. func formatToFloat(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -855,8 +857,8 @@ func formatToFloat(i int, v string) string { return fmt.Sprintf("%.2f", f) } -// formatToA provides function to convert original string to special format as -// string type by given built-in number formats code and cell string. +// formatToA provides a function to convert original string to special format +// as string type by given built-in number formats code and cell string. func formatToA(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -870,8 +872,8 @@ func formatToA(i int, v string) string { return fmt.Sprintf("%d", t) } -// formatToB provides function to convert original string to special format as -// string type by given built-in number formats code and cell string. +// formatToB provides a function to convert original string to special format +// as string type by given built-in number formats code and cell string. func formatToB(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -883,8 +885,8 @@ func formatToB(i int, v string) string { return fmt.Sprintf("%.2f", f) } -// formatToC provides function to convert original string to special format as -// string type by given built-in number formats code and cell string. +// formatToC provides a function to convert original string to special format +// as string type by given built-in number formats code and cell string. func formatToC(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -894,8 +896,8 @@ func formatToC(i int, v string) string { return fmt.Sprintf("%d%%", int(f)) } -// formatToD provides function to convert original string to special format as -// string type by given built-in number formats code and cell string. +// formatToD provides a function to convert original string to special format +// as string type by given built-in number formats code and cell string. func formatToD(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -905,8 +907,8 @@ func formatToD(i int, v string) string { return fmt.Sprintf("%.2f%%", f) } -// formatToE provides function to convert original string to special format as -// string type by given built-in number formats code and cell string. +// formatToE provides a function to convert original string to special format +// as string type by given built-in number formats code and cell string. func formatToE(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -915,17 +917,17 @@ func formatToE(i int, v string) string { return fmt.Sprintf("%.e", f) } -// parseTime provides function to returns a string parsed using time.Time. +// parseTime provides a function to returns a string parsed using time.Time. // Replace Excel placeholders with Go time placeholders. For example, replace -// yyyy with 2006. These are in a specific order, due to the fact that m is used -// in month, minute, and am/pm. It would be easier to fix that with regular -// expressions, but if it's possible to keep this simple it would be easier to -// maintain. Full-length month and days (e.g. March, Tuesday) have letters in -// them that would be replaced by other characters below (such as the 'h' in -// March, or the 'd' in Tuesday) below. First we convert them to arbitrary -// characters unused in Excel Date formats, and then at the end, turn them to -// what they should actually be. -// Based off: http://www.ozgrid.com/Excel/CustomFormats.htm +// yyyy with 2006. These are in a specific order, due to the fact that m is +// used in month, minute, and am/pm. It would be easier to fix that with +// regular expressions, but if it's possible to keep this simple it would be +// easier to maintain. Full-length month and days (e.g. March, Tuesday) have +// letters in them that would be replaced by other characters below (such as +// the 'h' in March, or the 'd' in Tuesday) below. First we convert them to +// arbitrary characters unused in Excel Date formats, and then at the end, +// turn them to what they should actually be. Based off: +// http://www.ozgrid.com/Excel/CustomFormats.htm func parseTime(i int, v string) string { f, err := strconv.ParseFloat(v, 64) if err != nil { @@ -983,7 +985,7 @@ func is12HourTime(format string) bool { return strings.Contains(format, "am/pm") || strings.Contains(format, "AM/PM") || strings.Contains(format, "a/p") || strings.Contains(format, "A/P") } -// stylesReader provides function to get the pointer to the structure after +// stylesReader provides a function to get the pointer to the structure after // deserialization of xl/styles.xml. func (f *File) stylesReader() *xlsxStyleSheet { if f.Styles == nil { @@ -994,7 +996,7 @@ func (f *File) stylesReader() *xlsxStyleSheet { return f.Styles } -// styleSheetWriter provides function to save xl/styles.xml after serialize +// styleSheetWriter provides a function to save xl/styles.xml after serialize // structure. func (f *File) styleSheetWriter() { if f.Styles != nil { @@ -1003,7 +1005,7 @@ func (f *File) styleSheetWriter() { } } -// parseFormatStyleSet provides function to parse the format settings of the +// parseFormatStyleSet provides a function to parse the format settings of the // cells and conditional formats. func parseFormatStyleSet(style string) (*formatStyle, error) { format := formatStyle{ @@ -1013,8 +1015,8 @@ func parseFormatStyleSet(style string) (*formatStyle, error) { return &format, err } -// NewStyle provides function to create style for cells by given style format. -// Note that the color field uses RGB color code. +// NewStyle provides a function to create style for cells by given style +// format. Note that the color field uses RGB color code. // // The following shows the border styles sorted by excelize index number: // @@ -1906,10 +1908,10 @@ func (f *File) NewStyle(style string) (int, error) { return cellXfsID, nil } -// NewConditionalStyle provides function to create style for conditional format -// by given style format. The parameters are the same as function NewStyle(). -// Note that the color field uses RGB color code and only support to set font, -// fills, alignment and borders currently. +// NewConditionalStyle provides a function to create style for conditional +// format by given style format. The parameters are the same as function +// NewStyle(). Note that the color field uses RGB color code and only support +// to set font, fills, alignment and borders currently. func (f *File) NewConditionalStyle(style string) (int, error) { s := f.stylesReader() fs, err := parseFormatStyleSet(style) @@ -1935,7 +1937,8 @@ func (f *File) NewConditionalStyle(style string) (int, error) { return s.Dxfs.Count - 1, nil } -// setFont provides function to add font style by given cell format settings. +// setFont provides a function to add font style by given cell format +// settings. func setFont(formatStyle *formatStyle) *font { fontUnderlineType := map[string]string{"single": "single", "double": "double"} if formatStyle.Font.Size < 1 { @@ -1963,8 +1966,8 @@ func setFont(formatStyle *formatStyle) *font { return &f } -// setNumFmt provides function to check if number format code in the range of -// built-in values. +// setNumFmt provides a function to check if number format code in the range +// of built-in values. func setNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int { dp := "0." numFmtID := 164 // Default custom number format code from 164. @@ -2011,7 +2014,7 @@ func setNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int { return formatStyle.NumFmt } -// setCustomNumFmt provides function to set custom number format code. +// setCustomNumFmt provides a function to set custom number format code. func setCustomNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int { nf := xlsxNumFmt{FormatCode: *formatStyle.CustomNumFmt} if style.NumFmts != nil { @@ -2029,7 +2032,7 @@ func setCustomNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int { return nf.NumFmtID } -// setLangNumFmt provides function to set number format code with language. +// setLangNumFmt provides a function to set number format code with language. func setLangNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int { numFmts, ok := langNumFmt[formatStyle.Lang] if !ok { @@ -2056,8 +2059,8 @@ func setLangNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int { return nf.NumFmtID } -// setFills provides function to add fill elements in the styles.xml by given -// cell format settings. +// setFills provides a function to add fill elements in the styles.xml by +// given cell format settings. func setFills(formatStyle *formatStyle, fg bool) *xlsxFill { var patterns = []string{ "none", @@ -2137,9 +2140,10 @@ func setFills(formatStyle *formatStyle, fg bool) *xlsxFill { return &fill } -// setAlignment provides function to formatting information pertaining to text -// alignment in cells. There are a variety of choices for how text is aligned -// both horizontally and vertically, as well as indentation settings, and so on. +// setAlignment provides a function to formatting information pertaining to +// text alignment in cells. There are a variety of choices for how text is +// aligned both horizontally and vertically, as well as indentation settings, +// and so on. func setAlignment(formatStyle *formatStyle) *xlsxAlignment { var alignment xlsxAlignment if formatStyle.Alignment != nil { @@ -2156,7 +2160,7 @@ func setAlignment(formatStyle *formatStyle) *xlsxAlignment { return &alignment } -// setProtection provides function to set protection properties associated +// setProtection provides a function to set protection properties associated // with the cell. func setProtection(formatStyle *formatStyle) *xlsxProtection { var protection xlsxProtection @@ -2167,7 +2171,7 @@ func setProtection(formatStyle *formatStyle) *xlsxProtection { return &protection } -// setBorders provides function to add border elements in the styles.xml by +// setBorders provides a function to add border elements in the styles.xml by // given borders format settings. func setBorders(formatStyle *formatStyle) *xlsxBorder { var styles = []string{ @@ -2219,7 +2223,7 @@ func setBorders(formatStyle *formatStyle) *xlsxBorder { return &border } -// setCellXfs provides function to set describes all of the formatting for a +// setCellXfs provides a function to set describes all of the formatting for a // cell. func setCellXfs(style *xlsxStyleSheet, fontID, numFmtID, fillID, borderID int, applyAlignment, applyProtection bool, alignment *xlsxAlignment, protection *xlsxProtection) int { var xf xlsxXf @@ -2246,9 +2250,10 @@ func setCellXfs(style *xlsxStyleSheet, fontID, numFmtID, fillID, borderID int, a return style.CellXfs.Count - 1 } -// SetCellStyle provides function to add style attribute for cells by given +// SetCellStyle provides a function to add style attribute for cells by given // worksheet name, coordinate area and style ID. Note that diagonalDown and -// diagonalUp type border should be use same color in the same coordinate area. +// diagonalUp type border should be use same color in the same coordinate +// area. // // For example create a borders of cell H9 on Sheet1: // @@ -2352,9 +2357,10 @@ func (f *File) SetCellStyle(sheet, hcell, vcell string, styleID int) { } } -// SetConditionalFormat provides function to create conditional formatting rule -// for cell value. Conditional formatting is a feature of Excel which allows you -// to apply a format to a cell or a range of cells based on certain criteria. +// SetConditionalFormat provides a function to create conditional formatting +// rule for cell value. Conditional formatting is a feature of Excel which +// allows you to apply a format to a cell or a range of cells based on certain +// criteria. // // The type option is a required parameter and it has no default value. // Allowable type values and their associated parameters are: @@ -2606,9 +2612,9 @@ func (f *File) SetConditionalFormat(sheet, area, formatSet string) error { return err } -// drawCondFmtCellIs provides function to create conditional formatting rule for -// cell value (include between, not between, equal, not equal, greater than and -// less than) by given priority, criteria type and format settings. +// drawCondFmtCellIs provides a function to create conditional formatting rule +// for cell value (include between, not between, equal, not equal, greater +// than and less than) by given priority, criteria type and format settings. func drawCondFmtCellIs(p int, ct string, format *formatConditional) *xlsxCfRule { c := &xlsxCfRule{ Priority: p + 1, @@ -2629,8 +2635,8 @@ func drawCondFmtCellIs(p int, ct string, format *formatConditional) *xlsxCfRule return c } -// drawCondFmtTop10 provides function to create conditional formatting rule for -// top N (default is top 10) by given priority, criteria type and format +// drawCondFmtTop10 provides a function to create conditional formatting rule +// for top N (default is top 10) by given priority, criteria type and format // settings. func drawCondFmtTop10(p int, ct string, format *formatConditional) *xlsxCfRule { c := &xlsxCfRule{ @@ -2647,9 +2653,9 @@ func drawCondFmtTop10(p int, ct string, format *formatConditional) *xlsxCfRule { return c } -// drawCondFmtAboveAverage provides function to create conditional formatting -// rule for above average and below average by given priority, criteria type and -// format settings. +// drawCondFmtAboveAverage provides a function to create conditional +// formatting rule for above average and below average by given priority, +// criteria type and format settings. func drawCondFmtAboveAverage(p int, ct string, format *formatConditional) *xlsxCfRule { return &xlsxCfRule{ Priority: p + 1, @@ -2659,7 +2665,7 @@ func drawCondFmtAboveAverage(p int, ct string, format *formatConditional) *xlsxC } } -// drawCondFmtDuplicateUniqueValues provides function to create conditional +// drawCondFmtDuplicateUniqueValues provides a function to create conditional // formatting rule for duplicate and unique values by given priority, criteria // type and format settings. func drawCondFmtDuplicateUniqueValues(p int, ct string, format *formatConditional) *xlsxCfRule { @@ -2670,9 +2676,9 @@ func drawCondFmtDuplicateUniqueValues(p int, ct string, format *formatConditiona } } -// drawCondFmtColorScale provides function to create conditional formatting rule -// for color scale (include 2 color scale and 3 color scale) by given priority, -// criteria type and format settings. +// drawCondFmtColorScale provides a function to create conditional formatting +// rule for color scale (include 2 color scale and 3 color scale) by given +// priority, criteria type and format settings. func drawCondFmtColorScale(p int, ct string, format *formatConditional) *xlsxCfRule { minValue := format.MinValue if minValue == "" { @@ -2708,8 +2714,8 @@ func drawCondFmtColorScale(p int, ct string, format *formatConditional) *xlsxCfR return c } -// drawCondFmtDataBar provides function to create conditional formatting rule -// for data bar by given priority, criteria type and format settings. +// drawCondFmtDataBar provides a function to create conditional formatting +// rule for data bar by given priority, criteria type and format settings. func drawCondFmtDataBar(p int, ct string, format *formatConditional) *xlsxCfRule { return &xlsxCfRule{ Priority: p + 1, @@ -2721,8 +2727,8 @@ func drawCondFmtDataBar(p int, ct string, format *formatConditional) *xlsxCfRule } } -// drawConfFmtExp provides function to create conditional formatting rule for -// expression by given priority, criteria type and format settings. +// drawConfFmtExp provides a function to create conditional formatting rule +// for expression by given priority, criteria type and format settings. func drawConfFmtExp(p int, ct string, format *formatConditional) *xlsxCfRule { return &xlsxCfRule{ Priority: p + 1, @@ -2732,12 +2738,13 @@ func drawConfFmtExp(p int, ct string, format *formatConditional) *xlsxCfRule { } } -// getPaletteColor provides function to convert the RBG color by given string. +// getPaletteColor provides a function to convert the RBG color by given +// string. func getPaletteColor(color string) string { return "FF" + strings.Replace(strings.ToUpper(color), "#", "", -1) } -// themeReader provides function to get the pointer to the xl/theme/theme1.xml +// themeReader provides a function to get the pointer to the xl/theme/theme1.xml // structure after deserialization. func (f *File) themeReader() *xlsxTheme { var theme xlsxTheme diff --git a/table.go b/table.go index 67f9be0..643b156 100644 --- a/table.go +++ b/table.go @@ -9,7 +9,7 @@ import ( "strings" ) -// parseFormatTableSet provides function to parse the format settings of the +// parseFormatTableSet provides a function to parse the format settings of the // table with default value. func parseFormatTableSet(formatSet string) (*formatTable, error) { format := formatTable{ @@ -75,8 +75,8 @@ func (f *File) AddTable(sheet, hcell, vcell, format string) error { return err } -// countTables provides function to get table files count storage in the folder -// xl/tables. +// countTables provides a function to get table files count storage in the +// folder xl/tables. func (f *File) countTables() int { count := 0 for k := range f.XLSX { @@ -87,7 +87,7 @@ func (f *File) countTables() int { return count } -// addSheetTable provides function to add tablePart element to +// addSheetTable provides a function to add tablePart element to // xl/worksheets/sheet%d.xml by given worksheet name and relationship index. func (f *File) addSheetTable(sheet string, rID int) { xlsx := f.workSheetReader(sheet) @@ -101,8 +101,8 @@ func (f *File) addSheetTable(sheet string, rID int) { xlsx.TableParts.TableParts = append(xlsx.TableParts.TableParts, table) } -// addTable provides function to add table by given worksheet name, coordinate -// area and format set. +// addTable provides a function to add table by given worksheet name, +// coordinate area and format set. func (f *File) addTable(sheet, tableXML string, hxAxis, hyAxis, vxAxis, vyAxis, i int, formatSet *formatTable) { // Correct the minimum number of rows, the table at least two lines. if hyAxis == vyAxis { @@ -157,7 +157,7 @@ func (f *File) addTable(sheet, tableXML string, hxAxis, hyAxis, vxAxis, vyAxis, f.saveFileList(tableXML, table) } -// parseAutoFilterSet provides function to parse the settings of the auto +// parseAutoFilterSet provides a function to parse the settings of the auto // filter. func parseAutoFilterSet(formatSet string) (*formatAutoFilter, error) { format := formatAutoFilter{} @@ -264,7 +264,7 @@ func (f *File) AutoFilter(sheet, hcell, vcell, format string) error { return f.autoFilter(sheet, ref, refRange, hxAxis, formatSet) } -// autoFilter provides function to extract the tokens from the filter +// autoFilter provides a function to extract the tokens from the filter // expression. The tokens are mainly non-whitespace groups. func (f *File) autoFilter(sheet, ref string, refRange, hxAxis int, formatSet *formatAutoFilter) error { xlsx := f.workSheetReader(sheet) @@ -301,8 +301,8 @@ func (f *File) autoFilter(sheet, ref string, refRange, hxAxis int, formatSet *fo return nil } -// writeAutoFilter provides function to check for single or double custom filters -// as default filters and handle them accordingly. +// writeAutoFilter provides a function to check for single or double custom +// filters as default filters and handle them accordingly. func (f *File) writeAutoFilter(filter *xlsxAutoFilter, exp []int, tokens []string) { if len(exp) == 1 && exp[0] == 2 { // Single equality. @@ -329,7 +329,7 @@ func (f *File) writeAutoFilter(filter *xlsxAutoFilter, exp []int, tokens []strin } } -// writeCustomFilter provides function to write the element. +// writeCustomFilter provides a function to write the element. func (f *File) writeCustomFilter(filter *xlsxAutoFilter, operator int, val string) { operators := map[int]string{ 1: "lessThan", @@ -353,8 +353,9 @@ func (f *File) writeCustomFilter(filter *xlsxAutoFilter, operator int, val strin } } -// parseFilterExpression provides function to converts the tokens of a possibly -// conditional expression into 1 or 2 sub expressions for further parsing. +// parseFilterExpression provides a function to converts the tokens of a +// possibly conditional expression into 1 or 2 sub expressions for further +// parsing. // // Examples: // @@ -394,7 +395,7 @@ func (f *File) parseFilterExpression(expression string, tokens []string) ([]int, return expressions, t, nil } -// parseFilterTokens provides function to parse the 3 tokens of a filter +// parseFilterTokens provides a function to parse the 3 tokens of a filter // expression and return the operator and token. func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, string, error) { operators := map[string]int{ -- cgit v1.2.1 From ce5b37a4ac93196f90cfef2aec381a9b7d153fdd Mon Sep 17 00:00:00 2001 From: Farmerx Date: Mon, 20 Aug 2018 16:53:51 +0800 Subject: =?UTF-8?q?#=20fix=20:=20file=20close=20=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- picture.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/picture.go b/picture.go index d039ae0..97e72a6 100644 --- a/picture.go +++ b/picture.go @@ -88,7 +88,11 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error { if !ok { return errors.New("Unsupported image extension") } - readFile, _ := os.Open(picture) + readFile, err := os.Open(picture) + if err!=nil{ + return err + } + defer readFile.Close() image, _, _ := image.DecodeConfig(readFile) _, file := filepath.Split(picture) formatSet, err := parseFormatPictureSet(format) -- cgit v1.2.1 From 24a8d64f939afb5c15b04e552b3d3b7046daa851 Mon Sep 17 00:00:00 2001 From: rentiansheng Date: Sat, 1 Sep 2018 19:38:30 +0800 Subject: add datavalidation test and fixed struct bug issue #240 --- datavalidation.go | 32 ++++++++++++++------------------ datavalidation_test.go | 32 ++++++++++++++++++++++++++++++++ xmlWorksheet.go | 4 ++-- 3 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 datavalidation_test.go diff --git a/datavalidation.go b/datavalidation.go index 5dae7c9..f1db732 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -33,9 +33,9 @@ type DataValidationErrorStyle int // Data validation error styles const ( _ DataValidationErrorStyle = iota - DataValidationStyleStop - DataValidationStyleWarning - DataValidationStyleInformation + DataValidationErrorStyleStop + DataValidationErrorStyleWarning + DataValidationErrorStyleInformation ) // Data validation error styles @@ -71,16 +71,16 @@ func NewDataValidation(allowBlank bool) *DataValidation { } // SetError set error notice -func (dd *DataValidation) SetError(style DataValidationErrorStyle, title, msg *string) { - dd.Error = msg - dd.ErrorTitle = title +func (dd *DataValidation) SetError(style DataValidationErrorStyle, title, msg string) { + dd.Error = &msg + dd.ErrorTitle = &title strStyle := styleStop switch style { - case DataValidationStyleStop: + case DataValidationErrorStyleStop: strStyle = styleStop - case DataValidationStyleWarning: + case DataValidationErrorStyleWarning: strStyle = styleWarning - case DataValidationStyleInformation: + case DataValidationErrorStyleInformation: strStyle = styleInformation } @@ -89,10 +89,10 @@ func (dd *DataValidation) SetError(style DataValidationErrorStyle, title, msg *s } // SetInput set prompt notice -func (dd *DataValidation) SetInput(title, msg *string) { +func (dd *DataValidation) SetInput(title, msg string) { dd.ShowInputMessage = convBoolToStr(true) - dd.PromptTitle = title - dd.Prompt = msg + dd.PromptTitle = &title + dd.Prompt = &msg } // SetDropList data validation list @@ -109,7 +109,7 @@ func (dd *DataValidation) SetRange(f1, f2 int, t DataValidationType, o DataValid if dataValidationFormulaStrLen < len(dd.Formula1) || dataValidationFormulaStrLen < len(dd.Formula2) { return fmt.Errorf(dataValidationFormulaStrLenErr) } - switch o { + /*switch o { case DataValidationOperatorBetween: if f1 > f2 { tmp := formula1 @@ -122,7 +122,7 @@ func (dd *DataValidation) SetRange(f1, f2 int, t DataValidationType, o DataValid formula1 = formula2 formula2 = tmp } - } + }*/ dd.Formula1 = formula1 dd.Formula2 = formula2 @@ -190,7 +190,3 @@ func (f *File) AddDataValidation(sheet string, dv *DataValidation) { xlsx.DataValidations.DataValidation = append(xlsx.DataValidations.DataValidation, dv) xlsx.DataValidations.Count = len(xlsx.DataValidations.DataValidation) } - -func (f *File) GetDataValidation(sheet, sqref string) { - -} diff --git a/datavalidation_test.go b/datavalidation_test.go new file mode 100644 index 0000000..718131f --- /dev/null +++ b/datavalidation_test.go @@ -0,0 +1,32 @@ +package excelize + +import ( + "testing" +) + +func TestDataValidation(t *testing.T) { + xlsx := NewFile() + + dvRange := NewDataValidation(true) + dvRange.Sqref = "A1:B2" + dvRange.SetRange(10, 20, DataValidationTypeWhole, DataValidationOperatorBetween) + dvRange.SetError(DataValidationErrorStyleStop, "error title", "error body") + xlsx.AddDataValidation("Sheet1", dvRange) + + dvRange = NewDataValidation(true) + dvRange.Sqref = "A3:B4" + dvRange.SetRange(10, 20, DataValidationTypeWhole, DataValidationOperatorGreaterThan) + dvRange.SetInput("input title", "input body") + xlsx.AddDataValidation("Sheet1", dvRange) + + dvRange = NewDataValidation(true) + dvRange.Sqref = "A5:B6" + dvRange.SetDropList([]string{"1", "2", "3"}) + xlsx.AddDataValidation("Sheet1", dvRange) + + // Test write file to given path. + err := xlsx.SaveAs("./test/Bookdatavalition.xlsx") + if err != nil { + t.Error(err) + } +} diff --git a/xmlWorksheet.go b/xmlWorksheet.go index f2ac9fb..25e3904 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -18,7 +18,7 @@ type xlsxWorksheet struct { MergeCells *xlsxMergeCells `xml:"mergeCells"` PhoneticPr *xlsxPhoneticPr `xml:"phoneticPr"` ConditionalFormatting []*xlsxConditionalFormatting `xml:"conditionalFormatting"` - DataValidations *xlsxDataValidations `xml:"dataValidations"` + DataValidations *xlsxDataValidations `xml:"dataValidations,omitempty"` Hyperlinks *xlsxHyperlinks `xml:"hyperlinks"` PrintOptions *xlsxPrintOptions `xml:"printOptions"` PageMargins *xlsxPageMargins `xml:"pageMargins"` @@ -298,7 +298,7 @@ type xlsxDataValidations struct { DisablePrompts bool `xml:"disablePrompts,attr,omitempty"` XWindow int `xml:"xWindow,attr,omitempty"` YWindow int `xml:"yWindow,attr,omitempty"` - DataValidation []*DataValidation `xml:"dataValidation,innerxml"` + DataValidation []*DataValidation `xml:"dataValidation"` } type DataValidation struct { -- cgit v1.2.1 From 562ba3d234489796b94aca01eda88aea7b0c5cbf Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 1 Sep 2018 23:32:44 +0800 Subject: Add function doc and fix golint error --- datavalidation.go | 95 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 42 deletions(-) diff --git a/datavalidation.go b/datavalidation.go index f1db732..62d2cf8 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -5,16 +5,17 @@ import ( "strings" ) +// DataValidationType defined the type of data validation. type DataValidationType int -// Data validation types +// Data validation types. const ( _DataValidationType = iota - typeNone //inline use + typeNone // inline use DataValidationTypeCustom DataValidationTypeDate DataValidationTypeDecimal - typeList //inline use + typeList // inline use DataValidationTypeTextLeng DataValidationTypeTime // DataValidationTypeWhole Integer @@ -28,9 +29,10 @@ const ( dataValidationFormulaStrLenErr = "data validation must be 0-255 characters" ) +// DataValidationErrorStyle defined the style of data validation error alert. type DataValidationErrorStyle int -// Data validation error styles +// Data validation error styles. const ( _ DataValidationErrorStyle = iota DataValidationErrorStyleStop @@ -38,17 +40,17 @@ const ( DataValidationErrorStyleInformation ) -// Data validation error styles +// Data validation error styles. const ( styleStop = "stop" styleWarning = "warning" styleInformation = "information" ) -// DataValidationOperator operator enum +// DataValidationOperator operator enum. type DataValidationOperator int -// Data validation operators +// Data validation operators. const ( _DataValidationOperator = iota DataValidationOperatorBetween @@ -61,16 +63,16 @@ const ( DataValidationOperatorNotEqual ) -// NewDataValidation return data validation struct +// NewDataValidation return data validation struct. func NewDataValidation(allowBlank bool) *DataValidation { return &DataValidation{ - AllowBlank: convBoolToStr(allowBlank), - ShowErrorMessage: convBoolToStr(false), - ShowInputMessage: convBoolToStr(false), + AllowBlank: allowBlank, + ShowErrorMessage: false, + ShowInputMessage: false, } } -// SetError set error notice +// SetError set error notice. func (dd *DataValidation) SetError(style DataValidationErrorStyle, title, msg string) { dd.Error = &msg dd.ErrorTitle = &title @@ -84,45 +86,31 @@ func (dd *DataValidation) SetError(style DataValidationErrorStyle, title, msg st strStyle = styleInformation } - dd.ShowErrorMessage = convBoolToStr(true) + dd.ShowErrorMessage = true dd.ErrorStyle = &strStyle } -// SetInput set prompt notice +// SetInput set prompt notice. func (dd *DataValidation) SetInput(title, msg string) { - dd.ShowInputMessage = convBoolToStr(true) + dd.ShowInputMessage = true dd.PromptTitle = &title dd.Prompt = &msg } -// SetDropList data validation list +// SetDropList data validation list. func (dd *DataValidation) SetDropList(keys []string) error { dd.Formula1 = "\"" + strings.Join(keys, ",") + "\"" dd.Type = convDataValidationType(typeList) return nil } -// SetDropList data validation range +// SetRange provides function to set data validation range in drop list. func (dd *DataValidation) SetRange(f1, f2 int, t DataValidationType, o DataValidationOperator) error { formula1 := fmt.Sprintf("%d", f1) formula2 := fmt.Sprintf("%d", f2) if dataValidationFormulaStrLen < len(dd.Formula1) || dataValidationFormulaStrLen < len(dd.Formula2) { return fmt.Errorf(dataValidationFormulaStrLenErr) } - /*switch o { - case DataValidationOperatorBetween: - if f1 > f2 { - tmp := formula1 - formula1 = formula2 - formula2 = tmp - } - case DataValidationOperatorNotBetween: - if f1 > f2 { - tmp := formula1 - formula1 = formula2 - formula2 = tmp - } - }*/ dd.Formula1 = formula1 dd.Formula2 = formula2 @@ -131,7 +119,7 @@ func (dd *DataValidation) SetRange(f1, f2 int, t DataValidationType, o DataValid return nil } -// SetDropList data validation range +// SetSqref provides function to set data validation range in drop list. func (dd *DataValidation) SetSqref(sqref string) { if dd.Sqref == "" { dd.Sqref = sqref @@ -140,15 +128,7 @@ func (dd *DataValidation) SetSqref(sqref string) { } } -// convBoolToStr convert boolean to string , false to 0, true to 1 -func convBoolToStr(bl bool) string { - if bl { - return "1" - } - return "0" -} - -// convDataValidationType get excel data validation type +// convDataValidationType get excel data validation type. func convDataValidationType(t DataValidationType) string { typeMap := map[DataValidationType]string{ typeNone: "none", @@ -165,7 +145,7 @@ func convDataValidationType(t DataValidationType) string { } -// convDataValidationOperatior get excel data validation operator +// convDataValidationOperatior get excel data validation operator. func convDataValidationOperatior(o DataValidationOperator) string { typeMap := map[DataValidationOperator]string{ DataValidationOperatorBetween: "between", @@ -182,6 +162,37 @@ func convDataValidationOperatior(o DataValidationOperator) string { } +// AddDataValidation provides set data validation on a range of the worksheet +// by given data validation object and worksheet name. The data validation +// object can be created by NewDataValidation function. +// +// Example 1, set data validation on Sheet1!A1:B2 with validation criteria +// settings, show error alert after invalid data is entered whth "Stop" style +// and custom title "error body": +// +// dvRange := excelize.NewDataValidation(true) +// dvRange.Sqref = "A1:B2" +// dvRange.SetRange(10, 20, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorBetween) +// dvRange.SetError(excelize.DataValidationErrorStyleStop, "error title", "error body") +// xlsx.AddDataValidation("Sheet1", dvRange) +// +// Example 2, set data validation on Sheet1!A3:B4 with validation criteria +// settings, and show input message when cell is selected: +// +// dvRange = excelize.NewDataValidation(true) +// dvRange.Sqref = "A3:B4" +// dvRange.SetRange(10, 20, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorGreaterThan) +// dvRange.SetInput("input title", "input body") +// xlsx.AddDataValidation("Sheet1", dvRange) +// +// Example 4, set data validation on Sheet1!A5:B6 with validation criteria +// settings, create in-cell dropdown by allow list source: +// +// dvRange = excelize.NewDataValidation(true) +// dvRange.Sqref = "A5:B6" +// dvRange.SetDropList([]string{"1", "2", "3"}) +// xlsx.AddDataValidation("Sheet1", dvRange) +// func (f *File) AddDataValidation(sheet string, dv *DataValidation) { xlsx := f.workSheetReader(sheet) if nil == xlsx.DataValidations { -- cgit v1.2.1 From ba459dc659720d7504e5eb6f5bda9081a452a509 Mon Sep 17 00:00:00 2001 From: xuri Date: Sat, 1 Sep 2018 23:36:57 +0800 Subject: DataValidation struct changed Change `allowBlank`, `ShowErrorMessage` and `ShowInputMessage` type as boolean, add new field `ShowDropDown`, change fields orders follow as ECMA-376-1:2016 18.3.1.32. --- xmlWorksheet.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 25e3904..7cf4994 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -301,20 +301,23 @@ type xlsxDataValidations struct { DataValidation []*DataValidation `xml:"dataValidation"` } +// DataValidation directly maps the a single item of data validation defined +// on a range of the worksheet. type DataValidation struct { - AllowBlank string `xml:"allowBlank,attr"` // allow empty - ShowInputMessage string `xml:"showInputMessage,attr"` // 1, true,0,false, select cell, Whether the input message is displayed - ShowErrorMessage string `xml:"showErrorMessage,attr"` // 1, true,0,false, input error value, Whether the error message is displayed - ErrorStyle *string `xml:"errorStyle,attr"` //error icon style, warning, infomation,stop - ErrorTitle *string `xml:"errorTitle,attr"` // error title - Operator string `xml:"operator,attr"` // - Error *string `xml:"error,attr"` // input error value, notice message - PromptTitle *string `xml:"promptTitle"` + AllowBlank bool `xml:"allowBlank,attr"` + Error *string `xml:"error,attr"` + ErrorStyle *string `xml:"errorStyle,attr"` + ErrorTitle *string `xml:"errorTitle,attr"` + Operator string `xml:"operator,attr"` Prompt *string `xml:"prompt,attr"` - Type string `xml:"type,attr"` //data type, none,custom,date,decimal,list, textLength,time,whole - Sqref string `xml:"sqref,attr"` //Validity of data validation rules, cell and range, eg: A1 OR A1:A20 - Formula1 string `xml:"formula1"` // data validation role - Formula2 string `xml:"formula2"` //data validation role + PromptTitle *string `xml:"promptTitle"` + ShowDropDown bool `xml:"showDropDown,attr"` + ShowErrorMessage bool `xml:"showErrorMessage,attr"` + ShowInputMessage bool `xml:"showInputMessage,attr"` + Sqref string `xml:"sqref,attr"` + Type string `xml:"type,attr"` + Formula1 string `xml:"formula1"` + Formula2 string `xml:"formula2"` } // xlsxC directly maps the c element in the namespace -- cgit v1.2.1 From 2da107d3b20a5561d311466b7b2cb91170885f9f Mon Sep 17 00:00:00 2001 From: xuri Date: Sun, 2 Sep 2018 01:44:32 +0800 Subject: Fix typo. --- datavalidation.go | 6 +++--- datavalidation_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/datavalidation.go b/datavalidation.go index 62d2cf8..914e877 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -167,11 +167,11 @@ func convDataValidationOperatior(o DataValidationOperator) string { // object can be created by NewDataValidation function. // // Example 1, set data validation on Sheet1!A1:B2 with validation criteria -// settings, show error alert after invalid data is entered whth "Stop" style +// settings, show error alert after invalid data is entered with "Stop" style // and custom title "error body": // // dvRange := excelize.NewDataValidation(true) -// dvRange.Sqref = "A1:B2" +// dvRange.Sqref = "A1:B2" // dvRange.SetRange(10, 20, excelize.DataValidationTypeWhole, excelize.DataValidationOperatorBetween) // dvRange.SetError(excelize.DataValidationErrorStyleStop, "error title", "error body") // xlsx.AddDataValidation("Sheet1", dvRange) @@ -185,7 +185,7 @@ func convDataValidationOperatior(o DataValidationOperator) string { // dvRange.SetInput("input title", "input body") // xlsx.AddDataValidation("Sheet1", dvRange) // -// Example 4, set data validation on Sheet1!A5:B6 with validation criteria +// Example 3, set data validation on Sheet1!A5:B6 with validation criteria // settings, create in-cell dropdown by allow list source: // // dvRange = excelize.NewDataValidation(true) diff --git a/datavalidation_test.go b/datavalidation_test.go index 718131f..32f9059 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -25,7 +25,7 @@ func TestDataValidation(t *testing.T) { xlsx.AddDataValidation("Sheet1", dvRange) // Test write file to given path. - err := xlsx.SaveAs("./test/Bookdatavalition.xlsx") + err := xlsx.SaveAs("./test/Book_data_validation.xlsx") if err != nil { t.Error(err) } -- cgit v1.2.1 From 93cbafb0e2ff5df0236d543650712cd175cd789d Mon Sep 17 00:00:00 2001 From: rentiansheng Date: Tue, 4 Sep 2018 13:40:53 +0800 Subject: data validation drop-down list use sqref cell issue #268 --- datavalidation.go | 12 ++++++++++++ datavalidation_test.go | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/datavalidation.go b/datavalidation.go index 914e877..010615c 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -119,6 +119,18 @@ func (dd *DataValidation) SetRange(f1, f2 int, t DataValidationType, o DataValid return nil } +// SetSqrefDropList data validation list with current sheet cell rang +func (dd *DataValidation) SetSqrefDropList(sqref string, isCurrentSheet bool) error { + if isCurrentSheet { + dd.Formula1 = sqref + dd.Type = convDataValidationType(typeList) + return nil + } + + //isCurrentSheet = false Cross-sheet sqref cell use extLst xml node unrealized + return fmt.Errorf("Cross-sheet sqref cell are not supported") +} + // SetSqref provides function to set data validation range in drop list. func (dd *DataValidation) SetSqref(sqref string) { if dd.Sqref == "" { diff --git a/datavalidation_test.go b/datavalidation_test.go index 32f9059..f3db81c 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -24,6 +24,14 @@ func TestDataValidation(t *testing.T) { dvRange.SetDropList([]string{"1", "2", "3"}) xlsx.AddDataValidation("Sheet1", dvRange) + xlsx.SetCellStr("Sheet1", "E1", "E1") + xlsx.SetCellStr("Sheet1", "E2", "E2") + xlsx.SetCellStr("Sheet1", "E3", "E3") + dvRange = NewDataValidation(true) + dvRange.Sqref = "A7:B8" + dvRange.SetSqrefDropList("$E$1:$E$3", true) + xlsx.AddDataValidation("Sheet1", dvRange) + // Test write file to given path. err := xlsx.SaveAs("./test/Book_data_validation.xlsx") if err != nil { -- cgit v1.2.1 From b4a6e61ec34d4a0db1110907cc969f0d7d38991a Mon Sep 17 00:00:00 2001 From: xuri Date: Wed, 12 Sep 2018 15:47:56 +0800 Subject: Fix golint errors under confidence 0.1 --- cell.go | 8 +++++++ chart.go | 8 +++++++ col.go | 8 +++++++ comment.go | 8 +++++++ datavalidation.go | 10 +++++++- datavalidation_test.go | 8 +++++++ date.go | 8 +++++++ excelize.go | 8 +++++++ file.go | 10 +++++++- hsl.go | 62 +++++++++++++++++++++++++----------------------- lib.go | 8 +++++++ picture.go | 12 ++++++++-- rows.go | 8 +++++++ shape.go | 8 +++++++ sheet.go | 12 ++++++++-- sheetpr.go | 8 +++++++ sheetview.go | 8 +++++++ styles.go | 64 ++++++++++++++++++++++++++++---------------------- table.go | 16 +++++++++---- templates.go | 10 +++++++- vmlDrawing.go | 8 +++++++ xmlChart.go | 8 +++++++ xmlComments.go | 8 +++++++ xmlContentTypes.go | 8 +++++++ xmlDecodeDrawing.go | 8 +++++++ xmlDrawing.go | 8 +++++++ xmlSharedStrings.go | 8 +++++++ xmlStyles.go | 8 +++++++ xmlTable.go | 8 +++++++ xmlTheme.go | 8 +++++++ xmlWorkbook.go | 8 +++++++ xmlWorksheet.go | 8 +++++++ 32 files changed, 319 insertions(+), 69 deletions(-) diff --git a/cell.go b/cell.go index 5ec5976..e6755d6 100644 --- a/cell.go +++ b/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 import ( diff --git a/chart.go b/chart.go index 8e1d7e9..2047684 100644 --- a/chart.go +++ b/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 import ( diff --git a/col.go b/col.go index e3870ee..cddb09f 100644 --- a/col.go +++ b/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 import ( diff --git a/comment.go b/comment.go index 8bf4fd3..32ed02f 100644 --- a/comment.go +++ b/comment.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 import ( diff --git a/datavalidation.go b/datavalidation.go index 010615c..be3caab 100644 --- a/datavalidation.go +++ b/datavalidation.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 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 - 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. diff --git a/datavalidation_test.go b/datavalidation_test.go index f3db81c..8134b72 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.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 import ( diff --git a/date.go b/date.go index 7233661..56d6ad7 100644 --- a/date.go +++ b/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 import ( diff --git a/excelize.go b/excelize.go index 0b530ab..915955c 100644 --- a/excelize.go +++ b/excelize.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 import ( diff --git a/file.go b/file.go index a45fc28..76ef986 100644 --- a/file.go +++ b/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 import ( @@ -43,7 +51,7 @@ func NewFile() *File { // Save provides a function to override the xlsx file with origin path. func (f *File) Save() error { 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) } diff --git a/hsl.go b/hsl.go index bd868b1..fd10b5d 100644 --- a/hsl.go +++ b/hsl.go @@ -1,33 +1,35 @@ -/* -Copyright (c) 2012 Rodrigo Moraes. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -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 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 (c) 2012 Rodrigo Moraes. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// 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 import ( diff --git a/lib.go b/lib.go index 8013efa..5be9b16 100644 --- a/lib.go +++ b/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 import ( diff --git a/picture.go b/picture.go index 97e72a6..decc37d 100644 --- a/picture.go +++ b/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 import ( @@ -86,10 +94,10 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error { } ext, ok := supportImageTypes[path.Ext(picture)] if !ok { - return errors.New("Unsupported image extension") + return errors.New("unsupported image extension") } readFile, err := os.Open(picture) - if err!=nil{ + if err != nil { return err } defer readFile.Close() diff --git a/rows.go b/rows.go index 521a945..8e1e0c3 100644 --- a/rows.go +++ b/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 import ( diff --git a/shape.go b/shape.go index 8fbfbcd..42aefcf 100644 --- a/shape.go +++ b/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 import ( diff --git a/sheet.go b/sheet.go index 011ecb8..b5c3e6c 100644 --- a/sheet.go +++ b/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 import ( @@ -371,7 +379,7 @@ func (f *File) SetSheetBackground(sheet, picture string) error { } ext, ok := supportImageTypes[path.Ext(picture)] if !ok { - return errors.New("Unsupported image extension") + return errors.New("unsupported image extension") } pictureID := f.countMedia() + 1 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 { 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) return nil diff --git a/sheetpr.go b/sheetpr.go index 1601ab1..a010130 100644 --- a/sheetpr.go +++ b/sheetpr.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 // SheetPrOption is an option of a view of a worksheet. See SetSheetPrOptions(). diff --git a/sheetview.go b/sheetview.go index 679e915..5e756ea 100644 --- a/sheetview.go +++ b/sheetview.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 import "fmt" diff --git a/styles.go b/styles.go index a288b37..80f347e 100644 --- a/styles.go +++ b/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 import ( @@ -798,35 +806,35 @@ var validType = map[string]string{ // criteriaType defined the list of valid criteria types. var criteriaType = map[string]string{ - "between": "between", - "not between": "notBetween", - "equal to": "equal", - "=": "equal", - "==": "equal", - "not equal to": "notEqual", - "!=": "notEqual", - "<>": "notEqual", - "greater than": "greaterThan", - ">": "greaterThan", - "less than": "lessThan", - "<": "lessThan", + "between": "between", + "not between": "notBetween", + "equal to": "equal", + "=": "equal", + "==": "equal", + "not equal to": "notEqual", + "!=": "notEqual", + "<>": "notEqual", + "greater than": "greaterThan", + ">": "greaterThan", + "less than": "lessThan", + "<": "lessThan", "greater than or equal to": "greaterThanOrEqual", - ">=": "greaterThanOrEqual", - "less than or equal to": "lessThanOrEqual", - "<=": "lessThanOrEqual", - "containing": "containsText", - "not containing": "notContains", - "begins with": "beginsWith", - "ends with": "endsWith", - "yesterday": "yesterday", - "today": "today", - "last 7 days": "last7Days", - "last week": "lastWeek", - "this week": "thisWeek", - "continue week": "continueWeek", - "last month": "lastMonth", - "this month": "thisMonth", - "continue month": "continueMonth", + ">=": "greaterThanOrEqual", + "less than or equal to": "lessThanOrEqual", + "<=": "lessThanOrEqual", + "containing": "containsText", + "not containing": "notContains", + "begins with": "beginsWith", + "ends with": "endsWith", + "yesterday": "yesterday", + "today": "today", + "last 7 days": "last7Days", + "last week": "lastWeek", + "this week": "thisWeek", + "continue week": "continueWeek", + "last month": "lastMonth", + "this month": "thisMonth", + "continue month": "continueMonth", } // formatToString provides a function to return original string by given diff --git a/table.go b/table.go index 643b156..fcc4d3c 100644 --- a/table.go +++ b/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 import ( @@ -282,7 +290,7 @@ func (f *File) autoFilter(sheet, ref string, refRange, hxAxis int, formatSet *fo col := TitleToNumber(formatSet.Column) offset := col - hxAxis 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{ ColID: offset, @@ -290,7 +298,7 @@ func (f *File) autoFilter(sheet, ref string, refRange, hxAxis int, formatSet *fo re := regexp.MustCompile(`"(?:[^"]|"")*"|\S+`) token := re.FindAllString(formatSet.Expression, -1) 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) if err != nil { @@ -415,7 +423,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str operator, ok := operators[strings.ToLower(tokens[1])] if !ok { // 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] // Special handling for Blanks/NonBlanks. @@ -423,7 +431,7 @@ func (f *File) parseFilterTokens(expression string, tokens []string) ([]int, str if re { // Only allow Equals or NotEqual in this context. 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) // The operator should always be 2 (=) to flag a "simple" equality in diff --git a/templates.go b/templates.go index ef6058c..a619dfc 100644 --- a/templates.go +++ b/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 // based on content. - package excelize // XMLHeader define an XML declaration can also contain a standalone declaration. diff --git a/vmlDrawing.go b/vmlDrawing.go index 307186a..f932372 100644 --- a/vmlDrawing.go +++ b/vmlDrawing.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 import "encoding/xml" diff --git a/xmlChart.go b/xmlChart.go index a263334..8a2cfd8 100644 --- a/xmlChart.go +++ b/xmlChart.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 import "encoding/xml" diff --git a/xmlComments.go b/xmlComments.go index fadc9b3..08d85c1 100644 --- a/xmlComments.go +++ b/xmlComments.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 import "encoding/xml" diff --git a/xmlContentTypes.go b/xmlContentTypes.go index 121c684..6c31bff 100644 --- a/xmlContentTypes.go +++ b/xmlContentTypes.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 import "encoding/xml" diff --git a/xmlDecodeDrawing.go b/xmlDecodeDrawing.go index fff6b9d..c85c490 100644 --- a/xmlDecodeDrawing.go +++ b/xmlDecodeDrawing.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 import "encoding/xml" diff --git a/xmlDrawing.go b/xmlDrawing.go index beb6bc9..ee30a4d 100644 --- a/xmlDrawing.go +++ b/xmlDrawing.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 import "encoding/xml" diff --git a/xmlSharedStrings.go b/xmlSharedStrings.go index c8b54a0..94959c6 100644 --- a/xmlSharedStrings.go +++ b/xmlSharedStrings.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 import "encoding/xml" diff --git a/xmlStyles.go b/xmlStyles.go index 05ff22b..3024c1e 100644 --- a/xmlStyles.go +++ b/xmlStyles.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 import "encoding/xml" diff --git a/xmlTable.go b/xmlTable.go index b238350..53a5af4 100644 --- a/xmlTable.go +++ b/xmlTable.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 import "encoding/xml" diff --git a/xmlTheme.go b/xmlTheme.go index d2ab343..e72e53b 100644 --- a/xmlTheme.go +++ b/xmlTheme.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 import "encoding/xml" diff --git a/xmlWorkbook.go b/xmlWorkbook.go index 816d5a4..d194bac 100644 --- a/xmlWorkbook.go +++ b/xmlWorkbook.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 import "encoding/xml" diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 7cf4994..e298329 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.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 import "encoding/xml" -- cgit v1.2.1 From 4f47737d64fc9d9108675cbc1e73ae93c2d723a9 Mon Sep 17 00:00:00 2001 From: xuri Date: Thu, 13 Sep 2018 10:38:01 +0800 Subject: Complete unit testing case for data validation --- .travis.yml | 1 + datavalidation.go | 17 +++++++++++++---- datavalidation_test.go | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26ca7b2..c2f0f90 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ go: - 1.8.x - 1.9.x - 1.10.x + - 1.11.x os: - linux diff --git a/datavalidation.go b/datavalidation.go index be3caab..c0f006f 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -127,15 +127,24 @@ func (dd *DataValidation) SetRange(f1, f2 int, t DataValidationType, o DataValid return nil } -// SetSqrefDropList data validation list with current sheet cell rang +// SetSqrefDropList provides set data validation on a range with source +// reference range of the worksheet by given data validation object and +// worksheet name. The data validation object can be created by +// NewDataValidation function. For example, set data validation on +// Sheet1!A7:B8 with validation criteria source Sheet1!E1:E3 settings, create +// in-cell dropdown by allowing list source: +// +// dvRange := excelize.NewDataValidation(true) +// dvRange.Sqref = "A7:B8" +// dvRange.SetSqrefDropList("E1:E3", true) +// xlsx.AddDataValidation("Sheet1", dvRange) +// func (dd *DataValidation) SetSqrefDropList(sqref string, isCurrentSheet bool) error { if isCurrentSheet { dd.Formula1 = sqref dd.Type = convDataValidationType(typeList) return nil } - - //isCurrentSheet = false Cross-sheet sqref cell use extLst xml node unrealized return fmt.Errorf("cross-sheet sqref cell are not supported") } @@ -206,7 +215,7 @@ func convDataValidationOperatior(o DataValidationOperator) string { // xlsx.AddDataValidation("Sheet1", dvRange) // // Example 3, set data validation on Sheet1!A5:B6 with validation criteria -// settings, create in-cell dropdown by allow list source: +// settings, create in-cell dropdown by allowing list source: // // dvRange = excelize.NewDataValidation(true) // dvRange.Sqref = "A5:B6" diff --git a/datavalidation_test.go b/datavalidation_test.go index 8134b72..9899334 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -19,6 +19,8 @@ func TestDataValidation(t *testing.T) { dvRange.Sqref = "A1:B2" dvRange.SetRange(10, 20, DataValidationTypeWhole, DataValidationOperatorBetween) dvRange.SetError(DataValidationErrorStyleStop, "error title", "error body") + dvRange.SetError(DataValidationErrorStyleWarning, "error title", "error body") + dvRange.SetError(DataValidationErrorStyleInformation, "error title", "error body") xlsx.AddDataValidation("Sheet1", dvRange) dvRange = NewDataValidation(true) @@ -36,12 +38,20 @@ func TestDataValidation(t *testing.T) { xlsx.SetCellStr("Sheet1", "E2", "E2") xlsx.SetCellStr("Sheet1", "E3", "E3") dvRange = NewDataValidation(true) - dvRange.Sqref = "A7:B8" + dvRange.SetSqref("A7:B8") + dvRange.SetSqref("A7:B8") dvRange.SetSqrefDropList("$E$1:$E$3", true) + err := dvRange.SetSqrefDropList("$E$1:$E$3", false) + t.Log(err) xlsx.AddDataValidation("Sheet1", dvRange) + dvRange = NewDataValidation(true) + dvRange.SetDropList(make([]string, 258)) + err = dvRange.SetRange(10, 20, DataValidationTypeWhole, DataValidationOperatorGreaterThan) + t.Log(err) + // Test write file to given path. - err := xlsx.SaveAs("./test/Book_data_validation.xlsx") + err = xlsx.SaveAs("./test/Book_data_validation.xlsx") if err != nil { t.Error(err) } -- cgit v1.2.1 From 6ced438f39030e8a9a521548d4112dd002dc2ebe Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 14 Sep 2018 00:24:49 +0800 Subject: New function `AddPictureFromBytes()` has been added, this resolve #259 and close #271. --- comment.go | 19 ++++++++++++--- datavalidation_test.go | 4 +--- date_test.go | 54 +++++++++++++++++++++--------------------- excelize_test.go | 25 +++++++++++++++++++- picture.go | 64 ++++++++++++++++++++++++++++++++++++++++---------- sheet.go | 6 +++-- xmlComments.go | 8 +++++++ 7 files changed, 131 insertions(+), 49 deletions(-) diff --git a/comment.go b/comment.go index 32ed02f..94aad6c 100644 --- a/comment.go +++ b/comment.go @@ -29,8 +29,8 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) { // GetComments retrieves 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{} +func (f *File) GetComments() (comments map[string][]Comment) { + comments = map[string][]Comment{} for n := range f.sheetMap { commentID := f.GetSheetIndex(n) commentsXML := "xl/comments" + strconv.Itoa(commentID) + ".xml" @@ -38,7 +38,20 @@ func (f *File) GetComments() (comments map[string]*xlsxComments) { if ok { d := xlsxComments{} xml.Unmarshal([]byte(c), &d) - comments[n] = &d + sheetComments := []Comment{} + for _, comment := range d.CommentList.Comment { + sheetComment := Comment{} + if comment.AuthorID < len(d.Authors) { + sheetComment.Author = d.Authors[comment.AuthorID].Author + } + sheetComment.Ref = comment.Ref + sheetComment.AuthorID = comment.AuthorID + for _, text := range comment.Text.R { + sheetComment.Text += text.T + } + sheetComments = append(sheetComments, sheetComment) + } + comments[n] = sheetComments } } return diff --git a/datavalidation_test.go b/datavalidation_test.go index 9899334..0f50f29 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -8,9 +8,7 @@ // the LICENSE file. package excelize -import ( - "testing" -) +import "testing" func TestDataValidation(t *testing.T) { xlsx := NewFile() diff --git a/date_test.go b/date_test.go index bf071e0..06421b8 100644 --- a/date_test.go +++ b/date_test.go @@ -1,42 +1,42 @@ package excelize import ( - "testing" - "time" + "testing" + "time" ) type dateTest struct { - ExcelValue float64 - GoValue time.Time + ExcelValue float64 + GoValue time.Time } func TestTimeToExcelTime(t *testing.T) { - trueExpectedInputList := []dateTest { - {0.0, time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC)}, - {25569.0, time.Unix(0, 0)}, - {43269.0, time.Date(2018, 6, 18, 0, 0, 0, 0, time.UTC)}, - {401769.0, time.Date(3000, 1, 1, 0, 0, 0, 0, time.UTC)}, - } + trueExpectedInputList := []dateTest{ + {0.0, time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC)}, + {25569.0, time.Unix(0, 0)}, + {43269.0, time.Date(2018, 6, 18, 0, 0, 0, 0, time.UTC)}, + {401769.0, time.Date(3000, 1, 1, 0, 0, 0, 0, time.UTC)}, + } - for _, test := range trueExpectedInputList { - if test.ExcelValue != timeToExcelTime(test.GoValue) { - t.Fatalf("Expected %v from %v = true, got %v\n", test.ExcelValue, test.GoValue, timeToExcelTime(test.GoValue)) - } - } + for _, test := range trueExpectedInputList { + if test.ExcelValue != timeToExcelTime(test.GoValue) { + t.Fatalf("Expected %v from %v = true, got %v\n", test.ExcelValue, test.GoValue, timeToExcelTime(test.GoValue)) + } + } } func TestTimeFromExcelTime(t *testing.T) { - trueExpectedInputList := []dateTest { - {0.0, time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC)}, - {60.0, time.Date(1900, 2, 28, 0, 0, 0, 0, time.UTC)}, - {61.0, time.Date(1900, 3, 1, 0, 0, 0, 0, time.UTC)}, - {41275.0, time.Date(2013, 1, 1, 0, 0, 0, 0, time.UTC)}, - {401769.0, time.Date(3000, 1, 1, 0, 0, 0, 0, time.UTC)}, - } + trueExpectedInputList := []dateTest{ + {0.0, time.Date(1899, 12, 30, 0, 0, 0, 0, time.UTC)}, + {60.0, time.Date(1900, 2, 28, 0, 0, 0, 0, time.UTC)}, + {61.0, time.Date(1900, 3, 1, 0, 0, 0, 0, time.UTC)}, + {41275.0, time.Date(2013, 1, 1, 0, 0, 0, 0, time.UTC)}, + {401769.0, time.Date(3000, 1, 1, 0, 0, 0, 0, time.UTC)}, + } - for _, test := range trueExpectedInputList { - if test.GoValue != timeFromExcelTime(test.ExcelValue, false) { - t.Fatalf("Expected %v from %v = true, got %v\n", test.GoValue, test.ExcelValue, timeFromExcelTime(test.ExcelValue, false)) - } - } + for _, test := range trueExpectedInputList { + if test.GoValue != timeFromExcelTime(test.ExcelValue, false) { + t.Fatalf("Expected %v from %v = true, got %v\n", test.GoValue, test.ExcelValue, timeFromExcelTime(test.ExcelValue, false)) + } + } } diff --git a/excelize_test.go b/excelize_test.go index c9a87d0..9f738f3 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -162,6 +162,24 @@ func TestAddPicture(t *testing.T) { if err != nil { t.Log(err) } + err = xlsx.AddPictureFromBytes("Sheet1", "G21", "", "Excel Logo", "jpg", make([]byte, 1)) + if err != nil { + t.Log(err) + } + // Test add picture to worksheet with invalid file data. + err = xlsx.AddPictureFromBytes("Sheet1", "G21", "", "Excel Logo", ".jpg", make([]byte, 1)) + if err != nil { + t.Log(err) + } + file, err := ioutil.ReadFile("./test/images/excel.jpg") + if err != nil { + t.Error(err) + } + // Test add picture to worksheet from bytes. + err = xlsx.AddPictureFromBytes("Sheet1", "Q1", "", "Excel Logo", ".jpg", file) + if err != nil { + t.Log(err) + } // Test write file to given path. err = xlsx.SaveAs("./test/Book2.xlsx") if err != nil { @@ -211,8 +229,13 @@ func TestNewFile(t *testing.T) { if err != nil { t.Error(err) } - // Test add picture to worksheet with invalid formatset + // Test add picture to worksheet without formatset. err = xlsx.AddPicture("Sheet1", "C2", "./test/images/excel.png", "") + if err != nil { + t.Error(err) + } + // Test add picture to worksheet with invalid formatset. + err = xlsx.AddPicture("Sheet1", "C2", "./test/images/excel.png", `{`) if err != nil { t.Log(err) } diff --git a/picture.go b/picture.go index decc37d..e473498 100644 --- a/picture.go +++ b/picture.go @@ -86,8 +86,6 @@ func parseFormatPictureSet(formatSet string) (*formatPicture, error) { // positioning is move and size with cells. func (f *File) AddPicture(sheet, cell, picture, format string) error { var err error - var drawingHyperlinkRID int - var hyperlinkType string // Check picture exists first. if _, err = os.Stat(picture); os.IsNotExist(err) { return err @@ -96,14 +94,55 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error { if !ok { return errors.New("unsupported image extension") } - readFile, err := os.Open(picture) + file, _ := ioutil.ReadFile(picture) + _, name := filepath.Split(picture) + return f.AddPictureFromBytes(sheet, cell, format, name, ext, file) +} + +// AddPictureFromBytes provides the method to add picture in a sheet by given +// picture format set (such as offset, scale, aspect ratio setting and print +// settings), file base name, extension name and file bytes. For example: +// +// package main +// +// import ( +// "fmt" +// _ "image/jpeg" +// "io/ioutil" +// +// "github.com/360EntSecGroup-Skylar/excelize" +// ) +// +// func main() { +// xlsx := excelize.NewFile() +// +// file, err := ioutil.ReadFile("./image1.jpg") +// if err != nil { +// fmt.Println(err) +// } +// err = xlsx.AddPictureFromBytes("Sheet1", "A2", "", "Excel Logo", ".jpg", file) +// if err != nil { +// fmt.Println(err) +// } +// err = xlsx.SaveAs("./Book1.xlsx") +// if err != nil { +// fmt.Println(err) +// } +// } +// +func (f *File) AddPictureFromBytes(sheet, cell, format, name, extension string, file []byte) error { + var err error + var drawingHyperlinkRID int + var hyperlinkType string + ext, ok := supportImageTypes[extension] + if !ok { + return errors.New("unsupported image extension") + } + formatSet, err := parseFormatPictureSet(format) if err != nil { return err } - defer readFile.Close() - image, _, _ := image.DecodeConfig(readFile) - _, file := filepath.Split(picture) - formatSet, err := parseFormatPictureSet(format) + image, _, err := image.DecodeConfig(bytes.NewReader(file)) if err != nil { return err } @@ -122,8 +161,8 @@ func (f *File) AddPicture(sheet, cell, picture, format string) error { } drawingHyperlinkRID = f.addDrawingRelationships(drawingID, SourceRelationshipHyperLink, formatSet.Hyperlink, hyperlinkType) } - f.addDrawingPicture(sheet, drawingXML, cell, file, image.Width, image.Height, drawingRID, drawingHyperlinkRID, formatSet) - f.addMedia(picture, ext) + f.addDrawingPicture(sheet, drawingXML, cell, name, image.Width, image.Height, drawingRID, drawingHyperlinkRID, formatSet) + f.addMedia(file, ext) f.addContentTypePart(drawingID, "drawings") return err } @@ -317,12 +356,11 @@ func (f *File) countMedia() int { } // addMedia provides a function to add picture into folder xl/media/image by -// given file name and extension name. -func (f *File) addMedia(file, ext string) { +// given file and extension name. +func (f *File) addMedia(file []byte, ext string) { count := f.countMedia() - dat, _ := ioutil.ReadFile(file) media := "xl/media/image" + strconv.Itoa(count+1) + ext - f.XLSX[media] = dat + f.XLSX[media] = file } // setContentTypePartImageExtensions provides a function to set the content diff --git a/sheet.go b/sheet.go index b5c3e6c..ef2b6f4 100644 --- a/sheet.go +++ b/sheet.go @@ -13,6 +13,7 @@ import ( "encoding/json" "encoding/xml" "errors" + "io/ioutil" "os" "path" "strconv" @@ -370,7 +371,7 @@ func (f *File) getSheetMap() map[string]string { } // SetSheetBackground provides a function to set background picture by given -// worksheet name. +// worksheet name and file path. func (f *File) SetSheetBackground(sheet, picture string) error { var err error // Check picture exists first. @@ -384,7 +385,8 @@ func (f *File) SetSheetBackground(sheet, picture string) error { pictureID := f.countMedia() + 1 rID := f.addSheetRelationships(sheet, SourceRelationshipImage, "../media/image"+strconv.Itoa(pictureID)+ext, "") f.addSheetPicture(sheet, rID) - f.addMedia(picture, ext) + file, _ := ioutil.ReadFile(picture) + f.addMedia(file, ext) f.setContentTypePartImageExtensions() return err } diff --git a/xmlComments.go b/xmlComments.go index 08d85c1..1607506 100644 --- a/xmlComments.go +++ b/xmlComments.go @@ -61,3 +61,11 @@ type formatComment struct { Author string `json:"author"` Text string `json:"text"` } + +// Comment directly maps the comment information. +type Comment struct { + Author string `json:"author"` + AuthorID int `json:"author_id"` + Ref string `json:"ref"` + Text string `json:"text"` +} -- cgit v1.2.1 From 2f146c923ccd19c5ecc1f732b5b09d591fb935a3 Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 14 Sep 2018 00:35:47 +0800 Subject: Comments style changed. --- cell.go | 18 ++++++++------ chart.go | 18 ++++++++------ col.go | 18 ++++++++------ comment.go | 18 ++++++++------ datavalidation.go | 18 ++++++++------ datavalidation_test.go | 18 ++++++++------ date.go | 18 ++++++++------ excelize.go | 18 ++++++++------ file.go | 18 ++++++++------ hsl.go | 66 ++++++++++++++++++++++++++------------------------ lib.go | 18 ++++++++------ rows.go | 18 ++++++++------ shape.go | 18 ++++++++------ sheet.go | 18 ++++++++------ sheetpr.go | 18 ++++++++------ sheetview.go | 18 ++++++++------ styles.go | 18 ++++++++------ table.go | 18 ++++++++------ templates.go | 24 +++++++++--------- vmlDrawing.go | 18 ++++++++------ xmlChart.go | 18 ++++++++------ xmlComments.go | 18 ++++++++------ xmlContentTypes.go | 18 ++++++++------ xmlDecodeDrawing.go | 18 ++++++++------ xmlDrawing.go | 18 ++++++++------ xmlSharedStrings.go | 18 ++++++++------ xmlStyles.go | 18 ++++++++------ xmlTable.go | 18 ++++++++------ xmlTheme.go | 18 ++++++++------ xmlWorkbook.go | 18 ++++++++------ xmlWorksheet.go | 18 ++++++++------ 31 files changed, 337 insertions(+), 275 deletions(-) diff --git a/cell.go b/cell.go index e6755d6..69f8697 100644 --- a/cell.go +++ b/cell.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/chart.go b/chart.go index 2047684..4b73c3b 100644 --- a/chart.go +++ b/chart.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/col.go b/col.go index cddb09f..a2d7e69 100644 --- a/col.go +++ b/col.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/comment.go b/comment.go index 94aad6c..241261c 100644 --- a/comment.go +++ b/comment.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/datavalidation.go b/datavalidation.go index c0f006f..6648556 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/datavalidation_test.go b/datavalidation_test.go index 0f50f29..7d10024 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -1,11 +1,13 @@ -// 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 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 import "testing" diff --git a/date.go b/date.go index 56d6ad7..4ef0559 100644 --- a/date.go +++ b/date.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/excelize.go b/excelize.go index 915955c..4f45784 100644 --- a/excelize.go +++ b/excelize.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/file.go b/file.go index 76ef986..350f753 100644 --- a/file.go +++ b/file.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/hsl.go b/hsl.go index fd10b5d..d8fc87d 100644 --- a/hsl.go +++ b/hsl.go @@ -1,35 +1,37 @@ -// 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 (c) 2012 Rodrigo Moraes. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// 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 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 (c) 2012 Rodrigo Moraes. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +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 import ( diff --git a/lib.go b/lib.go index 5be9b16..c4cd95b 100644 --- a/lib.go +++ b/lib.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/rows.go b/rows.go index 8e1e0c3..aa8b2a6 100644 --- a/rows.go +++ b/rows.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/shape.go b/shape.go index 42aefcf..12cb725 100644 --- a/shape.go +++ b/shape.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/sheet.go b/sheet.go index ef2b6f4..a8d5ed7 100644 --- a/sheet.go +++ b/sheet.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/sheetpr.go b/sheetpr.go index a010130..4216cb9 100644 --- a/sheetpr.go +++ b/sheetpr.go @@ -1,11 +1,13 @@ -// 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 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 // SheetPrOption is an option of a view of a worksheet. See SetSheetPrOptions(). diff --git a/sheetview.go b/sheetview.go index 5e756ea..62b35a1 100644 --- a/sheetview.go +++ b/sheetview.go @@ -1,11 +1,13 @@ -// 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 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 import "fmt" diff --git a/styles.go b/styles.go index 80f347e..ba5af3d 100644 --- a/styles.go +++ b/styles.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/table.go b/table.go index fcc4d3c..a7b71ed 100644 --- a/table.go +++ b/table.go @@ -1,11 +1,13 @@ -// 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 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 import ( diff --git a/templates.go b/templates.go index a619dfc..5f62f46 100644 --- a/templates.go +++ b/templates.go @@ -1,14 +1,16 @@ -// 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 -// based on content. +/* +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 +based on content. +*/ package excelize // XMLHeader define an XML declaration can also contain a standalone declaration. diff --git a/vmlDrawing.go b/vmlDrawing.go index f932372..768ca2f 100644 --- a/vmlDrawing.go +++ b/vmlDrawing.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlChart.go b/xmlChart.go index 8a2cfd8..72ad4ce 100644 --- a/xmlChart.go +++ b/xmlChart.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlComments.go b/xmlComments.go index 1607506..f16128d 100644 --- a/xmlComments.go +++ b/xmlComments.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlContentTypes.go b/xmlContentTypes.go index 6c31bff..6abd0e6 100644 --- a/xmlContentTypes.go +++ b/xmlContentTypes.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlDecodeDrawing.go b/xmlDecodeDrawing.go index c85c490..c66176c 100644 --- a/xmlDecodeDrawing.go +++ b/xmlDecodeDrawing.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlDrawing.go b/xmlDrawing.go index ee30a4d..633856a 100644 --- a/xmlDrawing.go +++ b/xmlDrawing.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlSharedStrings.go b/xmlSharedStrings.go index 94959c6..1f31f99 100644 --- a/xmlSharedStrings.go +++ b/xmlSharedStrings.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlStyles.go b/xmlStyles.go index 3024c1e..5b3c9e0 100644 --- a/xmlStyles.go +++ b/xmlStyles.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlTable.go b/xmlTable.go index 53a5af4..3949d49 100644 --- a/xmlTable.go +++ b/xmlTable.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlTheme.go b/xmlTheme.go index e72e53b..b9dd2bb 100644 --- a/xmlTheme.go +++ b/xmlTheme.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlWorkbook.go b/xmlWorkbook.go index d194bac..ca17d03 100644 --- a/xmlWorkbook.go +++ b/xmlWorkbook.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" diff --git a/xmlWorksheet.go b/xmlWorksheet.go index e298329..c481a6d 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -1,11 +1,13 @@ -// 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 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 import "encoding/xml" -- cgit v1.2.1 From 13a9769cc5bde486c52d8e45661ff8108cd786ae Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 14 Sep 2018 00:44:23 +0800 Subject: Comments style changed. --- cell.go | 18 ++++++-------- chart.go | 18 ++++++-------- col.go | 18 ++++++-------- comment.go | 18 ++++++-------- datavalidation.go | 18 ++++++-------- datavalidation_test.go | 18 ++++++-------- date.go | 18 ++++++-------- excelize.go | 18 ++++++-------- file.go | 18 ++++++-------- hsl.go | 66 ++++++++++++++++++++++++-------------------------- lib.go | 18 ++++++-------- picture.go | 8 +++--- rows.go | 18 ++++++-------- shape.go | 18 ++++++-------- sheet.go | 18 ++++++-------- sheetpr.go | 18 ++++++-------- sheetview.go | 18 ++++++-------- styles.go | 18 ++++++-------- table.go | 18 ++++++-------- templates.go | 24 +++++++++--------- vmlDrawing.go | 18 ++++++-------- xmlChart.go | 18 ++++++-------- xmlComments.go | 18 ++++++-------- xmlContentTypes.go | 18 ++++++-------- xmlDecodeDrawing.go | 18 ++++++-------- xmlDrawing.go | 18 ++++++-------- xmlSharedStrings.go | 18 ++++++-------- xmlStyles.go | 18 ++++++-------- xmlTable.go | 18 ++++++-------- xmlTheme.go | 18 ++++++-------- xmlWorkbook.go | 18 ++++++-------- xmlWorksheet.go | 18 ++++++-------- 32 files changed, 279 insertions(+), 341 deletions(-) diff --git a/cell.go b/cell.go index 69f8697..e1bb91d 100644 --- a/cell.go +++ b/cell.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/chart.go b/chart.go index 4b73c3b..a84e0f6 100644 --- a/chart.go +++ b/chart.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/col.go b/col.go index a2d7e69..c7ab9e3 100644 --- a/col.go +++ b/col.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/comment.go b/comment.go index 241261c..c87e08c 100644 --- a/comment.go +++ b/comment.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/datavalidation.go b/datavalidation.go index 6648556..69f67b1 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/datavalidation_test.go b/datavalidation_test.go index 7d10024..b9c51ad 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "testing" diff --git a/date.go b/date.go index 4ef0559..c67c3a1 100644 --- a/date.go +++ b/date.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/excelize.go b/excelize.go index 4f45784..93596d8 100644 --- a/excelize.go +++ b/excelize.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/file.go b/file.go index 350f753..582228f 100644 --- a/file.go +++ b/file.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/hsl.go b/hsl.go index d8fc87d..77946ac 100644 --- a/hsl.go +++ b/hsl.go @@ -1,37 +1,35 @@ -/* -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 (c) 2012 Rodrigo Moraes. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -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. -*/ +// Copyright (c) 2012 Rodrigo Moraes. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// 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 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. package excelize import ( diff --git a/lib.go b/lib.go index c4cd95b..1493039 100644 --- a/lib.go +++ b/lib.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/picture.go b/picture.go index e473498..16b428f 100644 --- a/picture.go +++ b/picture.go @@ -1,11 +1,11 @@ +// 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 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 import ( diff --git a/rows.go b/rows.go index aa8b2a6..84dc6d8 100644 --- a/rows.go +++ b/rows.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/shape.go b/shape.go index 12cb725..dcdf6d9 100644 --- a/shape.go +++ b/shape.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/sheet.go b/sheet.go index a8d5ed7..97bb9b2 100644 --- a/sheet.go +++ b/sheet.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/sheetpr.go b/sheetpr.go index 4216cb9..6f77f6f 100644 --- a/sheetpr.go +++ b/sheetpr.go @@ -1,13 +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. -*/ +// 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 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. package excelize // SheetPrOption is an option of a view of a worksheet. See SetSheetPrOptions(). diff --git a/sheetview.go b/sheetview.go index 62b35a1..b3ef477 100644 --- a/sheetview.go +++ b/sheetview.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "fmt" diff --git a/styles.go b/styles.go index ba5af3d..e9da3b3 100644 --- a/styles.go +++ b/styles.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/table.go b/table.go index a7b71ed..e5d8785 100644 --- a/table.go +++ b/table.go @@ -1,13 +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. -*/ +// 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 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. package excelize import ( diff --git a/templates.go b/templates.go index 5f62f46..f648fc8 100644 --- a/templates.go +++ b/templates.go @@ -1,16 +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 -based on content. -*/ +// 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 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. +// +// This file contains default templates for XML files we don't yet populated +// based on content. package excelize // XMLHeader define an XML declaration can also contain a standalone declaration. diff --git a/vmlDrawing.go b/vmlDrawing.go index 768ca2f..305a689 100644 --- a/vmlDrawing.go +++ b/vmlDrawing.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlChart.go b/xmlChart.go index 72ad4ce..9dcec1e 100644 --- a/xmlChart.go +++ b/xmlChart.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlComments.go b/xmlComments.go index f16128d..b3cb575 100644 --- a/xmlComments.go +++ b/xmlComments.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlContentTypes.go b/xmlContentTypes.go index 6abd0e6..efbca78 100644 --- a/xmlContentTypes.go +++ b/xmlContentTypes.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlDecodeDrawing.go b/xmlDecodeDrawing.go index c66176c..8051140 100644 --- a/xmlDecodeDrawing.go +++ b/xmlDecodeDrawing.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlDrawing.go b/xmlDrawing.go index 633856a..e71932b 100644 --- a/xmlDrawing.go +++ b/xmlDrawing.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlSharedStrings.go b/xmlSharedStrings.go index 1f31f99..9fc8579 100644 --- a/xmlSharedStrings.go +++ b/xmlSharedStrings.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlStyles.go b/xmlStyles.go index 5b3c9e0..67785ed 100644 --- a/xmlStyles.go +++ b/xmlStyles.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlTable.go b/xmlTable.go index 3949d49..a5d8673 100644 --- a/xmlTable.go +++ b/xmlTable.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlTheme.go b/xmlTheme.go index b9dd2bb..146ca3a 100644 --- a/xmlTheme.go +++ b/xmlTheme.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlWorkbook.go b/xmlWorkbook.go index ca17d03..2e3ab47 100644 --- a/xmlWorkbook.go +++ b/xmlWorkbook.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" diff --git a/xmlWorksheet.go b/xmlWorksheet.go index c481a6d..8868cec 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -1,13 +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. -*/ +// 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 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. package excelize import "encoding/xml" -- cgit v1.2.1 From 3e004d900b103379c2d62657a3070de4a2e8585a Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 14 Sep 2018 00:58:48 +0800 Subject: Comments style changed. --- cell.go | 1 + chart.go | 1 + col.go | 1 + comment.go | 1 + datavalidation.go | 1 + datavalidation_test.go | 1 + date.go | 1 + excelize.go | 2 ++ file.go | 1 + hsl.go | 6 +----- lib.go | 1 + picture.go | 1 + rows.go | 1 + shape.go | 1 + sheet.go | 1 + sheetpr.go | 1 + sheetview.go | 1 + styles.go | 1 + table.go | 1 + templates.go | 1 + vmlDrawing.go | 1 + xmlChart.go | 1 + xmlComments.go | 1 + xmlContentTypes.go | 1 + xmlDecodeDrawing.go | 1 + xmlDrawing.go | 1 + xmlSharedStrings.go | 1 + xmlStyles.go | 1 + xmlTable.go | 1 + xmlTheme.go | 1 + xmlWorkbook.go | 1 + xmlWorksheet.go | 1 + 32 files changed, 33 insertions(+), 5 deletions(-) diff --git a/cell.go b/cell.go index e1bb91d..1277a18 100644 --- a/cell.go +++ b/cell.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/chart.go b/chart.go index a84e0f6..5353a32 100644 --- a/chart.go +++ b/chart.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/col.go b/col.go index c7ab9e3..32cda12 100644 --- a/col.go +++ b/col.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/comment.go b/comment.go index c87e08c..2bfd785 100644 --- a/comment.go +++ b/comment.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/datavalidation.go b/datavalidation.go index 69f67b1..5ebd61f 100644 --- a/datavalidation.go +++ b/datavalidation.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/datavalidation_test.go b/datavalidation_test.go index b9c51ad..39dd229 100644 --- a/datavalidation_test.go +++ b/datavalidation_test.go @@ -6,6 +6,7 @@ // 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. + package excelize import "testing" diff --git a/date.go b/date.go index c67c3a1..45f3040 100644 --- a/date.go +++ b/date.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/excelize.go b/excelize.go index 93596d8..d1f0b7f 100644 --- a/excelize.go +++ b/excelize.go @@ -6,6 +6,8 @@ // 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. +// +// See https://xuri.me/excelize for more information about this package. package excelize import ( diff --git a/file.go b/file.go index 582228f..5bfed39 100644 --- a/file.go +++ b/file.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/hsl.go b/hsl.go index 77946ac..c30c165 100644 --- a/hsl.go +++ b/hsl.go @@ -25,11 +25,7 @@ // 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 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. + package excelize import ( diff --git a/lib.go b/lib.go index 1493039..865ee29 100644 --- a/lib.go +++ b/lib.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/picture.go b/picture.go index 16b428f..8785aaf 100644 --- a/picture.go +++ b/picture.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/rows.go b/rows.go index 84dc6d8..5c384c8 100644 --- a/rows.go +++ b/rows.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/shape.go b/shape.go index dcdf6d9..ad87712 100644 --- a/shape.go +++ b/shape.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/sheet.go b/sheet.go index 97bb9b2..b615ae5 100644 --- a/sheet.go +++ b/sheet.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/sheetpr.go b/sheetpr.go index 6f77f6f..e38b64e 100644 --- a/sheetpr.go +++ b/sheetpr.go @@ -6,6 +6,7 @@ // 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. + package excelize // SheetPrOption is an option of a view of a worksheet. See SetSheetPrOptions(). diff --git a/sheetview.go b/sheetview.go index b3ef477..e76325c 100644 --- a/sheetview.go +++ b/sheetview.go @@ -6,6 +6,7 @@ // 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. + package excelize import "fmt" diff --git a/styles.go b/styles.go index e9da3b3..513fc9b 100644 --- a/styles.go +++ b/styles.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/table.go b/table.go index e5d8785..02c89fa 100644 --- a/table.go +++ b/table.go @@ -6,6 +6,7 @@ // 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. + package excelize import ( diff --git a/templates.go b/templates.go index f648fc8..1d0655d 100644 --- a/templates.go +++ b/templates.go @@ -9,6 +9,7 @@ // // This file contains default templates for XML files we don't yet populated // based on content. + package excelize // XMLHeader define an XML declaration can also contain a standalone declaration. diff --git a/vmlDrawing.go b/vmlDrawing.go index 305a689..c17dde7 100644 --- a/vmlDrawing.go +++ b/vmlDrawing.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlChart.go b/xmlChart.go index 9dcec1e..78218a0 100644 --- a/xmlChart.go +++ b/xmlChart.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlComments.go b/xmlComments.go index b3cb575..9075c88 100644 --- a/xmlComments.go +++ b/xmlComments.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlContentTypes.go b/xmlContentTypes.go index efbca78..8d09d51 100644 --- a/xmlContentTypes.go +++ b/xmlContentTypes.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlDecodeDrawing.go b/xmlDecodeDrawing.go index 8051140..d21c3f0 100644 --- a/xmlDecodeDrawing.go +++ b/xmlDecodeDrawing.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlDrawing.go b/xmlDrawing.go index e71932b..6ba7d31 100644 --- a/xmlDrawing.go +++ b/xmlDrawing.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlSharedStrings.go b/xmlSharedStrings.go index 9fc8579..782ed61 100644 --- a/xmlSharedStrings.go +++ b/xmlSharedStrings.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlStyles.go b/xmlStyles.go index 67785ed..7ba4379 100644 --- a/xmlStyles.go +++ b/xmlStyles.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlTable.go b/xmlTable.go index a5d8673..7e155e6 100644 --- a/xmlTable.go +++ b/xmlTable.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlTheme.go b/xmlTheme.go index 146ca3a..b4140b6 100644 --- a/xmlTheme.go +++ b/xmlTheme.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlWorkbook.go b/xmlWorkbook.go index 2e3ab47..f00a0b8 100644 --- a/xmlWorkbook.go +++ b/xmlWorkbook.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 8868cec..072ecce 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -6,6 +6,7 @@ // 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. + package excelize import "encoding/xml" -- cgit v1.2.1