Class: Writexlsx::Worksheet

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Constants, ObjectPositioning, Autofilter, CellDataManager, Columns, CommentsSupport, ConditionalFormats, DataWriting, DrawingMethods, DrawingPreparation, DrawingRelations, DrawingXmlWriter, Formatting, Initialization, Panes, PrintOptions, Protection, RichTextHelpers, RowColSizing, Rows, Selection, XmlWriter
Defined in:
lib/write_xlsx/worksheet.rb,
lib/write_xlsx/worksheet/rows.rb,
lib/write_xlsx/worksheet/panes.rb,
lib/write_xlsx/worksheet/columns.rb,
lib/write_xlsx/worksheet/cell_data.rb,
lib/write_xlsx/worksheet/hyperlink.rb,
lib/write_xlsx/worksheet/selection.rb,
lib/write_xlsx/worksheet/autofilter.rb,
lib/write_xlsx/worksheet/formatting.rb,
lib/write_xlsx/worksheet/protection.rb,
lib/write_xlsx/worksheet/xml_writer.rb,
lib/write_xlsx/worksheet/data_writing.rb,
lib/write_xlsx/worksheet/asset_manager.rb,
lib/write_xlsx/worksheet/print_options.rb,
lib/write_xlsx/worksheet/initialization.rb,
lib/write_xlsx/worksheet/row_col_sizing.rb,
lib/write_xlsx/worksheet/cell_data_store.rb,
lib/write_xlsx/worksheet/data_validation.rb,
lib/write_xlsx/worksheet/drawing_methods.rb,
lib/write_xlsx/worksheet/comments_support.rb,
lib/write_xlsx/worksheet/cell_data_manager.rb,
lib/write_xlsx/worksheet/drawing_relations.rb,
lib/write_xlsx/worksheet/rich_text_helpers.rb,
lib/write_xlsx/worksheet/drawing_xml_writer.rb,
lib/write_xlsx/worksheet/conditional_formats.rb,
lib/write_xlsx/worksheet/drawing_preparation.rb

Direct Known Subclasses

Chartsheet

Defined Under Namespace

Modules: Autofilter, CellDataManager, Columns, CommentsSupport, ConditionalFormats, DataWriting, DrawingMethods, DrawingPreparation, DrawingRelations, DrawingXmlWriter, Formatting, Initialization, Panes, PrintOptions, Protection, RichTextHelpers, RowColSizing, Rows, Selection, XmlWriter Classes: AssetManager, BlankCellData, BooleanCellData, COLINFO, CellData, CellDataStore, DataValidation, DateTimeCellData, DynamicFormulaArrayCellData, EmbedImageCellData, ExternalHyperlink, FormulaArrayCellData, FormulaCellData, Hyperlink, InternalHyperlink, NumberCellData, RichStringCellData, StringCellData

Constant Summary

Constants included from Utility::StringWidth

Utility::StringWidth::CHAR_WIDTHS, Utility::StringWidth::DEFAULT_COL_PIXELS, Utility::StringWidth::MAX_DIGIT_WIDTH, Utility::StringWidth::PADDING

Constants included from Utility::Common

Utility::Common::PERL_TRUE_VALUES

Constants included from Constants

Constants::COL_MAX, Constants::ROW_MAX, Constants::SHEETNAME_MAX, Constants::STR_MAX

Constants included from Utility::ChartFormatting

Utility::ChartFormatting::PATTERN_TYPES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XmlWriter

#assemble_xml_file, #calculate_x_split_width, #col_info_attributes, #increment_rel_id_and_write_r_id, #not_contain_formatting_or_data?, #row_attributes, #sparkline_groups_attributes, #write_auto_filter, #write_autofilters, #write_breaks, #write_brk, #write_cell_array_formula, #write_cell_column_dimension, #write_cell_formula, #write_cell_value, #write_col_breaks, #write_col_info, #write_cols, #write_conditional_formats, #write_conditional_formatting_2010, #write_custom_filter, #write_custom_filters, #write_data_validations, #write_dimension, #write_empty_row, #write_ext, #write_ext_list, #write_ext_list_data_bars, #write_ext_list_sparklines, #write_filter, #write_filter_column, #write_filters, #write_freeze_panes, #write_header_footer, #write_hyperlinks, #write_ignored_error, #write_ignored_errors, #write_merge_cell, #write_merge_cells, #write_outline_pr, #write_page_margins, #write_page_set_up_pr, #write_page_setup, #write_panes, #write_phonetic_pr, #write_print_options, #write_protected_range, #write_protected_ranges, #write_r_id, #write_row_breaks, #write_row_element, #write_rows, #write_selection, #write_selections, #write_sheet_calc_pr, #write_sheet_data, #write_sheet_format_pr, #write_sheet_pr, #write_sheet_protection, #write_sheet_view, #write_sheet_views, #write_some_elements, #write_sparkline_groups, #write_split_panes, #write_tab_color, #write_table_part, #write_table_parts, #write_worksheet_attributes, #write_x14_axis_color, #write_x14_border_color, #write_x14_cf_rule, #write_x14_cfvo, #write_x14_data_bar, #write_x14_negative_border_color, #write_x14_negative_fill_color

