diff options
Diffstat (limited to 'excelize.go')
-rw-r--r-- | excelize.go | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/excelize.go b/excelize.go index 0972e96..d1f0b7f 100644 --- a/excelize.go +++ b/excelize.go @@ -1,3 +1,13 @@ +// 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. +// +// See https://xuri.me/excelize for more information about this package. package excelize import ( @@ -21,6 +31,7 @@ type File struct { Sheet map[string]*xlsxWorksheet SheetCount int Styles *xlsxStyleSheet + Theme *xlsxTheme WorkBook *xlsxWorkbook WorkBookRels *xlsxWorkbookRels XLSX map[string][]byte @@ -66,10 +77,11 @@ func OpenReader(r io.Reader) (*File, error) { } f.sheetMap = f.getSheetMap() f.Styles = f.stylesReader() + f.Theme = f.themeReader() 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) { @@ -79,8 +91,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 { @@ -103,7 +115,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) @@ -131,7 +143,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 { @@ -180,7 +192,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. // @@ -202,7 +214,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 { @@ -218,8 +230,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 @@ -238,7 +250,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) @@ -278,8 +290,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 { @@ -319,8 +331,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) @@ -340,8 +352,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) @@ -374,7 +386,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 { |