Class: Writexlsx::Package::Comments
Constant Summary
Constants included
from Constants
Constants::COL_MAX, Constants::ROW_MAX, Constants::SHEETNAME_MAX, Constants::STR_MAX
Utility::Common::PERL_TRUE_VALUES
Instance Method Summary
collapse
#r_id_attributes, #write_xml_declaration, #xml_str
#row_col_notation, #substitute_cellref, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell
#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message
Constructor Details
#initialize(worksheet) ⇒ Comments
Returns a new instance of Comments.
256
257
258
259
260
261
|
# File 'lib/write_xlsx/package/comments.rb', line 256
def initialize(worksheet)
@worksheet = worksheet
@writer = Package::XMLWriterSimple.new
@author_ids = {}
@comments = {}
end
|
Instance Method Details
#[](row) ⇒ Object
263
264
265
|
# File 'lib/write_xlsx/package/comments.rb', line 263
def [](row)
@comments[row]
end
|
#add(workbook, worksheet, row, col, string, options) ⇒ Object
267
268
269
270
|
# File 'lib/write_xlsx/package/comments.rb', line 267
def add(workbook, worksheet, row, col, string, options)
@comments[row] ||= {}
@comments[row][col] = [workbook, worksheet, row, col, string, options]
end
|
#assemble_xml_file ⇒ Object
284
285
286
287
288
289
290
291
|
# File 'lib/write_xlsx/package/comments.rb', line 284
def assemble_xml_file
write_xml_declaration do
do
write_authors()
()
end
end
end
|
#empty? ⇒ Boolean
272
273
274
|
# File 'lib/write_xlsx/package/comments.rb', line 272
def empty?
@comments.empty?
end
|
316
317
318
|
# File 'lib/write_xlsx/package/comments.rb', line 316
def (row)
!!@comments[row]
end
|
#set_xml_writer(filename) ⇒ Object
280
281
282
|
# File 'lib/write_xlsx/package/comments.rb', line 280
def set_xml_writer(filename)
@writer.set_xml_writer(filename)
end
|
#size ⇒ Object
276
277
278
|
# File 'lib/write_xlsx/package/comments.rb', line 276
def size
.size
end
|
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
# File 'lib/write_xlsx/package/comments.rb', line 293
def
unless @sorted_comments
@sorted_comments = []
@comments.keys.sort.each do |row|
@comments[row].keys.sort.each do |col|
user_options = @comments[row][col]
= Comment.new(*user_options)
@comments[row][col] =
@comments[row][col].visible ||= 1 if
@comments[row][col].author ||= @worksheet.
@sorted_comments << @comments[row][col]
end
end
end
@sorted_comments
end
|