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, #ptrue?, #put_deprecate_message, #row_col_notation, #store_col_max_min_values, #store_row_max_min_values, #substitute_cellref, #underline_attributes, #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.
126
127
128
129
130
131
|
# File 'lib/write_xlsx/package/comments.rb', line 126
def initialize(worksheet)
@worksheet = worksheet
@writer = Package::XMLWriterSimple.new
@author_ids = {}
@comments = {}
end
|
Instance Method Details
#[](row) ⇒ Object
133
134
135
|
# File 'lib/write_xlsx/package/comments.rb', line 133
def [](row)
@comments[row]
end
|
#add(comment) ⇒ Object
137
138
139
140
141
142
143
144
|
# File 'lib/write_xlsx/package/comments.rb', line 137
def add()
if @comments[.row]
@comments[.row][.col] =
else
@comments[.row] = {}
@comments[.row][.col] =
end
end
|
#assemble_xml_file ⇒ Object
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/write_xlsx/package/comments.rb', line 158
def assemble_xml_file
write_xml_declaration
write_authors()
()
@writer.end_tag('comments')
@writer.crlf
@writer.close
end
|
#empty? ⇒ Boolean
146
147
148
|
# File 'lib/write_xlsx/package/comments.rb', line 146
def empty?
@comments.empty?
end
|
187
188
189
|
# File 'lib/write_xlsx/package/comments.rb', line 187
def (row)
!!@comments[row]
end
|
#set_xml_writer(filename) ⇒ Object
154
155
156
|
# File 'lib/write_xlsx/package/comments.rb', line 154
def set_xml_writer(filename)
@writer.set_xml_writer(filename)
end
|
#size ⇒ Object
150
151
152
|
# File 'lib/write_xlsx/package/comments.rb', line 150
def size
.size
end
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# File 'lib/write_xlsx/package/comments.rb', line 169
def
@sorted_comments if @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
@sorted_comments
end
|