Class: Writexlsx::Chartsheet

Inherits:
Worksheet show all
Includes:
Utility
Defined in:
lib/write_xlsx/chartsheet.rb

Constant Summary

Constants included from Utility

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

Constants inherited from Worksheet

Worksheet::MAX_DIGIT_WIDTH, Worksheet::PADDING

Instance Attribute Summary collapse

Attributes inherited from Worksheet

#autofilter_area, #charts, #col_formats, #comments, #comments_author, #drawing, #dxf_priority, #footer_images, #header_images, #images, #index, #set_rows, #shapes, #tables, #vba_codename, #vml_data_id, #vml_drawing_links, #vml_header_id, #vml_shape_id, #writer

Instance Method Summary collapse

Methods included from Utility

#absolute_char, #check_dimensions, #check_dimensions_and_update_max_min_values, #check_parameter, #convert_date_time, #dash_types, delete_files, #fill_properties, #float_to_str, #layout_properties, #line_fill_properties, #line_properties, #palette_color, #pixels_to_points, #process_workbook_options, #ptrue?, #put_deprecate_message, #quote_sheetname, #r_id_attributes, #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, #value_or_raise, #write_anchor, #write_auto_fill, #write_color, #write_comment_path, #write_div, #write_fill, #write_font, #write_stroke, #write_xml_declaration, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xml_str

Methods inherited from Worksheet

#activate, #add_sparkline, #add_table, #autofilter, #buttons_data, #center_horizontally, #center_vertically, #comments_visible?, #conditional_formatting, #data_validation, #date_1904?, #drawing_links, #excel2003_style?, #filter_column, #filter_column_list, #fit_to_pages, #freeze_panes, #get_range_data, #has_comments?, #has_header_vml?, #has_shapes?, #has_vml?, #header_images_data, #hidden?, #hide, #hide_gridlines, #hide_zero, #horizontal_dpi=, #insert_button, #insert_chart, #insert_image, #insert_shape, #is_chartsheet?, #margin_bottom=, #margin_left=, #margin_right=, #margin_top=, #margins=, #margins_left_right=, #margins_top_bottom=, #merge_range, #merge_range_type, #name, #num_comments_block, #outline_settings, #palette_color, #paper=, #position_object_pixels, #prepare_header_image, #prepare_header_vml_objects, #prepare_image, #prepare_shape, #prepare_tables, #prepare_vml_objects, #print_across, #print_area, #print_black_and_white, #print_repeat_cols, #print_repeat_rows, #print_row_col_headers, #print_scale=, #repeat_columns, #repeat_formula, #repeat_rows, #right_to_left, #select, #set_column, #set_comments_author, #set_default_row, #set_external_comment_links, #set_external_vml_links, #set_first_sheet, #set_footer, #set_h_pagebreaks, #set_header, #set_landscape, #set_margin_bottom, #set_margin_left, #set_margin_right, #set_margin_top, #set_margins, #set_margins_LR, #set_margins_TB, #set_page_view, #set_paper, #set_portrait, #set_print_scale, #set_row, #set_selection, #set_start_page, #set_tab_color, #set_v_pagebreaks, #set_vba_name, #set_xml_writer, #set_zoom, #show_comments, #sorted_comments, #split_panes, #start_page=, #store_formula, #tab_color=, #tables_count, #vertical_dpi=, #write, #write_array_formula, #write_blank, #write_cell_array_formula, #write_cell_formula, #write_cell_value, #write_col, #write_comment, #write_date_time, #write_formula, #write_number, #write_rich_string, #write_row, #write_string, #write_url, #zoom=

Constructor Details

#initialize(workbook, index, name) ⇒ Chartsheet

Returns a new instance of Chartsheet


20
21
22
23
24
25
26
27
28
# File 'lib/write_xlsx/chartsheet.rb', line 20

def initialize(workbook, index, name)
  super
  @drawing           = Drawing.new
  @is_chartsheet     = true
  @chart             = nil
  @charts            = [1]
  @zoom_scale_normal = 0
  @page_setup.orientation = false
end

Instance Attribute Details

#chart=(value) ⇒ Object (writeonly)

Sets the attribute chart

Parameters:

  • value

    the value to set the attribute chart to.


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

def chart=(value)
  @chart = value
end

Instance Method Details

#add_series(*args) ⇒ Object

Encapsulated Chart methods.


77
78
79
# File 'lib/write_xlsx/chartsheet.rb', line 77

def add_series(*args)
  @chart.add_series(*args)
end

#assemble_xml_fileObject

Assemble and write the XML file.


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/write_xlsx/chartsheet.rb', line 33

