examples/example.rb in axlsx-1.1.4 vs examples/example.rb in axlsx-1.1.5
- old
+ new
@@ -55,11 +55,11 @@
sheet["A1:D1"].each { |c| c.color = "FF0000" }
sheet['A1:D2'].each { |c| c.style = Axlsx::STYLE_THIN_BORDER }
end
#```
-#Using Custom Border Styles
+##Using Custom Border Styles
#```ruby
#Axlsx defines a thin border style, but you can easily create and use your own.
wb.styles do |s|
red_border = s.add_style :border => { :style => :thick, :color =>"FFFF0000" }
@@ -95,11 +95,10 @@
sheet.column_info[4].hidden = true
#Set the second column outline level
sheet.column_info[1].outlineLevel = 2
- #TODO rows hidden, outline etc.
sheet.rows[3].hidden = true
sheet.rows[1].outlineLevel = 2
end
end
#```
@@ -331,18 +330,26 @@
sheet.show_gridlines = false
end
#```
-##Specify Page Margins for printing
+##Specify page margins and other options for printing
#```ruby
margins = {:left => 3, :right => 3, :top => 1.2, :bottom => 1.2, :header => 0.7, :footer => 0.7}
-wb.add_worksheet(:name => "print margins", :page_margins => margins) do |sheet|
- sheet.add_row ["this sheet uses customized page margins for printing"]
+setup = {:fit_to_width => 1, :orientation => :landscape, :paper_width => "297mm", :paper_height => "210mm"}
+options = {:grid_lines => true, :headings => true, :horizontal_centered => true}
+wb.add_worksheet(:name => "print margins", :page_margins => margins, :page_setup => setup, :print_options => options) do |sheet|
+ sheet.add_row ["this sheet uses customized print settings"]
end
#```
+## Add Comments to your spreadsheet
+#``` ruby
+wb.add_worksheet(:name => 'comments') do |sheet|
+ sheet.add_row ['Can we build it?']
+ sheet.add_comment :ref => 'A1', :author => 'Bob', :text => 'Yes We Can!'
+end
##Validate and Serialize
#```ruby
# Serialize directly to file