summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-09-30 10:10:35 +0900
committerRandy Morgan <[email protected]>2012-09-30 10:10:35 +0900
commit19649444434746507d01316a1095a31b155731ba (patch)
tree0fa4e8e20bc2685854ccf576111beebaaa980fc9
parent567090167d41fee97a47e8e98d1d00b3a533785e (diff)
downloadcaxlsx-19649444434746507d01316a1095a31b155731ba.tar.gz
caxlsx-19649444434746507d01316a1095a31b155731ba.zip
Finished implementation of SheetCalcPr
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_calc_pr.rb40
1 files changed, 38 insertions, 2 deletions
diff --git a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb
index ddbb8741..baff512d 100644
--- a/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb
@@ -1,13 +1,49 @@
module Axlsx
+ # the SheetCalcPr object for the worksheet
+ # This object contains calculation properties for the worksheet.
class SheetCalcPr
- def initialize
+ # creates a new SheetCalcPr
+ # @param [Hash] options Options for this object
+ # @option [Boolean] full_calc_on_load @see full_calc_on_load
+ def initialize(options={})
+ @full_calc_on_load = true
+ options.each do |key, value|
+ self.send("#{key}=", value) if self.respond_to?("#{key}=")
+ end
+ end
+
+ # Indicates whether the application should do a full calculate on
+ # load due to contents on this sheet. After load and successful cal,c
+ # the application shall set this value to false. Set this to true
+ # when the application should calculate the workbook on load.
+ # @return [Boolean]
+ def full_calc_on_load
+ @full_calc_on_load
+ end
+ # specify the full_calc_on_load value
+ # @param [Boolean] value
+ # @see full_calc_on_load
+ def full_calc_on_load=(value)
+ Axlsx.validate_boolean(value)
+ @full_calc_on_load = value
end
+ # Serialize the object
+ # @param [String] str the string to append this objects serialized
+ # content to.
+ # @return [String]
def to_xml_string(str='')
- str << '<sheetCalcPr fullCalcOnLoad="1"/>'
+ str << "<sheetCalcPr #{serialized_attributes}/>"
end
+
+ private
+
+ def serialized_attributes
+ instance_values.map { |key, value| "#{Axlsx.camel(key, false)}='#{value}'" }.join(' ')
+ end
+
end
end