diff options
| -rwxr-xr-x | examples/example.rb | 1 | ||||
| -rw-r--r-- | lib/axlsx/util/simple_typed_list.rb | 2 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/worksheet.rb | 5 |
3 files changed, 7 insertions, 1 deletions
diff --git a/examples/example.rb b/examples/example.rb index 5b5b11b9..bd32e98b 100755 --- a/examples/example.rb +++ b/examples/example.rb @@ -342,6 +342,7 @@ wb.add_worksheet(:name => 'Sheet Protection') do |sheet| sheet.add_row [4, 5, 6], :style => unlocked # these cells will not! end + ##Specify page margins and other options for printing #```ruby diff --git a/lib/axlsx/util/simple_typed_list.rb b/lib/axlsx/util/simple_typed_list.rb index e3336678..e3516398 100644 --- a/lib/axlsx/util/simple_typed_list.rb +++ b/lib/axlsx/util/simple_typed_list.rb @@ -149,7 +149,7 @@ module Axlsx 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 << '>' diff --git a/lib/axlsx/workbook/worksheet/worksheet.rb b/lib/axlsx/workbook/worksheet/worksheet.rb index 513f0453..d5c1037b 100644 --- a/lib/axlsx/workbook/worksheet/worksheet.rb +++ b/lib/axlsx/workbook/worksheet/worksheet.rb @@ -541,6 +541,11 @@ module Axlsx 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 |
