summaryrefslogtreecommitdiff
path: root/table.go
diff options
context:
space:
mode:
Diffstat (limited to 'table.go')
-rw-r--r--table.go35
1 files changed, 20 insertions, 15 deletions
diff --git a/table.go b/table.go
index 104202b..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,
@@ -157,9 +162,9 @@ func parseAutoFilterSet(formatSet string) *formatAutoFilter {
}
// AutoFilter provides the method to add auto filter in a worksheet by given
-// worksheet name, coordinate area and settings. An autofilter in Excel is a way
-// of filtering a 2D range of data based on some simple criteria. For example
-// applying an autofilter to a cell range A1:D4 in the worksheet 1:
+// worksheet name, coordinate area and settings. An autofilter in Excel is a
+// way of filtering a 2D range of data based on some simple criteria. For
+// example applying an autofilter to a cell range A1:D4 in the Sheet1:
//
// err = xlsx.AutoFilter("Sheet1", "A1", "D4", "")
//
@@ -170,15 +175,15 @@ func parseAutoFilterSet(formatSet string) *formatAutoFilter {
// column defines the filter columns in a autofilter range based on simple
// criteria
//
-// It isn't sufficient to just specify the filter condition. You must also hide
-// any rows that don't match the filter condition. Rows are hidden using the
-// SetRowVisible() method. Excelize can't filter rows automatically since this
-// isn't part of the file format.
+// It isn't sufficient to just specify the filter condition. You must also
+// hide any rows that don't match the filter condition. Rows are hidden using
+// the SetRowVisible() method. Excelize can't filter rows automatically since
+// this isn't part of the file format.
//
// Setting a filter criteria for a column:
//
-// expression defines the conditions, the following operators are available for
-// setting the filter criteria:
+// expression defines the conditions, the following operators are available
+// for setting the filter criteria:
//
// ==
// !=
@@ -189,8 +194,8 @@ func parseAutoFilterSet(formatSet string) *formatAutoFilter {
// and
// or
//
-// An expression can comprise a single statement or two statements separated by
-// the and and or operators. For example:
+// An expression can comprise a single statement or two statements separated
+// by the 'and' and 'or' operators. For example:
//
// x < 2000
// x > 2000