Browse Source

Update README.org

Geoffrey J. Teale 11 năm trước cách đây
mục cha
commit
6d67e6aace
1 tập tin đã thay đổi với 40 bổ sung4 xóa
  1. 40 4
      README.org

+ 40 - 4
README.org

@@ -1,18 +1,21 @@
 * XSLX
 ** Introduction
-xlsx is a library to simplify reading the XML format used by recent
-version of Microsoft Excel in Go programs.
+xlsx is a library to simplify reading and writing the XML format used
+by recent version of Microsoft Excel in Go programs.
 
-Some, minimal, writing of XLSX files is now planned, but not yet
-completed.
+The support for writing XLSX files is currently extremely minimal.  It
+will expand slowly, but in the meantime patches are welcome!
 
 ** Usage
+*** Reading XLSX files
 Here is a minimal example usage that will dump all cell data in a
 given XLSX file.  A more complete example of this kind of
 functionality is contained in [[https://github.com/tealeg/xlsx2csv][the XLSX2CSV program]]:
 
 #+BEGIN_SRC go
 
+package main
+
 import (
     "fmt"
     "github.com/tealeg/xlsx"
@@ -39,6 +42,39 @@ Some additional information is available from the cell (for example,
 style information).  For more details see the godoc output for this
 package.
 
+*** Writing XLSX files
+The following constitutes the bare minimum required to write an XLSX document.
+
+#+BEGIN_SRC go
+
+package main
+
+import (
+    "fmt"
+    "github.com/tealeg/xlsx"
+)
+
+func main() {
+    var file *xlsx.File
+    var sheet *xlsx.Sheet
+    var row *xlsx.Row
+    var cell *xlsx.Cell
+    var err error
+
+    file = xlsx.NewFile()
+    sheet = file.AddSheet("Sheet1")
+    row = sheet.AddRow()
+    cell = row.AddCell()
+    cell.Value = "I am a cell!"
+    err = file.Save("MyXLSXFile.xlsx")
+    if err != nil {
+        fmt.Printf(err.Error())
+    }
+}
+
+#+END_SRC
+
+
 ** License
 This code is under a BSD style license: