From aa361626894b48fbd9ab2aa19d1e4e34ec704b33 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Wed, 20 Jun 2012 19:40:59 +0900 Subject: parse out protected_range: NOTE excel does not support this part of the spec! --- examples/example.rb | 1 + lib/axlsx/util/simple_typed_list.rb | 2 +- lib/axlsx/workbook/worksheet/worksheet.rb | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) 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 << '' 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 '' str.concat "" % @auto_filter if @auto_filter @sheet_protection.to_xml_string(str) if @sheet_protection + unless @protected_ranges.empty? + str << '' + @protected_ranges.each { |pr| pr.to_xml_string(str) } + str << '' + end str.concat "%s" % [@merged_cells.size, @merged_cells.reduce('') { |memo, obj| memo += "" % obj } ] unless @merged_cells.empty? print_options.to_xml_string(str) if @print_options page_margins.to_xml_string(str) if @page_margins -- cgit v1.2.3