Merge pull request #233 from sewi-cpan/master

Update documentation and add sample file
This commit is contained in:
xuri 2018-09-27 23:40:33 +08:00 committed by GitHub
commit f0234e6c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -24,9 +24,9 @@ import (
"github.com/mohae/deepcopy" "github.com/mohae/deepcopy"
) )
// NewSheet provides a function to create a new sheet by given worksheet name, // NewSheet provides function to create a new sheet by given worksheet name.
// when creating a new XLSX file, the default sheet will be create, when you // When creating a new XLSX file, the default sheet will be created. Returns
// create a new file. // the number of sheets in the workbook (file) after appending the new sheet.
func (f *File) NewSheet(name string) int { func (f *File) NewSheet(name string) int {
// Check if the worksheet already exists // Check if the worksheet already exists
if f.GetSheetIndex(name) != 0 { if f.GetSheetIndex(name) != 0 {
@ -221,9 +221,9 @@ func replaceRelationshipsNameSpaceBytes(workbookMarshal []byte) []byte {
return bytes.Replace(workbookMarshal, oldXmlns, newXmlns, -1) return bytes.Replace(workbookMarshal, oldXmlns, newXmlns, -1)
} }
// SetActiveSheet provides a function to set default active worksheet of XLSX by // SetActiveSheet provides function to set default active worksheet of XLSX by
// given index. Note that active index is different with the index that got by // given index. Note that active index is different from the index returned by
// function GetSheetMap, and it should be greater than 0 and less than total // function GetSheetMap(). It should be greater than 0 and less than total
// worksheet numbers. // worksheet numbers.
func (f *File) SetActiveSheet(index int) { func (f *File) SetActiveSheet(index int) {
if index < 1 { if index < 1 {
@ -257,8 +257,8 @@ func (f *File) SetActiveSheet(index int) {
} }
} }
// GetActiveSheetIndex provides a function to get active sheet of XLSX. If not // GetActiveSheetIndex provides a function to get active sheet index of the
// found the active sheet will be return integer 0. // XLSX. If not found the active sheet will be return integer 0.
func (f *File) GetActiveSheetIndex() int { func (f *File) GetActiveSheetIndex() int {
buffer := bytes.Buffer{} buffer := bytes.Buffer{}
content := f.workbookReader() content := f.workbookReader()