summaryrefslogtreecommitdiff
path: root/table.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2018-05-04 11:20:51 +0800
committerRi Xu <xuri.me@gmail.com>2018-05-04 11:20:51 +0800
commit934ecec1a96bfd5a1ecf3f1f373332504971c5fd (patch)
tree70ddbceb026548dbe27f9e8eac393b199ad56cc7 /table.go
parent200437d7787d500e791016552036a74ef221f1f4 (diff)
- Set name of table support in `AddTable()`, relate issue #216;
- godoc and go test has been updated
Diffstat (limited to 'table.go')
-rw-r--r--table.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/table.go b/table.go
index 9a933bb..5c00a2d 100644
--- a/table.go
+++ b/table.go
@@ -28,10 +28,12 @@ func parseFormatTableSet(formatSet string) *formatTable {
//
// Create a table of F2:H6 on Sheet2 with format set:
//
-// xlsx.AddTable("Sheet2", "F2", "H6", `{"table_style":"TableStyleMedium2", "show_first_column":true,"show_last_column":true,"show_row_stripes":false,"show_column_stripes":true}`)
+// xlsx.AddTable("Sheet2", "F2", "H6", `{"table_name":"table","table_style":"TableStyleMedium2", "show_first_column":true,"show_last_column":true,"show_row_stripes":false,"show_column_stripes":true}`)
//
-// Note that the table at least two lines include string type header. The two
-// chart coordinate areas can not have an intersection.
+// Note that the table at least two lines include string type header. Multiple
+// tables coordinate areas can't have an intersection.
+//
+// table_name: The name of the table, in the same worksheet name of the table should be unique
//
// table_style: The built-in table style names
//
@@ -122,7 +124,10 @@ func (f *File) addTable(sheet, tableXML string, hxAxis, hyAxis, vxAxis, vyAxis,
Name: name,
})
}
- name := "Table" + strconv.Itoa(i)
+ name := formatSet.TableName
+ if name == "" {
+ name = "Table" + strconv.Itoa(i)
+ }
t := xlsxTable{
XMLNS: NameSpaceSpreadSheet,
ID: i,