summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/stylesheet/fill.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2011-11-20 23:22:04 +0900
committerRandy Morgan <[email protected]>2011-11-20 23:22:04 +0900
commite53f04284618713b0a90b7a691425c380e829476 (patch)
tree801fea138160f9af426d62bf94ad5bf97123ece9 /lib/axlsx/stylesheet/fill.rb
downloadcaxlsx-e53f04284618713b0a90b7a691425c380e829476.tar.gz
caxlsx-e53f04284618713b0a90b7a691425c380e829476.zip
first commit
Diffstat (limited to 'lib/axlsx/stylesheet/fill.rb')
-rw-r--r--lib/axlsx/stylesheet/fill.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/axlsx/stylesheet/fill.rb b/lib/axlsx/stylesheet/fill.rb
new file mode 100644
index 00000000..b7477a88
--- /dev/null
+++ b/lib/axlsx/stylesheet/fill.rb
@@ -0,0 +1,31 @@
+module Axlsx
+ # The Fill is a formatting object that manages the background color, and pattern for cells.
+ # @note The recommended way to manage styles in your workbook is to use Styles#add_style.
+ # @see Styles#add_style
+ # @see PatternFill
+ # @see GradientFill
+ class Fill
+
+ # The type of fill
+ # @return [PatternFill, GradientFill]
+ attr_accessor :fill_type
+
+ # Creates a new Fill object
+ # @param [PatternFill, GradientFill] fill_type
+ # @raise [ArgumentError] if the fill_type parameter is not a PatternFill or a GradientFill instance
+ def initialize(fill_type)
+ self.fill_type = fill_type
+ end
+
+ # Serializes the fill
+ # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
+ # @return [String]
+ def to_xml(xml)
+ xml.fill { @fill_type.to_xml(xml) }
+ end
+
+ def fill_type=(v) DataTypeValidator.validate "Fill.fill_type", [PatternFill, GradientFill], v; @fill_type = v; end
+
+
+ end
+end