Methods included from Utility::StringWidth

#xl_string_pixel_width

Methods included from DrawingXmlWriter

#write_drawings, #write_legacy_drawing, #write_legacy_drawing_hf, #write_picture

Methods included from DrawingRelations

#drawing_links, #drawing_rel_index, #external_links, #get_vml_drawing_rel_index, #set_external_comment_links, #set_external_vml_links

Methods included from DrawingPreparation

#prepare_background, #prepare_background_image, #prepare_chart, #prepare_drawings, #prepare_header_footer_image, #prepare_header_image, #prepare_header_vml_objects, #prepare_image, #prepare_shape, #prepare_vml_objects

Methods included from DrawingMethods

#add_sparkline, #add_table, #embed_image, #insert_chart, #insert_image, #insert_shape

Methods included from DataWriting

#keep_leading_zeros, #merge_range, #merge_range_type, #prepare_formula, #repeat_formula, #update_format_with_params, #update_range_format_with_params, #write, #write_array_formula, #write_array_formula_base, #write_blank, #write_boolean, #write_col, #write_comment, #write_date_time, #write_dynamic_array_formula, #write_formula, #write_number, #write_rich_string, #write_row, #write_string, #write_url

Methods included from Utility::Common

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

Methods included from RichTextHelpers

#cell_format_of_rich_string, #rich_strings_fragments, #xml_str_of_rich_string

Methods included from CommentsSupport

#buttons_data, #comments_author=, #comments_visible?, #has_comments?, #has_header_vml?, #has_vml?, #header_images_data, #num_comments_block, #set_comments_author, #show_comments, #sorted_comments

Methods included from PrintOptions

#set_h_pagebreaks, #set_landscape, #set_page_view, #set_pagebreak_view, #set_portrait, #set_tab_color, #set_v_pagebreaks, #tab_color=

Methods included from Formatting

#center_horizontally, #center_vertically, #hide_zero, #margin_bottom=, #margin_left=, #margin_right=, #margin_top=, #margins=, #margins_left_right=, #margins_top_bottom=, #paper=, #print_across, #print_area, #print_black_and_white, #print_repeat_cols, #print_repeat_rows, #print_scale=, #repeat_columns, #repeat_rows, #right_to_left, #set_footer, #set_header, #set_margin_bottom, #set_margin_left, #set_margin_right, #set_margin_top, #set_margins, #set_margins_LR, #set_margins_TB, #set_paper, #set_print_scale, #set_start_page, #set_zoom, #start_page=, #zoom=

Methods included from ConditionalFormats

#conditional_formatting, #write_conditional_formatting

Methods included from Autofilter

#autofilter, #filter_column, #filter_column_list, #prepare_filter_column, #write_auto_filter, #write_autofilters, #write_custom_filter, #write_custom_filters, #write_filter, #write_filter_column, #write_filters

Methods included from Panes

#freeze_panes, #set_top_left_cell, #split_panes

Methods included from Selection

#set_selection

Methods included from Rows

#set_default_row, #set_row, #set_row_pixels

Methods included from Columns

#autofit, #set_column, #set_column_pixels

Methods included from ObjectPositioning

#pixels_to_height, #pixels_to_width, #position_object_emus, #position_object_pixels

Methods included from Utility::SheetnameQuoting

#quote_sheetname

Methods included from Utility::XmlPrimitives

#r_id_attributes, #write_color, #write_xml_declaration, #xml_str

Methods included from Utility::Url

#escape_url

Methods included from Utility::DateTime

#convert_date_time

Methods included from Utility::Dimensions

