Class: Writexlsx::Package::Comments
- Inherits:
-
Object
- Object
- Writexlsx::Package::Comments
show all
- Includes:
- Utility
- Defined in:
- lib/write_xlsx/package/comments.rb
Constant Summary
Constants included
from Utility
Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX
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, #ptrue?, #put_deprecate_message, #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_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
Constructor Details
#initialize(worksheet) ⇒ Comments
Returns a new instance of Comments.
239
240
241
242
243
244
|
# File 'lib/write_xlsx/package/comments.rb', line 239
def initialize(worksheet)
@worksheet = worksheet
@writer = Package::XMLWriterSimple.new
@author_ids = {}
@comments = {}
end
|
Instance Method Details
#[](row) ⇒ Object
246
247
248
|
# File 'lib/write_xlsx/package/comments.rb', line 246
def [](row)
@comments[row]
end
|
#add(comment) ⇒ Object
250
251
252
253
254
255
256
257
|
# File 'lib/write_xlsx/package/comments.rb', line 250
def add()
if @comments[.row]
@comments[.row][.col] =
else
@comments[.row] = {}
@comments[.row][.col] =
end
end
|
#assemble_xml_file ⇒ Object
271
272
273
274
275
276
277
278
|
# File 'lib/write_xlsx/package/comments.rb', line 271
def assemble_xml_file
write_xml_declaration do
do
write_authors()
()
end
end
end
|
#empty? ⇒ Boolean
259
260
261
|
# File 'lib/write_xlsx/package/comments.rb', line 259
def empty?
@comments.empty?
end
|
299
300
301
|
# File 'lib/write_xlsx/package/comments.rb', line 299
def (row)
!!@comments[row]
end
|
#set_xml_writer(filename) ⇒ Object
267
268
269
|
# File 'lib/write_xlsx/package/comments.rb', line 267
def set_xml_writer(filename)
@writer.set_xml_writer(filename)
end
|
#size ⇒ Object
263
264
265
|
# File 'lib/write_xlsx/package/comments.rb', line 263
def size
.size
end
|
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
# File 'lib/write_xlsx/package/comments.rb', line 280
def
unless @sorted_comments
@sorted_comments = []
@comments.keys.sort.each do |row|
@comments[row].keys.sort.each do |col|
@comments[row][col].visible ||= 1 if
@comments[row][col].author ||= @worksheet.
@sorted_comments << @comments[row][col]
end
end
end
@sorted_comments
end
|