summaryrefslogtreecommitdiff
path: root/sheet.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2020-07-09 01:24:11 +0800
committerxuri <xuri.me@gmail.com>2020-07-09 01:24:11 +0800
commit49257c5918f3aa9f2730021a7e6a24b4835646fd (patch)
tree5b7e0b016bb008fd5680d19b59b05ab722a8d17b /sheet.go
parentf7bd0729c65fc82305328f7ac8fbaf329d1075c0 (diff)
support case-sensitive doc parts to improve compatibility
Diffstat (limited to 'sheet.go')
-rw-r--r--sheet.go33
1 files changed, 17 insertions, 16 deletions
diff --git a/sheet.go b/sheet.go
index 56dac27..bbe84c2 100644
--- a/sheet.go
+++ b/sheet.go
@@ -32,8 +32,9 @@ import (
)
// NewSheet provides function to create a new sheet by given worksheet name.
-// When creating a new XLSX file, the default sheet will be created. Returns
-// the number of sheets in the workbook (file) after appending the new sheet.
+// When creating a new spreadsheet file, the default worksheet will be
+// created. Returns the number of sheets in the workbook (file) after
+// appending the new sheet.
func (f *File) NewSheet(name string) int {
// Check if the worksheet already exists
if f.GetSheetIndex(name) != -1 {
@@ -152,7 +153,7 @@ func trimCell(column []xlsxC) []xlsxC {
}
// setContentTypes provides a function to read and update property of contents
-// type of XLSX.
+// type of the spreadsheet.
func (f *File) setContentTypes(partName, contentType string) {
content := f.contentTypesReader()
content.Overrides = append(content.Overrides, xlsxOverride{
@@ -174,8 +175,8 @@ func (f *File) setSheet(index int, name string) {
f.Sheet[path] = &xlsx
}
-// setWorkbook update workbook property of XLSX. Maximum 31 characters are
-// allowed in sheet title.
+// setWorkbook update workbook property of the spreadsheet. Maximum 31
+// characters are allowed in sheet title.
func (f *File) setWorkbook(name string, sheetID, rid int) {
content := f.workbookReader()
content.Sheets.Sheet = append(content.Sheets.Sheet, xlsxSheet{
@@ -204,9 +205,9 @@ func (f *File) setAppXML() {
f.saveFileList("docProps/app.xml", []byte(templateDocpropsApp))
}
-// replaceRelationshipsBytes; Some tools that read XLSX files have very strict
-// requirements about the structure of the input XML. This function is a
-// horrible hack to fix that after the XML marshalling is completed.
+// replaceRelationshipsBytes; Some tools that read spreadsheet files have very
+// strict requirements about the structure of the input XML. This function is
+// a horrible hack to fix that after the XML marshalling is completed.
func replaceRelationshipsBytes(content []byte) []byte {
oldXmlns := stringToBytes(`xmlns:relationships="http://schemas.openxmlformats.org/officeDocument/2006/relationships" relationships`)
newXmlns := stringToBytes("r")
@@ -263,7 +264,7 @@ func (f *File) SetActiveSheet(index int) {
}
// GetActiveSheetIndex provides a function to get active sheet index of the
-// XLSX. If not found the active sheet will be return integer 0.
+// spreadsheet. If not found the active sheet will be return integer 0.
func (f *File) GetActiveSheetIndex() (index int) {
var sheetID = f.getActiveSheetID()
wb := f.workbookReader()
@@ -278,7 +279,7 @@ func (f *File) GetActiveSheetIndex() (index int) {
}
// getActiveSheetID provides a function to get active sheet index of the
-// XLSX. If not found the active sheet will be return integer 0.
+// spreadsheet. If not found the active sheet will be return integer 0.
func (f *File) getActiveSheetID() int {
wb := f.workbookReader()
if wb != nil {
@@ -313,9 +314,9 @@ func (f *File) SetSheetName(oldName, newName string) {
}
}
-// getSheetNameByID provides a function to get worksheet name of XLSX by given
-// worksheet ID. If given sheet ID is invalid, will return an empty
-// string.
+// getSheetNameByID provides a function to get worksheet name of the
+// spreadsheet by given worksheet ID. If given sheet ID is invalid, will
+// return an empty string.
func (f *File) getSheetNameByID(ID int) string {
wb := f.workbookReader()
if wb == nil || ID < 1 {
@@ -341,9 +342,9 @@ func (f *File) GetSheetName(index int) (name string) {
return
}
-// getSheetID provides a function to get worksheet ID of XLSX by given
-// sheet name. If given worksheet name is invalid, will return an integer type
-// value -1.
+// getSheetID provides a function to get worksheet ID of the spreadsheet by
+// given sheet name. If given worksheet name is invalid, will return an
+// integer type value -1.
func (f *File) getSheetID(name string) int {
var ID = -1
for sheetID, sheet := range f.GetSheetMap() {