class OpenXml::Xlsx::Parts::Table
Attributes
columns[R]
id[R]
name[R]
ref[R]
Public Class Methods
new(id, name, ref, columns)
click to toggle source
# File lib/openxml/xlsx/parts/table.rb, line 7 def initialize(id, name, ref, columns) @id = id @name = name @ref = ref @columns = columns end
Public Instance Methods
filename()
click to toggle source
# File lib/openxml/xlsx/parts/table.rb, line 14 def filename "table#{id}.xml" end
to_xml()
click to toggle source
# File lib/openxml/xlsx/parts/table.rb, line 18 def to_xml build_standalone_xml do |xml| xml.table(xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", id: id, name: name, displayName: name, ref: ref, totalsRowShown: 0) do xml.autoFilter ref: ref xml.tableColumns(count: columns.length) do columns.each_with_index do |column, index| xml.tableColumn(id: index + 1, name: column.name) end end xml.tableStyleInfo(name: "TableStyleLight6", showFirstColumn: 0, showLastColumn: 0, showRowStripes: 1, showColumnStripes: 0) end end end