#check_dimensions, #check_dimensions_and_update_max_min_values, #store_col_max_min_values, #store_row_max_min_values

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::CellReference

#row_col_notation, #substitute_cellref, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell

Methods included from RowColSizing

#size_col, #size_row

Methods included from CellDataManager

#get_range_data, #shared_string_index, #store_data_to_table, #store_row_col_max_min_values

Methods included from Initialization

#apply_excel2003_compatibility, #setup_cell_features, #setup_dependencies, #setup_drawing_and_media, #setup_filter_and_selection_state, #setup_identity, #setup_limits, #setup_protection, #setup_row_and_column_state, #setup_sheet_geometry, #setup_view_options, #setup_workbook_dependent_state

Constructor Details

#initialize(workbook, index, name) ⇒ Worksheet

Lifecycle and core setup



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/write_xlsx/worksheet.rb', line 124

def initialize(workbook, index, name) # :nodoc:
  @writer = Package::XMLWriterSimple.new

  setup_identity(workbook, index, name)
  setup_limits
  setup_dependencies
  setup_view_options
  setup_sheet_geometry
  setup_row_and_column_state
  setup_filter_and_selection_state
  setup_drawing_and_media
  setup_cell_features
  setup_protection

  apply_excel2003_compatibility if excel2003_style?
  setup_workbook_dependent_state
end

Instance Attribute Details

#autofilter_areaObject (readonly)

:nodoc:



108
109
110
# File 'lib/write_xlsx/worksheet.rb', line 108

def autofilter_area
  @autofilter_area
end

#col_infoObject (readonly)

:nodoc:



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

def col_info
  @col_info
end

#commentsObject (readonly)

:nodoc:



111
112
113
# File 'lib/write_xlsx/worksheet.rb', line 111

def comments
  @comments
end

#comments_authorObject (readonly)

:nodoc:



111
112
113
# File 'lib/write_xlsx/worksheet.rb', line 111

def comments_author
  @comments_author
end

#data_bars_2010Object

:nodoc:



112
113
114
# File 'lib/write_xlsx/worksheet.rb', line 112

def data_bars_2010
  @data_bars_2010
end

#default_row_heightObject

:nodoc:



116
117
118
# File 'lib/write_xlsx/worksheet.rb', line 116

def default_row_height
  @default_row_height
end

#drawingsObject (readonly)

:nodoc:



104
105
106
# File 'lib/write_xlsx/worksheet.rb', line 104

def drawings
  @drawings
end

#dxf_priorityObject

:nodoc:



112
113
114
# File 'lib/write_xlsx/worksheet.rb', line 112

def dxf_priority
  @dxf_priority
end

#excel_version=(value) ⇒ Object (writeonly)

:nodoc:



114
115
116
# File 'lib/write_xlsx/worksheet.rb', line 114

def excel_version=(value)
  @excel_version = value
end

#filter_cellsObject (readonly)

:nodoc:



115
116
117
# File 'lib/write_xlsx/worksheet.rb', line 115

def filter_cells
  @filter_cells
end

#indexObject (readonly)

:nodoc:



103
104
105
# File 'lib/write_xlsx/worksheet.rb', line 103

def index
  @index
end

#nameObject (readonly)

:nodoc:



103
104
105
# File 'lib/write_xlsx/worksheet.rb', line 103

def name
  @name
end

#row_sizesObject (readonly)

:nodoc:



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

def row_sizes
  @row_sizes
end

#set_rowsObject (readonly)

:nodoc:



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

def set_rows
  @set_rows
end

#vba_codenameObject (readonly)

:nodoc:



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

def vba_codename
  @vba_codename
end

#vml_data_idObject (readonly)

:nodoc:



106
107
108
# File 'lib/write_xlsx/worksheet.rb', line 106

def vml_data_id
  @vml_data_id
end

:nodoc:



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

def vml_drawing_links
  @vml_drawing_links
end

#vml_header_idObject (readonly)

:nodoc:



107
108
109
# File 'lib/write_xlsx/worksheet.rb', line 107

def vml_header_id
  @vml_header_id
end

#vml_shape_idObject (readonly)

:nodoc:



110
111
112
# File 'lib/write_xlsx/worksheet.rb', line 110

def vml_shape_id
  @vml_shape_id
end

#writerObject (readonly)

:nodoc:



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

def writer
  @writer
end

Instance Method Details

