summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/README.md b/README.md
index 2cefd0c..c6ed92e 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ import (
)
func main() {
- xlsx := excelize.CreateFile()
+ xlsx := excelize.NewFile()
// Create a new sheet.
xlsx.NewSheet(2, "Sheet2")
// Set value of a cell.
@@ -45,7 +45,7 @@ func main() {
// Set active sheet of the workbook.
xlsx.SetActiveSheet(2)
// Save xlsx file by the given path.
- err := xlsx.WriteTo("./Workbook.xlsx")
+ err := xlsx.SaveAs("./Workbook.xlsx")
if err != nil {
fmt.Println(err)
os.Exit(1)
@@ -109,7 +109,7 @@ import (
func main() {
categories := map[string]string{"A2": "Small", "A3": "Normal", "A4": "Large", "B1": "Apple", "C1": "Orange", "D1": "Pear"}
values := map[string]int{"B2": 2, "C2": 3, "D2": 3, "B3": 5, "C3": 2, "D3": 4, "B4": 6, "C4": 7, "D4": 8}
- xlsx := excelize.CreateFile()
+ xlsx := excelize.NewFile()
for k, v := range categories {
xlsx.SetCellValue("Sheet1", k, v)
}
@@ -118,7 +118,7 @@ func main() {
}
xlsx.AddChart("Sheet1", "E1", `{"type":"bar3D","series":[{"name":"=Sheet1!$A$2","categories":"=Sheet1!$B$1:$D$1","values":"=Sheet1!$B$2:$D$2"},{"name":"=Sheet1!$A$2","categories":"=Sheet1!$B$1:$D$1","values":"=Sheet1!$B$3:$D$3"},{"name":"=Sheet1!$A$3","categories":"=Sheet1!$B$1:$D$1","values":"=Sheet1!$B$4:$D$4"}],"title":{"name":"Fruit 3D Line Chart"}}`)
// Save xlsx file by the given path.
- err := xlsx.WriteTo("./Workbook.xlsx")
+ err := xlsx.SaveAs("./Workbook.xlsx")
if err != nil {
fmt.Println(err)
os.Exit(1)