summaryrefslogtreecommitdiffhomepage
path: root/examples/example.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-10-04 20:57:52 +0900
committerRandy Morgan <[email protected]>2012-10-04 20:57:52 +0900
commitea24e85f6c8dbfa4c24fd76b9acfeff421319352 (patch)
tree623b4e901016ea73cbb3dcf73d4457f00c9ae40b /examples/example.rb
parent50adffb80e0e7da5833bb9206d14350e22973d7e (diff)
downloadcaxlsx-ea24e85f6c8dbfa4c24fd76b9acfeff421319352.tar.gz
caxlsx-ea24e85f6c8dbfa4c24fd76b9acfeff421319352.zip
Added example for hacking on specific border parts
Diffstat (limited to 'examples/example.rb')
-rwxr-xr-xexamples/example.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/example.rb b/examples/example.rb
index 0850857a..596da6b2 100755
--- a/examples/example.rb
+++ b/examples/example.rb
@@ -70,6 +70,27 @@ wb.styles do |s|
sheet.add_row [1, 2, 3], :style => blue_border
end
end
+
+#```ruby
+# Hacking border styles
+ wb.styles do |s|
+ top_bottom = s.add_style :border => { :style => :thick, :color =>"FFFF0000", :edges => [:top, :bottom] }
+ border = s.borders[s.cellXfs[top_bottom].borderId]
+ # edit existing border parts
+ border.prs.each do |part|
+ case part.name
+ when :top
+ part.color = Axlsx::Color.new(:rgb => "FFFF0000")
+ when :bottom
+ part.color = Axlsx::Color.new(:rgb => "FF00FF00")
+ end
+ end
+
+ border.prs << Axlsx::BorderPr.new(:name => :left, :color => Axlsx::Color.new(:rgb => '0000FF'), :style => :mediumDashed)
+ wb.add_worksheet(:name => 'hacked borders') do |sheet|
+ sheet.add_row [1,2,3], :style=>top_bottom
+ end
+ end
##```