summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2016-09-05 16:37:15 +0800
committerRi Xu <xuri.me@gmail.com>2016-09-05 16:37:15 +0800
commit50863294f9d6f2ecc399d06f1b3c2312c4bdce10 (patch)
tree0cc7513dd3c56eef889432f27da1186288a2ed98 /README.md
parent956a4627d1f2b78172eaaf6078209d4cf8e64ce2 (diff)
Fix issue #2 change project to object-oriented style and update readme file.
Diffstat (limited to 'README.md')
-rw-r--r--README.md38
1 files changed, 16 insertions, 22 deletions
diff --git a/README.md b/README.md
index 357c92d..1cfe4e5 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
## Introduction
-Excelize is a library written in pure Golang and providing a set of functions that allow you to write to and read from XLSX files. Support reads and writes XLSX file generated by Office Excel 2007 and later. The full API docs can be seen 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 functions that allow you to write to and read from XLSX files. Support reads and writes XLSX file generated by Office Excel 2007 and later. Support save file without losing original charts of XLSX. The full API docs can be seen using go's built-in documentation tool, or online at [godoc.org](https://godoc.org/github.com/Luxurioust/excelize).
## Basic Usage
@@ -35,11 +35,11 @@ import (
func main() {
xlsx := excelize.CreateFile()
- xlsx = excelize.NewSheet(xlsx, 2, "Sheet2")
- xlsx = excelize.NewSheet(xlsx, 3, "Sheet3")
- xlsx = excelize.SetCellInt(xlsx, "Sheet2", "A23", 10)
- xlsx = excelize.SetCellStr(xlsx, "Sheet3", "B20", "Hello")
- err := excelize.Save(xlsx, "/home/Workbook.xlsx")
+ xlsx.NewSheet(2, "Sheet2")
+ xlsx.NewSheet(3, "Sheet3")
+ xlsx.SetCellInt("Sheet2", "A23", 10)
+ xlsx.SetCellStr("Sheet3", "B20", "Hello")
+ err := xlsx.WriteTo("/home/Workbook.xlsx")
if err != nil {
fmt.Println(err)
}
@@ -59,20 +59,17 @@ import (
)
func main() {
- xlsx, err := excelize.OpenFile("/home/Workbook.xlsx")
+ xlsx := excelize.OpenFile("/home/Workbook.xlsx")
+ xlsx.SetCellInt("Sheet2", "B2", 100)
+ xlsx.SetCellStr("Sheet2", "C11", "Hello")
+ xlsx.NewSheet(3, "TestSheet")
+ xlsx.SetCellInt("Sheet3", "A23", 10)
+ xlsx.SetCellStr("Sheet3", "b230", "World")
+ xlsx.SetActiveSheet(2)
+ err := xlsx.Save()
if err != nil {
fmt.Println(err)
}
- xlsx = excelize.SetCellInt(xlsx, "Sheet2", "B2", 100)
- xlsx = excelize.SetCellStr(xlsx, "Sheet2", "C11", "Hello")
- xlsx = excelize.NewSheet(xlsx, 3, "TestSheet")
- xlsx = excelize.SetCellInt(xlsx, "Sheet3", "A23", 10)
- xlsx = excelize.SetCellStr(xlsx, "Sheet3", "b230", "World")
- xlsx = excelize.SetActiveSheet(xlsx, 2)
- err = excelize.Save(xlsx, "/home/Workbook.xlsx")
- if err != nil {
- fmt.Println(err)
- }
}
```
@@ -87,11 +84,8 @@ import (
)
func main() {
- xlsx, err := excelize.OpenFile("/home/Workbook.xlsx")
- if err != nil {
- fmt.Println(err)
- }
- cell := excelize.GetCellValue(file, "Sheet2", "D11")
+ xlsx := excelize.OpenFile("/home/Workbook.xlsx")
+ cell := xlsx.GetCellValue("Sheet2", "D11")
fmt.Println(cell)
}
```