Class: Writexlsx::Package::Button
- Inherits:
-
Object
- Object
- Writexlsx::Package::Button
- Includes:
- Utility
- Defined in:
- lib/write_xlsx/package/button.rb
Constant Summary
Constants included from Utility
Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX
Instance Attribute Summary collapse
-
#font ⇒ Object
Returns the value of attribute font.
-
#macro ⇒ Object
Returns the value of attribute macro.
-
#vertices ⇒ Object
Returns the value of attribute vertices.
Instance Method Summary collapse
- #color ⇒ Object
-
#fill_attributes ⇒ Object
attributes for <v:fill> element.
- #style_addition ⇒ Object
- #type ⇒ Object
- #v_shape_attributes(id, z_index) ⇒ Object
-
#write_client_data ⇒ Object
Write the <x:ClientData> element.
-
#write_fmla_macro ⇒ Object
Write the <x:FmlaMacro> element.
-
#write_print_object ⇒ Object
Write the <x:PrintObject> element.
-
#write_rotation_lock ⇒ Object
Write the <o:lock> element.
- #write_shape(writer, id, z_index) ⇒ Object
-
#write_text_halign ⇒ Object
Write the <x:TextHAlign> element.
-
#write_text_valign ⇒ Object
Write the <x:TextVAlign> element.
-
#write_textbox ⇒ Object
Write the <v:textbox> element.
Methods included from Utility
#absolute_char, #check_dimensions, #check_dimensions_and_update_max_min_values, #check_parameter, #convert_date_time, delete_files, #float_to_str, #pixels_to_points, #ptrue?, #put_deprecate_message, #row_col_notation, #shape_style_base, #store_col_max_min_values, #store_row_max_min_values, #substitute_cellref, #underline_attributes, #v_shape_attributes_base, #v_shape_style_base, #write_anchor, #write_auto_fill, #write_color, #write_comment_path, #write_div, #write_fill, #write_font, #write_stroke, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xml_str
Instance Attribute Details
#font ⇒ Object
Returns the value of attribute font.
10 11 12 |
# File 'lib/write_xlsx/package/button.rb', line 10 def font @font end |
#macro ⇒ Object
Returns the value of attribute macro.
10 11 12 |
# File 'lib/write_xlsx/package/button.rb', line 10 def macro @macro end |
#vertices ⇒ Object
Returns the value of attribute vertices.
10 11 12 |
# File 'lib/write_xlsx/package/button.rb', line 10 def vertices @vertices end |
Instance Method Details
#color ⇒ Object
24 25 26 |
# File 'lib/write_xlsx/package/button.rb', line 24 def color 'buttonFace [67]' end |
#fill_attributes ⇒ Object
attributes for <v:fill> element.
50 51 52 53 54 55 |
# File 'lib/write_xlsx/package/button.rb', line 50 def fill_attributes [ 'color2', 'buttonFace [67]', 'o:detectmouseclick', 't' ] end |
#style_addition ⇒ Object
28 29 30 |
# File 'lib/write_xlsx/package/button.rb', line 28 def style_addition ['mso-wrap-style:tight'] end |
#type ⇒ Object
20 21 22 |
# File 'lib/write_xlsx/package/button.rb', line 20 def type '#_x0000_t201' end |
#v_shape_attributes(id, z_index) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/write_xlsx/package/button.rb', line 12 def v_shape_attributes(id, z_index) v_shape_attributes_base(id, z_index) << 'o:button' << 't' << 'fillcolor' << color << 'strokecolor' << 'windowText [64]' << 'o:insetmode' << 'auto' end |
#write_client_data ⇒ Object
Write the <x:ClientData> element.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/write_xlsx/package/button.rb', line 83 def write_client_data attributes = ['ObjectType', 'Button'] @writer.tag_elements('x:ClientData', attributes) do # Write the x:Anchor element. write_anchor # Write the x:PrintObject element. write_print_object # Write the x:AutoFill element. write_auto_fill # Write the x:FmlaMacro element. write_fmla_macro # Write the x:TextHAlign element. write_text_halign # Write the x:TextVAlign element. write_text_valign end end |
#write_fmla_macro ⇒ Object
Write the <x:FmlaMacro> element.
112 113 114 |
# File 'lib/write_xlsx/package/button.rb', line 112 def write_fmla_macro @writer.data_element('x:FmlaMacro', macro) end |
#write_print_object ⇒ Object
Write the <x:PrintObject> element.
105 106 107 |
# File 'lib/write_xlsx/package/button.rb', line 105 def write_print_object @writer.data_element('x:PrintObject', 'False') end |
#write_rotation_lock ⇒ Object
Write the <o:lock> element.
60 61 62 63 64 65 66 |
# File 'lib/write_xlsx/package/button.rb', line 60 def write_rotation_lock attributes = [ 'v:ext', 'edit', 'rotation', 't' ] @writer.empty_tag('o:lock', attributes) end |
#write_shape(writer, id, z_index) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/write_xlsx/package/button.rb', line 32 def write_shape(writer, id, z_index) @writer = writer attributes = v_shape_attributes(id, z_index) @writer.tag_elements('v:shape', attributes) do # Write the v:fill element. write_fill # Write the o:lock element. write_rotation_lock # Write the v:textbox element. write_textbox # Write the x:ClientData element. write_client_data end end |
#write_text_halign ⇒ Object
Write the <x:TextHAlign> element.
119 120 121 |
# File 'lib/write_xlsx/package/button.rb', line 119 def write_text_halign @writer.data_element('x:TextHAlign', 'Center') end |
#write_text_valign ⇒ Object
Write the <x:TextVAlign> element.
126 127 128 |
# File 'lib/write_xlsx/package/button.rb', line 126 def write_text_valign @writer.data_element('x:TextVAlign', 'Center') end |
#write_textbox ⇒ Object
Write the <v:textbox> element.
71 72 73 74 75 76 77 78 |
# File 'lib/write_xlsx/package/button.rb', line 71 def write_textbox attributes = ['style', 'mso-direction-alt:auto', 'o:singleclick', 'f'] @writer.tag_elements('v:textbox', attributes) do # Write the div element. write_div('center', font) end end |