#activateObject

Set this worksheet as the active worksheet, i.e. the worksheet that is displayed when the workbook is opened. Also set it as selected.



165
166
167
168
169
# File 'lib/write_xlsx/worksheet.rb', line 165

def activate
  @hidden = false
  @selected = true
  @workbook.activesheet = @index
end

#data_validation(*args) ⇒ Object

:call-seq:

data_validation(cell_or_cell_range, options)

Data validation is a feature of Excel which allows you to restrict the data that a users enters in a cell and to display help and warning messages. It also allows you to restrict input to values in a drop down list.



308
309
310
311
# File 'lib/write_xlsx/worksheet.rb', line 308

def data_validation(*args)
  validation = DataValidation.new(*args)
  @validations << validation unless validation.validate_none?
end

#date_1904?Boolean

:nodoc:

Returns:

  • (Boolean)


478
479
480
# File 'lib/write_xlsx/worksheet.rb', line 478

def date_1904? # :nodoc:
  @workbook.date_1904?
end

#drawings?Boolean

:nodoc:

Returns:

  • (Boolean)


520
521
522
# File 'lib/write_xlsx/worksheet.rb', line 520

def drawings? # :nodoc:
  !!@drawings
end

#excel2003_style?Boolean

:nodoc:

Returns:

  • (Boolean)


474
475
476
# File 'lib/write_xlsx/worksheet.rb', line 474

def excel2003_style? # :nodoc:
  @workbook.excel2003_style
end

#filter_on?Boolean

:nodoc:

Returns:

  • (Boolean)


492
493
494
# File 'lib/write_xlsx/worksheet.rb', line 492

def filter_on? # :nodoc:
  ptrue?(@filter_on)
end

#fit_page?Boolean

Worksheet state predicates

Returns:

  • (Boolean)


488
489
490
# File 'lib/write_xlsx/worksheet.rb', line 488

def fit_page? # :nodoc:
  @page_setup.fit_page
end

#fit_to_pages(width = 1, height = 1) ⇒ Object

The fit_to_pages() method is used to fit the printed area to a specific number of pages both vertically and horizontally. If the printed area exceeds the specified number of pages it will be scaled down to fit. This guarantees that the printed area will always appear on the specified number of pages even if the page size or margins change.



376
377
378
379
380
381
# File 'lib/write_xlsx/worksheet.rb', line 376

def fit_to_pages(width = 1, height = 1)
  @page_setup.fit_page   = true
  @page_setup.fit_width  = width
  @page_setup.fit_height = height
  @page_setup.page_setup_changed = true
end

#has_dynamic_functions?Boolean

Returns:

  • (Boolean)


428
429
430
# File 'lib/write_xlsx/worksheet.rb', line 428

def has_dynamic_functions?
  @has_dynamic_functions
end

#has_embedded_images?Boolean

Returns:

  • (Boolean)


432
433
434
# File 'lib/write_xlsx/worksheet.rb', line 432

def has_embedded_images?
  @has_embedded_images
end

#has_shapes?Boolean

Returns:

  • (Boolean)


424
425
426
# File 'lib/write_xlsx/worksheet.rb', line 424

def has_shapes?
  @has_shapes
end

#hidden?Boolean

:nodoc:

Returns:

  • (Boolean)


188
189
190
# File 'lib/write_xlsx/worksheet.rb', line 188

def hidden? # :nodoc:
  @hidden == :hidden
end

#hide(hidden = :hidden) ⇒ Object

Hide this worksheet.



174
175
176
177
178
179
# File 'lib/write_xlsx/worksheet.rb', line 174

def hide(hidden = :hidden)
  @hidden = hidden
  @selected = false
  @workbook.activesheet = 0 if @workbook.activesheet == @index
  @workbook.firstsheet  = 0 if @workbook.firstsheet  == @index
end

#hide_gridlines(option = 1) ⇒ Object

Set the option to hide gridlines on the screen and the printed page.



344
345
346
347
348
# File 'lib/write_xlsx/worksheet.rb', line 344

def hide_gridlines(option = 1)
  @screen_gridlines = (option != 2)

  @page_setup.hide_gridlines(option)
end

#hide_row_col_headersObject

Set the option to hide the row and column headers in Excel.



365
366
367
# File 'lib/write_xlsx/worksheet.rb', line 365

def hide_row_col_headers
  @hide_row_col_headers = 1
end

