Class: Writexlsx::Package::Table

Inherits:
Object
  • Object
show all
Includes:
Utility
Defined in:
lib/write_xlsx/package/table.rb

Constant Summary

Constants included from Utility

Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utility

#absolute_char, #check_parameter, delete_files, #ptrue?, #put_deprecate_message, #substitute_cellref, #underline_attributes, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xml_str

Constructor Details

#initializeTable

Returns a new instance of Table.



13
14
15
16
# File 'lib/write_xlsx/package/table.rb', line 13

def initialize
  @writer = Package::XMLWriterSimple.new
  @properties = {}
end

Instance Attribute Details

#properties=(value) ⇒ Object (writeonly)

Sets the attribute properties

Parameters:

  • the value to set the attribute properties to.



11
12
13
# File 'lib/write_xlsx/package/table.rb', line 11

def properties=(value)
  @properties = value
end

Instance Method Details

#assemble_xml_fileObject

Assemble and writes the XML file.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/write_xlsx/package/table.rb', line 25

def assemble_xml_file
  write_xml_declaration
  # Write the table element.
  write_table
  # Write the autoFilter element.
  write_auto_filter
  # Write the tableColumns element.
  write_table_columns
  # Write the tableStyleInfo element.
  write_table_style_info

  # Close the table tag
  @writer.end_tag('table')

  # Close the XML writer object and filehandle.
  @writer.crlf
  @writer.close
end

#set_properties(properties) ⇒ Object

Set the document properties.



47
48
49
# File 'lib/write_xlsx/package/table.rb', line 47

def set_properties(properties)
  @properties = properties
end

#set_xml_writer(filename) ⇒ Object



18
19
20
# File 'lib/write_xlsx/package/table.rb', line 18

def set_xml_writer(filename)
  @writer.set_xml_writer(filename)
end