Skip to content

Commit 75abc62

Browse files
committedOct 19, 2016
Update godoc of package.
1 parent e28de17 commit 75abc62

10 files changed

+29
-29
lines changed
 

‎cell.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
)
88

9-
// GetCellValue provide function get value from cell by given sheet index and axis in XLSX file
9+
// GetCellValue provide function get value from cell by given sheet index and axis in XLSX file.
1010
func (f *File) GetCellValue(sheet string, axis string) string {
1111
axis = strings.ToUpper(axis)
1212
var xlsx xlsxWorksheet

‎excelize.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func OpenFile(filename string) (*File, error) {
3434
}, nil
3535
}
3636

37-
// SetCellValue provide function to set int or string type value of a cell
37+
// SetCellValue provide function to set int or string type value of a cell.
3838
func (f *File) SetCellValue(sheet string, axis string, value interface{}) {
3939
switch t := value.(type) {
4040
case int, int8, int16, int32, int64, float32, float64:
@@ -48,7 +48,7 @@ func (f *File) SetCellValue(sheet string, axis string, value interface{}) {
4848
}
4949
}
5050

51-
// SetCellInt provide function to set int type value of a cell
51+
// SetCellInt provide function to set int type value of a cell.
5252
func (f *File) SetCellInt(sheet string, axis string, value int) {
5353
axis = strings.ToUpper(axis)
5454
var xlsx xlsxWorksheet
@@ -73,7 +73,7 @@ func (f *File) SetCellInt(sheet string, axis string, value int) {
7373
f.saveFileList(name, replaceRelationshipsID(replaceWorkSheetsRelationshipsNameSpace(string(output))))
7474
}
7575

76-
// SetCellStr provide function to set string type value of a cell
76+
// SetCellStr provide function to set string type value of a cell.
7777
func (f *File) SetCellStr(sheet string, axis string, value string) {
7878
axis = strings.ToUpper(axis)
7979
var xlsx xlsxWorksheet
@@ -98,7 +98,7 @@ func (f *File) SetCellStr(sheet string, axis string, value string) {
9898
f.saveFileList(name, replaceRelationshipsID(replaceWorkSheetsRelationshipsNameSpace(string(output))))
9999
}
100100

101-
// Completion column element tags of XML in a sheet
101+
// Completion column element tags of XML in a sheet.
102102
func completeCol(xlsx xlsxWorksheet, row int, cell int) xlsxWorksheet {
103103
if len(xlsx.SheetData.Row) < cell {
104104
for i := len(xlsx.SheetData.Row); i < cell; i++ {
@@ -124,7 +124,7 @@ func completeCol(xlsx xlsxWorksheet, row int, cell int) xlsxWorksheet {
124124
return xlsx
125125
}
126126

127-
// Completion row element tags of XML in a sheet
127+
// Completion row element tags of XML in a sheet.
128128
func completeRow(xlsx xlsxWorksheet, row int, cell int) xlsxWorksheet {
129129
if len(xlsx.SheetData.Row) < row {
130130
for i := len(xlsx.SheetData.Row); i < row; i++ {
@@ -150,7 +150,7 @@ func completeRow(xlsx xlsxWorksheet, row int, cell int) xlsxWorksheet {
150150
return xlsx
151151
}
152152

153-
// Replace xl/worksheets/sheet%d.xml XML tags to self-closing for compatible Office Excel 2007
153+
// Replace xl/worksheets/sheet%d.xml XML tags to self-closing for compatible Office Excel 2007.
154154
func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
155155
oldXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
156156
newXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">`

‎file.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
)
88

9-
// CreateFile provide function to create new file by default template
9+
// CreateFile provide function to create new file by default template.
1010
// For example:
1111
// xlsx := CreateFile()
1212
func CreateFile() *File {

‎lib.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ func ReadZipReader(r *zip.Reader) (map[string]string, int, error) {
3939
return fileList, worksheets, nil
4040
}
4141

42-
// Read XML content as string and replace drawing property in XML namespace of sheet
42+
// Read XML content as string and replace drawing property in XML namespace of sheet.
4343
func (f *File) readXML(name string) string {
4444
if content, ok := f.XLSX[name]; ok {
4545
return strings.Replace(content, `<drawing r:id=`, `<drawing rid=`, -1)
4646
}
4747
return ``
4848
}
4949

50-
// Update given file content in file list of XLSX
50+
// Update given file content in file list of XLSX.
5151
func (f *File) saveFileList(name string, content string) {
5252
f.XLSX[name] = XMLHeader + content
5353
}
5454

55-
// Read file content as string in a archive file
55+
// Read file content as string in a archive file.
5656
func readFile(file *zip.File) string {
5757
rc, err := file.Open()
5858
if err != nil {
@@ -64,7 +64,7 @@ func readFile(file *zip.File) string {
6464
return string(buff.Bytes())
6565
}
6666

67-
// Convert integer to Excel sheet column title
67+
// Convert integer to Excel sheet column title.
6868
func toAlphaString(value int) string {
6969
if value < 0 {
7070
return ``
@@ -78,7 +78,7 @@ func toAlphaString(value int) string {
7878
return ans
7979
}
8080

81-
// Convert Excel sheet column title to int
81+
// Convert Excel sheet column title to int.
8282
func titleToNumber(s string) int {
8383
weight := 0.0
8484
sum := 0
@@ -90,7 +90,7 @@ func titleToNumber(s string) int {
9090
}
9191

9292
// letterOnlyMapF is used in conjunction with strings.Map to return
93-
// only the characters A-Z and a-z in a string
93+
// only the characters A-Z and a-z in a string.
9494
func letterOnlyMapF(rune rune) rune {
9595
switch {
9696
case 'A' <= rune && rune <= 'Z':

‎sheet.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (f *File) NewSheet(index int, name string) {
2424
f.setWorkbook(index, name)
2525
}
2626

27-
// Read and update property of contents type of XLSX
27+
// Read and update property of contents type of XLSX.
2828
func (f *File) setContentTypes(index int) {
2929
var content xlsxTypes
3030
xml.Unmarshal([]byte(f.readXML(`[Content_Types].xml`)), &content)
@@ -39,7 +39,7 @@ func (f *File) setContentTypes(index int) {
3939
f.saveFileList(`[Content_Types].xml`, string(output))
4040
}
4141

42-
// Update sheet property by given index
42+
// Update sheet property by given index.
4343
func (f *File) setSheet(index int) {
4444
var xlsx xlsxWorksheet
4545
xlsx.Dimension.Ref = "A1"
@@ -54,7 +54,7 @@ func (f *File) setSheet(index int) {
5454
f.saveFileList(path, replaceRelationshipsID(replaceWorkSheetsRelationshipsNameSpace(string(output))))
5555
}
5656

57-
// Update workbook property of XLSX
57+
// Update workbook property of XLSX.
5858
func (f *File) setWorkbook(index int, name string) {
5959
var content xlsxWorkbook
6060
xml.Unmarshal([]byte(f.readXML(`xl/workbook.xml`)), &content)
@@ -73,14 +73,14 @@ func (f *File) setWorkbook(index int, name string) {
7373
f.saveFileList(`xl/workbook.xml`, replaceRelationshipsNameSpace(string(output)))
7474
}
7575

76-
// Read and unmarshal workbook relationships of XLSX
76+
// Read and unmarshal workbook relationships of XLSX.
7777
func (f *File) readXlsxWorkbookRels() xlsxWorkbookRels {
7878
var content xlsxWorkbookRels
7979
xml.Unmarshal([]byte(f.readXML(`xl/_rels/workbook.xml.rels`)), &content)
8080
return content
8181
}
8282

83-
// Update workbook relationships property of XLSX
83+
// Update workbook relationships property of XLSX.
8484
func (f *File) addXlsxWorkbookRels(sheet int) {
8585
content := f.readXlsxWorkbookRels()
8686
rID := len(content.Relationships) + 1
@@ -103,7 +103,7 @@ func (f *File) addXlsxWorkbookRels(sheet int) {
103103
f.saveFileList(`xl/_rels/workbook.xml.rels`, string(output))
104104
}
105105

106-
// Update docProps/app.xml file of XML
106+
// Update docProps/app.xml file of XML.
107107
func (f *File) setAppXML() {
108108
f.saveFileList(`docProps/app.xml`, templateDocpropsApp)
109109
}
@@ -132,7 +132,7 @@ func replaceRelationshipsID(workbookMarshal string) string {
132132
return strings.Replace(rids, `<drawing rid="`, `<drawing r:id="`, -1)
133133
}
134134

135-
// SetActiveSheet provide function to set default active sheet of XLSX by given index
135+
// SetActiveSheet provide function to set default active sheet of XLSX by given index.
136136
func (f *File) SetActiveSheet(index int) {
137137
var content xlsxWorkbook
138138
if index < 1 {
@@ -185,7 +185,7 @@ func (f *File) SetActiveSheet(index int) {
185185
return
186186
}
187187

188-
// Replace xl/workbook.xml XML tags to self-closing for compatible Office Excel 2007
188+
// Replace xl/workbook.xml XML tags to self-closing for compatible Office Excel 2007.
189189
func workBookCompatibility(workbookMarshal string) string {
190190
workbookMarshal = strings.Replace(workbookMarshal, `xmlns:relationships="http://schemas.openxmlformats.org/officeDocument/2006/relationships" relationships:id="`, `r:id="`, -1)
191191
workbookMarshal = strings.Replace(workbookMarshal, `></sheet>`, ` />`, -1)

‎templates.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
package excelize
55

6-
// XMLHeader define an XML declaration can also contain a standalone declaration
6+
// XMLHeader define an XML declaration can also contain a standalone declaration.
77
const XMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
88

99
const templateDocpropsApp = `<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">

‎xmlContentTypes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Some code of this file reference tealeg/xlsx
1+
// Some code of this file reference tealeg/xlsx.
22

33
package excelize
44

‎xmlSharedStrings.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Some code of this file reference tealeg/xlsx
1+
// Some code of this file reference tealeg/xlsx.
22

33
package excelize
44

‎xmlWorkbook.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Some code of this file reference tealeg/xlsx
1+
// Some code of this file reference tealeg/xlsx.
22

33
package excelize
44

@@ -44,7 +44,7 @@ type xlsxWorkbook struct {
4444
FileRecoveryPr xlsxFileRecoveryPr `xml:"fileRecoveryPr"`
4545
}
4646

47-
// xlsxFileRecoveryPr maps sheet recovery information
47+
// xlsxFileRecoveryPr maps sheet recovery information.
4848
type xlsxFileRecoveryPr struct {
4949
RepairLoad int `xml:"repairLoad,attr"`
5050
}

‎xmlWorksheet.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Some code of this file reference tealeg/xlsx
1+
// Some code of this file reference tealeg/xlsx.
22

33
package excelize
44

@@ -26,7 +26,7 @@ type xlsxWorksheet struct {
2626
Drawing xlsxDrawing `xml:"drawing"`
2727
}
2828

29-
// xlsxDrawing change r:id to rid in the namespace
29+
// xlsxDrawing change r:id to rid in the namespace.
3030
type xlsxDrawing struct {
3131
RID string `xml:"rid,attr"`
3232
}

0 commit comments

Comments
 (0)
Please sign in to comment.