#horizontal_dpi=(val) ⇒ Object



383
384
385
# File 'lib/write_xlsx/worksheet.rb', line 383

def horizontal_dpi=(val)
  @page_setup.horizontal_dpi = val
end

#ignore_errors(ignores) ⇒ Object

Ignore worksheet errors/warnings in user defined ranges.



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/write_xlsx/worksheet.rb', line 316

def ignore_errors(ignores)
  # List of valid input parameters.
  valid_parameter_keys = %i[
    number_stored_as_text
    eval_error
    formula_differs
    formula_range
    formula_unlocked
    empty_cell_reference
    list_data_validation
    calculated_column
    two_digit_text_year
  ]

  raise "Unknown parameter '#{ignores.key - valid_parameter_keys}' in ignore_errors()." unless (ignores.keys - valid_parameter_keys).empty?

  @ignore_errors = ignores
end

#insert_button(row, col, properties = nil) ⇒ Object

:call-seq:

insert_button(row, col, properties)

The insert_button() method can be used to insert an Excel form button into a worksheet.



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/write_xlsx/worksheet.rb', line 283

def insert_button(row, col, properties = nil)
  if (row_col_array = row_col_notation(row))
    _row, _col = row_col_array
    _properties = col
  else
    _row = row
    _col = col
    _properties = properties
  end

  @buttons_array << Writexlsx::Package::Button.new(
    self, _row, _col, _properties, @default_row_pixels, @buttons_array.size + 1
  )
  @has_vml = true
end

#is_chartsheet?Boolean

:nodoc:

Returns:

  • (Boolean)


470
471
472
# File 'lib/write_xlsx/worksheet.rb', line 470

def is_chartsheet? # :nodoc:
  !!@is_chartsheet
end

#outline_changed?Boolean

Returns:

  • (Boolean)


500
501
502
# File 'lib/write_xlsx/worksheet.rb', line 500

def outline_changed?
  ptrue?(@outline_changed)
end

#outline_settings(visible = 1, symbols_below = 1, symbols_right = 1, auto_style = false) ⇒ Object

The outline_settings() method is used to control the appearance of outlines in Excel.



249
250
251
252
253
254
255
256
# File 'lib/write_xlsx/worksheet.rb', line 249

def outline_settings(visible = 1, symbols_below = 1, symbols_right = 1, auto_style = false)
  @outline_on    = visible
  @outline_below = symbols_below
  @outline_right = symbols_right
  @outline_style = auto_style

  @outline_changed = 1
end

#palette_color(index) ⇒ Object

Convert from an Excel internal colour index to a XML style #RRGGBB index based on the default or user defined values in the Workbook palette.



462
463
464
465
466
467
468
# File 'lib/write_xlsx/worksheet.rb', line 462

def palette_color(index) # :nodoc:
  if index.to_s =~ /^#([0-9A-F]{6})$/i
    "FF#{::Regexp.last_match(1).upcase}"
  else
    "FF#{palette_color_from_index(index)}"
  end
end

#prepare_tables(table_id, seen) ⇒ Object

Set the table ids for the worksheet tables.



400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/write_xlsx/worksheet.rb', line 400

def prepare_tables(table_id, seen)
  if tables_count > 0
    id = table_id
    tables.each do |table|
      table.prepare(id)

      if seen[table.name]
        raise "error: invalid duplicate table name '#{table.name}' found."
      else
        seen[table.name] = 1
      end

      # Store the link used for the rels file.
      @external_table_links << ['/table', "../tables/table#{id}.xml"]
      id += 1
    end
  end
  tables_count || 0
end

Set the option to print the row and column headers on the printed page.



352
353
354
355
356
357
358
359
360
# File 'lib/write_xlsx/worksheet.rb', line 352

def print_row_col_headers(headers = true)
  @page_setup.print_row_col_headers(headers)
  # if headers
  #   @print_headers         = 1
  #   @page_setup.print_options_changed = 1
  # else
  #   @print_headers = 0
  # end
end

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

Set the worksheet protection flags to prevent modification of worksheet objects.



216
217
218
219
220
221
222
223
224
225
# File 'lib/write_xlsx/worksheet.rb', line 216

def protect(password = nil, options = {})
  check_parameter(options, protect_default_settings.keys, 'protect')
  @protect = protect_default_settings.merge(options)

  # Set the password after the user defined values.
  if password && password != ''
    @protect[:password] =
      encode_password(password)
  end
