Class: Writexlsx::Drawing
- Inherits:
-
Object
- Object
- Writexlsx::Drawing
- Includes:
- Utility
- Defined in:
- lib/write_xlsx/drawing.rb
Constant Summary
Constants included from Utility
Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX
Instance Attribute Summary collapse
-
#embedded ⇒ Object
writeonly
Sets the attribute embedded.
-
#orientation ⇒ Object
writeonly
Sets the attribute orientation.
Instance Method Summary collapse
-
#add_drawing_object(*args) ⇒ Object
Add a chart, image or shape sub object to the drawing.
-
#assemble_xml_file ⇒ Object
Assemble and write the XML file.
-
#initialize ⇒ Drawing
constructor
A new instance of Drawing.
- #set_xml_writer(filename) ⇒ Object
- #xml_str ⇒ Object
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
Constructor Details
#initialize ⇒ Drawing
Returns a new instance of Drawing.
11 12 13 14 15 16 |
# File 'lib/write_xlsx/drawing.rb', line 11 def initialize @writer = Package::XMLWriterSimple.new @drawings = [] = false @orientation = false end |
Instance Attribute Details
#embedded=(value) ⇒ Object (writeonly)
Sets the attribute embedded
9 10 11 |
# File 'lib/write_xlsx/drawing.rb', line 9 def (value) = value end |
#orientation=(value) ⇒ Object (writeonly)
Sets the attribute orientation
9 10 11 |
# File 'lib/write_xlsx/drawing.rb', line 9 def orientation=(value) @orientation = value end |
Instance Method Details
#add_drawing_object(*args) ⇒ Object
Add a chart, image or shape sub object to the drawing.
59 60 61 |
# File 'lib/write_xlsx/drawing.rb', line 59 def add_drawing_object(*args) @drawings << args.flatten end |
#assemble_xml_file ⇒ Object
Assemble and write the XML file.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/write_xlsx/drawing.rb', line 29 def assemble_xml_file @writer.xml_decl # Write the xdr:wsDr element. write_drawing_workspace if index = 0 @drawings.each do |dimensions| # Write the xdr:twoCellAnchor element. index += 1 write_two_cell_anchor(index, *(dimensions.flatten)) end else index = 0 # Write the xdr:absoluteAnchor element. index += 1 write_absolute_anchor(index) end @writer.end_tag('xdr:wsDr') @writer.crlf @writer.close end |
#set_xml_writer(filename) ⇒ Object
22 23 24 |
# File 'lib/write_xlsx/drawing.rb', line 22 def set_xml_writer(filename) @writer.set_xml_writer(filename) end |
#xml_str ⇒ Object
18 19 20 |
# File 'lib/write_xlsx/drawing.rb', line 18 def xml_str @writer.string end |