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, 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_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
Constructor Details
#initialize(worksheet) ⇒ Comments
Returns a new instance of Comments.
222
223
224
225
226
227
|
# File 'lib/write_xlsx/package/comments.rb', line 222
def initialize(worksheet)
@worksheet = worksheet
@writer = Package::XMLWriterSimple.new
@author_ids = {}
@comments = {}
end
|
Instance Method Details
#[](row) ⇒ Object
229
230
231
|
# File 'lib/write_xlsx/package/comments.rb', line 229
def [](row)
@comments[row]
end
|
#add(comment) ⇒ Object
233
234
235
236
237
238
239
240
|
# File 'lib/write_xlsx/package/comments.rb', line 233
def add()
if @comments[.row]
@comments[.row][.col] =
else
@comments[.row] = {}
@comments[.row][.col] =
end
end
|
#assemble_xml_file ⇒ Object
254
255
256
257
258
259
260
261
262
263
|
# File 'lib/write_xlsx/package/comments.rb', line 254
def assemble_xml_file
write_xml_declaration
write_authors()
()
@writer.end_tag('comments')
@writer.crlf
@writer.close
end
|
#empty? ⇒ Boolean
242
243
244
|
# File 'lib/write_xlsx/package/comments.rb', line 242
def empty?
@comments.empty?
end
|
281
282
283
|
# File 'lib/write_xlsx/package/comments.rb', line 281
def (row)
!!@comments[row]
end
|
#set_xml_writer(filename) ⇒ Object
250
251
252
|
# File 'lib/write_xlsx/package/comments.rb', line 250
def set_xml_writer(filename)
@writer.set_xml_writer(filename)
end
|
#size ⇒ Object
246
247
248
|
# File 'lib/write_xlsx/package/comments.rb', line 246
def size
.size
end
|
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
# File 'lib/write_xlsx/package/comments.rb', line 265
def
@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
@sorted_comments
end
|