Skip to content

Commit

Permalink
parse out protected_range: NOTE excel does not support this part of t…
Browse files Browse the repository at this point in the history
…he spec!
  • Loading branch information
randym committed Jun 20, 2012
1 parent 3d3d8e3 commit aa36162
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/example.rb
Expand Up @@ -342,6 +342,7 @@
sheet.add_row [4, 5, 6], :style => unlocked # these cells will not!
end


##Specify page margins and other options for printing

#```ruby
Expand Down
2 changes: 1 addition & 1 deletion lib/axlsx/util/simple_typed_list.rb
Expand Up @@ -149,7 +149,7 @@ def #{method}(*args, &block)

def to_xml_string(str = '')
classname = @allowed_types[0].name.split('::').last
el_name = serialize_as || (classname[0,1].downcase + classname[1..-1])
el_name = serialize_as.to_s || (classname[0,1].downcase + classname[1..-1])
str << '<' << el_name << ' count="' << @list.size.to_s << '">'
@list.each { |item| item.to_xml_string(str) }
str << '</' << el_name << '>'
Expand Down
5 changes: 5 additions & 0 deletions lib/axlsx/workbook/worksheet/worksheet.rb
Expand Up @@ -541,6 +541,11 @@ def to_xml_string
str.concat '</sheetData>'
str.concat "<autoFilter ref='%s'></autoFilter>" % @auto_filter if @auto_filter
@sheet_protection.to_xml_string(str) if @sheet_protection
unless @protected_ranges.empty?
str << '<protectedRanges>'
@protected_ranges.each { |pr| pr.to_xml_string(str) }
str << '</protectedRanges>'
end
str.concat "<mergeCells count='%s'>%s</mergeCells>" % [@merged_cells.size, @merged_cells.reduce('') { |memo, obj| memo += "<mergeCell ref='%s'></mergeCell>" % obj } ] unless @merged_cells.empty?
print_options.to_xml_string(str) if @print_options
page_margins.to_xml_string(str) if @page_margins
Expand Down

0 comments on commit aa36162

Please sign in to comment.