def assemble_xml_file # :nodoc:
  return unless @writer

  write_xml_declaration do
    # Write the root chartsheet element.
    write_chartsheet do
      # Write the worksheet properties.
      write_sheet_pr
      # Write the sheet view properties.
      write_sheet_views
      # Write the sheetProtection element.
      write_sheet_protection
      # Write the printOptions element.
      write_print_options
      # Write the worksheet page_margins.
      write_page_margins
      # Write the worksheet page setup.
      write_page_setup
      # Write the headerFooter element.
      write_header_footer
      # Write the drawing element.
      write_drawings
      # Close the worksheet tag.
    end
  end
end

160
161
162
# File 'lib/write_xlsx/chartsheet.rb', line 160

def external_links
  [@external_drawing_links]
end

#prepare_chart(index, chart_id, drawing_id) ⇒ Object

Set up chart/drawings.


148
149
150
151
152
153
154
155
156
157
158
# File 'lib/write_xlsx/chartsheet.rb', line 148

def prepare_chart(index, chart_id, drawing_id) # :nodoc:
  @chart.id = chart_id - 1

  drawing = Drawing.new
  @drawing = drawing
  @drawing.orientation = @page_setup.orientation

  @external_drawing_links << [ '/drawing', "../drawings/drawing#{drawing_id}.xml" ]

  @drawing_links << [ '/chart', "../charts/chart#{chart_id}.xml"]
end

#protect(password = '', options = {}) ⇒ Object


60
61
62
63
64
65
66
67
68
# File 'lib/write_xlsx/chartsheet.rb', line 60

def protect(password = '', options = {})
  @chart.protection = 1

  options[:sheet]     = 0
  options[:content]   = 1
  options[:scenarios] = 1

  super(password, options)
end

#set_chartarea(*args) ⇒ Object


109
110
111
# File 'lib/write_xlsx/chartsheet.rb', line 109

def set_chartarea(*args)
  @chart.set_chartarea(*args)
end

#set_drop_lines(*args) ⇒ Object


137
138
139
# File 'lib/write_xlsx/chartsheet.rb', line 137

def set_drop_lines(*args)
  @chart.set_drop_lines(*args)
end

#set_high_low_lines(*args) ⇒ Object


141
142
143
# File 'lib/write_xlsx/chartsheet.rb', line 141

def set_high_low_lines(*args)
  @chart.set_high_low_lines(*args)
end

#set_legend(*args) ⇒ Object


101
102
103
# File 'lib/write_xlsx/chartsheet.rb', line 101

def set_legend(*args)
  @chart.set_legend(*args)
end

#set_plotarea(*args) ⇒ Object


105
106
107
# File 'lib/write_xlsx/chartsheet.rb', line 105

def set_plotarea(*args)
  @chart.set_plotarea(*args)
end

#set_size(*args) ⇒ Object


125
126
127
# File 'lib/write_xlsx/chartsheet.rb', line 125

def set_size(*args)
  @chart.set_size(*args)
end

#set_style(*args) ⇒ Object


113
114
115
# File 'lib/write_xlsx/chartsheet.rb', line 113

def set_style(*args)
  @chart.set_style(*args)
end

#set_table(*args) ⇒ Object


129
130
131
# File 'lib/write_xlsx/chartsheet.rb', line 129

def set_table(*args)
  @chart.set_table(*args)
end

#set_title(*args) ⇒ Object


97
98
99
# File 'lib/write_xlsx/chartsheet.rb', line 97

def set_title(*args)
  @chart.set_title(*args)
end

#set_up_down_bars(*args) ⇒ Object


133
134
135
# File 'lib/write_xlsx/chartsheet.rb', line 133

def set_up_down_bars(*args)
  @chart.set_up_down_bars(*args)
end

#set_x2_axis(*args) ⇒ Object


89
90
91
# File 'lib/write_xlsx/chartsheet.rb', line 89

def set_x2_axis(*args)
  @chart.set_x2_axis(*args)
end

#set_x_axis(*args) ⇒ Object


81
82
83
# File 'lib/write_xlsx/chartsheet.rb', line 81

def set_x_axis(*args)
  @chart.set_x_axis(*args)
end

#set_y2_axis(*args) ⇒ Object


93
94
95
# File 'lib/write_xlsx/chartsheet.rb', line 93

def set_y2_axis(*args)
  @chart.set_y2_axis(*args)
end

#set_y_axis(*args) ⇒ Object


85
86
87
# File 'lib/write_xlsx/chartsheet.rb', line 85

def set_y_axis(*args)
  @chart.set_y_axis(*args)
end

#show_blanks_as(*args) ⇒ Object


117
118
119
# File 'lib/write_xlsx/chartsheet.rb', line 117

def show_blanks_as(*args)
  @chart.show_blanks_as(*args)
end

#show_hidden_data(*args) ⇒ Object


121
122
123
# File 'lib/write_xlsx/chartsheet.rb', line 121

def show_hidden_data(*args)
  @chart.show_hidden_data(*args)
end