end

#right_to_left?Boolean

:nodoc:

Returns:

  • (Boolean)


512
513
514
# File 'lib/write_xlsx/worksheet.rb', line 512

def right_to_left? # :nodoc:
  !!@right_to_left
end

#selectObject

Set this worksheet as a selected worksheet, i.e. the worksheet has its tab highlighted.



156
157
158
159
# File 'lib/write_xlsx/worksheet.rb', line 156

def select
  @hidden   = false  # Selected worksheet can't be hidden.
  @selected = true
end

#set_background(image) ⇒ Object

Set the background image for the worksheet.



439
440
441
442
443
# File 'lib/write_xlsx/worksheet.rb', line 439

def set_background(image)
  raise "Couldn't locate #{image}: $!" unless File.exist?(image)

  @assets.background_image = ImageProperty.new(image)
end

#set_first_sheetObject

Set this worksheet as the first visible sheet. This is necessary when there are a large number of worksheets and the activated worksheet is not visible on the screen.



201
202
203
204
# File 'lib/write_xlsx/worksheet.rb', line 201

def set_first_sheet
  @hidden = false
  @workbook.firstsheet = @index
end

#set_vba_name(vba_codename = nil) ⇒ Object

set the vba name for the worksheet



454
455
456
# File 'lib/write_xlsx/worksheet.rb', line 454

def set_vba_name(vba_codename = nil)
  @vba_codename = vba_codename || @name
end

#set_xml_writer(filename) ⇒ Object

:nodoc:



142
143
144
# File 'lib/write_xlsx/worksheet.rb', line 142

def set_xml_writer(filename) # :nodoc:
  @writer.set_xml_writer(filename)
end

#show_zeros?Boolean

:nodoc:

Returns:

  • (Boolean)


516
517
518
# File 'lib/write_xlsx/worksheet.rb', line 516

def show_zeros? # :nodoc:
  !!@show_zeros
end

#store_formula(string) ⇒ Object

Deprecated. This is a writeexcel method that is no longer required by WriteXLSX. See below.



268
269
270
# File 'lib/write_xlsx/worksheet.rb', line 268

def store_formula(string)
  string.split(/(\$?[A-I]?[A-Z]\$?\d+)/)
end

#tab_color?Boolean

:nodoc:

Returns:

  • (Boolean)


496
497
498
# File 'lib/write_xlsx/worksheet.rb', line 496

def tab_color? # :nodoc:
  ptrue?(@tab_color)
end

#tables_countObject



420
421
422
# File 'lib/write_xlsx/worksheet.rb', line 420

def tables_count
  tables.size
end

#unprotect_range(range, range_name = nil, password = nil) ⇒ Object

Unprotect ranges within a protected worksheet.



230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/write_xlsx/worksheet.rb', line 230

def unprotect_range(range, range_name = nil, password = nil)
  if range.nil?
    raise "The range must be defined in unprotect_range())\n"
  else
    range = range.gsub("$", "")
    range = range.sub(/^=/, "")
    @num_protected_ranges += 1
  end

  range_name ||= "Range#{@num_protected_ranges}"
  password   &&= encode_password(password)

  @protected_ranges << [range, range_name, password]
end

#vba_codename?Boolean

Returns:

  • (Boolean)


504
505
506
# File 'lib/write_xlsx/worksheet.rb', line 504

def vba_codename?
  ptrue?(@vba_codename)
end

#vertical_dpi=(val) ⇒ Object



387
388
389
# File 'lib/write_xlsx/worksheet.rb', line 387

def vertical_dpi=(val)
  @page_setup.vertical_dpi = val
end

#very_hiddenObject

Hide this worksheet. This can only be unhidden from VBA.



184
185
186
# File 'lib/write_xlsx/worksheet.rb', line 184

def very_hidden
  hide(:very_hidden)
end

#very_hidden?Boolean

:nodoc:

Returns:

  • (Boolean)


192
193
194
# File 'lib/write_xlsx/worksheet.rb', line 192

def very_hidden? # :nodoc:
  @hidden == :very_hidden
end

#zoom_scale_normal?Boolean

:nodoc:

Returns:

  • (Boolean)


508
509
510
# File 'lib/write_xlsx/worksheet.rb', line 508

def zoom_scale_normal? # :nodoc:
  ptrue?(@zoom_scale_normal)
end