From 000423e08d831fed83faca86f4473f966f25f86b Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 30 Sep 2012 09:08:11 +0900 Subject: remove PageSetUpPr from sheetPr --- lib/axlsx/workbook/worksheet/sheet_pr.rb | 63 +++----------------------------- 1 file changed, 6 insertions(+), 57 deletions(-) diff --git a/lib/axlsx/workbook/worksheet/sheet_pr.rb b/lib/axlsx/workbook/worksheet/sheet_pr.rb index a13c906e..337d7272 100644 --- a/lib/axlsx/workbook/worksheet/sheet_pr.rb +++ b/lib/axlsx/workbook/worksheet/sheet_pr.rb @@ -1,28 +1,11 @@ module Axlsx - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # - # + # The SheetPr class manages serialization fo a worksheet's sheetPr element. - # Only fit_to_page is implemented class SheetPr # These attributes are all boolean so I'm doing a bit of a hand # waving magic show to set up the attriubte accessors - # BOOLEAN_ATTRIBUTES = [:sync_horizontal, :sync_vertical, :transtion_evaluation, @@ -34,9 +17,13 @@ module Axlsx # Creates a new SheetPr object # @param [Worksheet] worksheet The worksheet that owns this SheetPr object - def initialize(worksheet) + def initialize(worksheet, options={}) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) @worksheet = worksheet + options.each do |key, value| + attr = "#{key}=" + self.send(attr, value) if self.respond_to?(attr) + end end # Dynamically create accessors for boolean attriubtes @@ -107,7 +94,6 @@ module Axlsx str end - def update_properties page_setup_pr.fit_to_page = worksheet.fit_to_page? if worksheet.auto_filter.columns.size > 0 @@ -116,41 +102,4 @@ module Axlsx end end end - - - class PageSetUpPr - - # creates a new page setup properties object - # @param [Hash] options - # @option [Boolean] fit_to_page Flag indicating whether the sheet displays Automatic Page Breaks. - # @option [Boolean] auto_page_breaks Flag indicating whether the Fit to Page print option is enabled. - def initialize(options = {}) - options.each do |key, value| - self.send("#{key}=",value) if self.respond_to?("#{key}=") - end - end - - # Flag indicating whether the sheet displays Automatic Page Breaks. - # @param [Boolean] value - # @return [Boolean] - def fit_to_page=(value) - Axlsx.validate_boolean value - @fit_to_page = value - end - - # Flag indicating whether the Fit to Page print option is enabled. - # @param [Boolean] value - # @return [Boolean] - def auto_page_breaks=(value) - Alxsx.validate_boolean value - @auto_page_breaks = value - end - - # serialize to xml - def to_xml_string(str='') - str << '' - end - end end -- cgit v1.2.3