瀏覽代碼

Update test file.

Ri Xu 9 年之前
父節點
當前提交
0d60020f96
共有 3 個文件被更改,包括 8 次插入21 次删除
  1. 1 0
      .travis.yml
  2. 5 3
      README.md
  3. 2 18
      excelize_test.go

+ 1 - 0
.travis.yml

@@ -4,6 +4,7 @@ install:
   - go get -d -t -v ./... && go build -v ./...
   - go get -d -t -v ./... && go build -v ./...
 
 
 go:
 go:
+  - 1.5
   - 1.6
   - 1.6
   - 1.7
   - 1.7
   - tip
   - tip

+ 5 - 3
README.md

@@ -7,15 +7,17 @@
 [![GoDoc](https://godoc.org/github.com/Luxurioust/excelize?status.svg)](https://godoc.org/github.com/Luxurioust/excelize)
 [![GoDoc](https://godoc.org/github.com/Luxurioust/excelize?status.svg)](https://godoc.org/github.com/Luxurioust/excelize)
 [![Licenses](https://img.shields.io/badge/license-bsd-orange.svg)](https://opensource.org/licenses/BSD-3-Clause)
 [![Licenses](https://img.shields.io/badge/license-bsd-orange.svg)](https://opensource.org/licenses/BSD-3-Clause)
 [![Join the chat at https://gitter.im/xuri-excelize/Lobby](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/xuri-excelize/Lobby)
 [![Join the chat at https://gitter.im/xuri-excelize/Lobby](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/xuri-excelize/Lobby)
- 
+
 ## Introduction
 ## Introduction
 
 
-Excelize is a library written in pure Golang and providing a set of function that allow you to write to and read from XLSX files. The full API docs can be viewed using go’s built in documentation tool, or online at [godoc.org](https://godoc.org/github.com/Luxurioust/excelize).
+Excelize is a library written in pure Golang and providing a set of function that allow you to write to and read from XLSX files. Support read and write XLSX file geterated by Office Excel 2007 and later. The full API docs can be viewed using go’s built in documentation tool, or online at [godoc.org](https://godoc.org/github.com/Luxurioust/excelize).
 
 
 ## Basic Usage
 ## Basic Usage
 
 
 ### Installation
 ### Installation
 
 
+Golang version requirements 1.6.0 or higher.
+
 ```
 ```
 go get github.com/Luxurioust/excelize
 go get github.com/Luxurioust/excelize
 ```
 ```
@@ -58,7 +60,7 @@ import (
 )
 )
 
 
 func main() {
 func main() {
-    xlsx, err := excelize.Openxlsx("~/Workbook.xlsx")
+    xlsx, err := excelize.OpenFile("~/Workbook.xlsx")
     if err != nil {
     if err != nil {
         fmt.Println(err)
         fmt.Println(err)
     }
     }

+ 2 - 18
excelize_test.go

@@ -2,20 +2,10 @@ package excelize
 
 
 import (
 import (
 	"fmt"
 	"fmt"
-	"math/rand"
-	"sync"
+	"strconv"
 	"testing"
 	"testing"
-	"time"
 )
 )
 
 
-var (
-	once sync.Once
-)
-
-func testSetup() {
-	rand.Seed(time.Now().UnixNano())
-}
-
 func TestExcelize(t *testing.T) {
 func TestExcelize(t *testing.T) {
 	// Test update a XLSX file
 	// Test update a XLSX file
 	file, err := OpenFile("./test/Workbook1.xlsx")
 	file, err := OpenFile("./test/Workbook1.xlsx")
@@ -32,7 +22,7 @@ func TestExcelize(t *testing.T) {
 		fmt.Println(err)
 		fmt.Println(err)
 	}
 	}
 	for i := 1; i <= 300; i++ {
 	for i := 1; i <= 300; i++ {
-		file = SetCellStr(file, "SHEET3", fmt.Sprintf("c%d", i), randToken(5))
+		file = SetCellStr(file, "SHEET3", fmt.Sprintf("c%d", i), strconv.Itoa(i))
 	}
 	}
 	err = Save(file, "./test/Workbook_2.xlsx")
 	err = Save(file, "./test/Workbook_2.xlsx")
 
 
@@ -47,9 +37,3 @@ func TestExcelize(t *testing.T) {
 		fmt.Println(err)
 		fmt.Println(err)
 	}
 	}
 }
 }
-
-func randToken(length int) string {
-	b := make([]byte, length)
-	rand.Read(b)
-	return fmt.Sprintf("%x", b)
-}