summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/stylesheet/table_style_element.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/table_style_element.rb
downloadcaxlsx-e53f04284618713b0a90b7a691425c380e829476.tar.gz
caxlsx-e53f04284618713b0a90b7a691425c380e829476.zip
first commit
Diffstat (limited to 'lib/axlsx/stylesheet/table_style_element.rb')
-rw-r--r--lib/axlsx/stylesheet/table_style_element.rb66
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/axlsx/stylesheet/table_style_element.rb b/lib/axlsx/stylesheet/table_style_element.rb
new file mode 100644
index 00000000..146a6bad
--- /dev/null
+++ b/lib/axlsx/stylesheet/table_style_element.rb
@@ -0,0 +1,66 @@
+module Axlsx
+ # an element of style that belongs to a table style.
+ # @note tables and table styles are not supported in this version. This class exists in preparation for that support.
+ class TableStyleElement
+ # The type of style element. The following type are allowed
+ # :wholeTable
+ # :headerRow
+ # :totalRow
+ # :firstColumn
+ # :lastColumn
+ # :firstRowStripe
+ # :secondRowStripe
+ # :firstColumnStripe
+ # :secondColumnStripe
+ # :firstHeaderCell
+ # :lastHeaderCell
+ # :firstTotalCell
+ # :lastTotalCell
+ # :firstSubtotalColumn
+ # :secondSubtotalColumn
+ # :thirdSubtotalColumn
+ # :firstSubtotalRow
+ # :secondSubtotalRow
+ # :thirdSubtotalRow
+ # :blankRow
+ # :firstColumnSubheading
+ # :secondColumnSubheading
+ # :thirdColumnSubheading
+ # :firstRowSubheading
+ # :secondRowSubheading
+ # :thirdRowSubheading
+ # :pageFieldLabels
+ # :pageFieldValues
+ # @return [Symbol]
+ attr_accessor :type
+
+ # Number of rows or columns used in striping when the type is firstRowStripe, secondRowStripe, firstColumnStripe, or secondColumnStripe.
+ # @return [Integer]
+ attr_accessor :size
+
+ # The dxfId this style element points to
+ # @return [Integer]
+ attr_accessor :dxfId
+
+ # creates a new TableStyleElement object
+ # @option options [Symbol] type
+ # @option options [Integer] size
+ # @option options [Integer] dxfId
+ def initialize(options={})
+ options.each do |o|
+ self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
+ end
+ end
+
+ def type=(v) Axlsx::validate_table_element_type v; @type = v end
+ def size=(v) Axlsx::validate_unsigned_int v; @size = v end
+ def dxfId=(v) Axlsx::validate_unsigned_int v; @dxfId = v end
+
+ # Serializes the table style element
+ # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
+ # @return [String]
+ def to_xml(xml)
+ xml.tableStyleElement self.instance_values
+ end
+ end
+end