Class: Writexlsx::Chart::Table

Inherits:
Object
  • Object
show all
Includes:
Utility::ChartFormatting, Utility::Common, Utility::RichText
Defined in:
lib/write_xlsx/chart/table.rb

Constant Summary

Constants included from Utility::ChartFormatting

Utility::ChartFormatting::PATTERN_TYPES

Constants included from Utility::Common

Utility::Common::PERL_TRUE_VALUES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utility::RichText

#convert_font_args, #get_font_latin_attributes, #get_font_style_attributes, #params_to_font, #underline_attributes, #write_a_body_pr, #write_a_def_rpr, #write_a_end_para_rpr, #write_a_lst_style, #write_a_p_formula, #write_a_p_pr_formula, #write_def_rpr_r_pr_common, #write_tx_pr

Methods included from Utility::ChartFormatting

#color, #dash_types, #fill_properties, #layout_properties, #legend_properties, #line_fill_properties, #line_properties, #palette_color_from_index, #pattern_properties, #value_or_raise, #write_a_solid_fill, #write_a_srgb_clr

Methods included from Utility::Common

#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message

Constructor Details

#initialize(params = {}) ⇒ Table

Returns a new instance of Table.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/write_xlsx/chart/table.rb', line 17

def initialize(params = {})
  @horizontal = true
  @vertical   = true
  @outline    = true
  @show_keys  = false
  @horizontal = params[:horizontal] if params.has_key?(:horizontal)
  @vertical   = params[:vertical]   if params.has_key?(:vertical)
  @outline    = params[:outline]    if params.has_key?(:outline)
  @show_keys  = params[:show_keys]  if params.has_key?(:show_keys)
  @font       = convert_font_args(params[:font])
end

Instance Attribute Details

#fontObject (readonly)

Returns the value of attribute font.



15
16
17
# File 'lib/write_xlsx/chart/table.rb', line 15

def font
  @font
end

#horizontalObject (readonly)

Returns the value of attribute horizontal.



15
16
17
# File 'lib/write_xlsx/chart/table.rb', line 15

def horizontal
  @horizontal
end

#outlineObject (readonly)

Returns the value of attribute outline.



15
16
17
# File 'lib/write_xlsx/chart/table.rb', line 15

def outline
  @outline
end

#palette=(value) ⇒ Object (writeonly)

Sets the attribute palette

Parameters:

  • value

    the value to set the attribute palette to.



29
30
31
# File 'lib/write_xlsx/chart/table.rb', line 29

def palette=(value)
  @palette = value
end

#show_keysObject (readonly)

Returns the value of attribute show_keys.



15
16
17
# File 'lib/write_xlsx/chart/table.rb', line 15

def show_keys
  @show_keys
end

#verticalObject (readonly)

Returns the value of attribute vertical.



15
16
17
# File 'lib/write_xlsx/chart/table.rb', line 15

def vertical
  @vertical
end

Instance Method Details

#write_d_table(writer) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/write_xlsx/chart/table.rb', line 31

def write_d_table(writer)
  @writer = writer
  @writer.tag_elements('c:dTable') do
    @writer.empty_tag('c:showHorzBorder', attributes) if ptrue?(horizontal)
    @writer.empty_tag('c:showVertBorder', attributes) if ptrue?(vertical)
    @writer.empty_tag('c:showOutline',    attributes) if ptrue?(outline)
    @writer.empty_tag('c:showKeys',       attributes) if ptrue?(show_keys)
    # Write the table font.
    write_tx_pr(font)                                 if ptrue?(font)
  end
end