Typo fixed and godoc updated

This commit is contained in:
xuri 2019-03-20 15:13:41 +08:00
parent dc01264562
commit beff7b4f3c
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
9 changed files with 37 additions and 25 deletions

View File

@ -24,7 +24,7 @@ which take place in some methods in eraler versions.
### Installation ### Installation
```go ```bash
go get github.com/360EntSecGroup-Skylar/excelize go get github.com/360EntSecGroup-Skylar/excelize
``` ```

View File

@ -23,7 +23,7 @@ Excelize 是 Go 语言编写的用于操作 Office Excel 文档类库,基于 E
### 安装 ### 安装
```go ```bash
go get github.com/360EntSecGroup-Skylar/excelize go get github.com/360EntSecGroup-Skylar/excelize
``` ```

View File

@ -1,8 +1,15 @@
// Copyright 2016 - 2019 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 package excelize
import ( import "strings"
"strings"
)
type adjustDirection bool type adjustDirection bool

4
col.go
View File

@ -9,9 +9,7 @@
package excelize package excelize
import ( import "math"
"math"
)
// Define the default cell size and EMU unit of measurement. // Define the default cell size and EMU unit of measurement.
const ( const (

View File

@ -1,8 +1,15 @@
// Copyright 2016 - 2019 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 package excelize
import ( import "fmt"
"fmt"
)
func newInvalidColumnNameError(col string) error { func newInvalidColumnNameError(col string) error {
return fmt.Errorf("invalid column name %q", col) return fmt.Errorf("invalid column name %q", col)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 27 KiB

2
lib.go
View File

@ -156,7 +156,7 @@ func MustColumnNameToNumber(name string) int {
// //
// Example: // Example:
// //
// excelize.ToAlphaString(37) // returns "AK", nil // excelize.ColumnNumberToName(37) // returns "AK", nil
// //
func ColumnNumberToName(num int) (string, error) { func ColumnNumberToName(num int) (string, error) {
if num < 1 { if num < 1 {

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

26
rows.go
View File

@ -208,7 +208,7 @@ func (f *File) getTotalRowsCols(name string) (int, int) {
// //
func (f *File) SetRowHeight(sheet string, row int, height float64) { func (f *File) SetRowHeight(sheet string, row int, height float64) {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)
@ -240,7 +240,7 @@ func (f *File) getRowHeight(sheet string, row int) int {
// //
func (f *File) GetRowHeight(sheet string, row int) float64 { func (f *File) GetRowHeight(sheet string, row int) float64 {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)
@ -303,7 +303,7 @@ func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) {
// //
func (f *File) SetRowVisible(sheet string, row int, visible bool) { func (f *File) SetRowVisible(sheet string, row int, visible bool) {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)
@ -319,7 +319,7 @@ func (f *File) SetRowVisible(sheet string, row int, visible bool) {
// //
func (f *File) GetRowVisible(sheet string, row int) bool { func (f *File) GetRowVisible(sheet string, row int) bool {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)
@ -330,14 +330,14 @@ func (f *File) GetRowVisible(sheet string, row int) bool {
} }
// SetRowOutlineLevel provides a function to set outline level number of a // SetRowOutlineLevel provides a function to set outline level number of a
// single row by given worksheet name and Excel row number. For example, outline row // single row by given worksheet name and Excel row number. For example,
// 2 in Sheet1 to level 1: // outline row 2 in Sheet1 to level 1:
// //
// xlsx.SetRowOutlineLevel("Sheet1", 2, 1) // xlsx.SetRowOutlineLevel("Sheet1", 2, 1)
// //
func (f *File) SetRowOutlineLevel(sheet string, row int, level uint8) { func (f *File) SetRowOutlineLevel(sheet string, row int, level uint8) {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)
prepareSheetXML(xlsx, 0, row) prepareSheetXML(xlsx, 0, row)
@ -345,14 +345,14 @@ func (f *File) SetRowOutlineLevel(sheet string, row int, level uint8) {
} }
// GetRowOutlineLevel provides a function to get outline level number of a // GetRowOutlineLevel provides a function to get outline level number of a
// single row by given worksheet name and Exce row number. // single row by given worksheet name and Excel row number. For example, get
// For example, get outline number of row 2 in Sheet1: // outline number of row 2 in Sheet1:
// //
// xlsx.GetRowOutlineLevel("Sheet1", 2) // xlsx.GetRowOutlineLevel("Sheet1", 2)
// //
func (f *File) GetRowOutlineLevel(sheet string, row int) uint8 { func (f *File) GetRowOutlineLevel(sheet string, row int) uint8 {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)
if row > len(xlsx.SheetData.Row) { if row > len(xlsx.SheetData.Row) {
@ -372,7 +372,7 @@ func (f *File) GetRowOutlineLevel(sheet string, row int) uint8 {
// partially updates these references currently. // partially updates these references currently.
func (f *File) RemoveRow(sheet string, row int) { func (f *File) RemoveRow(sheet string, row int) {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)
@ -396,7 +396,7 @@ func (f *File) RemoveRow(sheet string, row int) {
// //
func (f *File) InsertRow(sheet string, row int) { func (f *File) InsertRow(sheet string, row int) {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
f.adjustHelper(sheet, rows, row, 1) f.adjustHelper(sheet, rows, row, 1)
} }
@ -424,7 +424,7 @@ func (f *File) DuplicateRow(sheet string, row int) {
// partially updates these references currently. // partially updates these references currently.
func (f *File) DuplicateRowTo(sheet string, row, row2 int) { func (f *File) DuplicateRowTo(sheet string, row, row2 int) {
if row < 1 { if row < 1 {
panic(newInvalidRowNumberError(row)) // Fail fats to avoid possible future side effects! panic(newInvalidRowNumberError(row)) // Fail fast to avoid possible future side effects!
} }
xlsx := f.workSheetReader(sheet) xlsx := f.workSheetReader(sheet)