Permalink
Browse files

erm...

  • Loading branch information...
1 parent 2e33daa commit 46a9ee40524b2485155361a728fde7d35d687066 @randym committed Sep 14, 2012
Showing with 28 additions and 30 deletions.
  1. +1 −0 .gitignore
  2. +6 −6 examples/skydrive/real_example.rb
  3. +1 −0 examples/sprk2012/basics.rb
  4. +7 −12 examples/sprk2012/images.rb
  5. +13 −12 examples/sprk2012/styles.rb
View
@@ -12,3 +12,4 @@ example.csv
tmp
*.pem
*.pfx
+examples/sprk2012
@@ -5,14 +5,14 @@
Axlsx::Package.new do |p|
p.workbook do |wb|
styles = wb.styles
- header = styles.add_style :bg_color => "DD", :sz => 16, :b => true, :alignment => {:horizontal => :center}
+ header = styles.add_style :bg_color => "DD", :sz => 16, :b => true, :alignment => {:horizontal => :center}
tbl_header = styles.add_style :b => true, :alignment => { :horizontal => :center }
ind_header = styles.add_style :bg_color => "FFDFDEDF", :b => true, :alignment => {:indent => 1}
- col_header = styles.add_style :bg_color => "FFDFDEDF", :b => true, :alignment => { :horizontal => :center }
- label = styles.add_style :alignment => { :indent => 1 }
- money = styles.add_style :num_fmt => 5
- t_label = styles.add_style :b => true, :bg_color => "FFDFDEDF"
- t_money = styles.add_style :b => true, :num_fmt => 5, :bg_color => "FFDFDEDF"
+ col_header = styles.add_style :bg_color => "FFDFDEDF", :b => true, :alignment => { :horizontal => :center }
+ label = styles.add_style :alignment => { :indent => 1 }
+ money = styles.add_style :num_fmt => 5
+ t_label = styles.add_style :b => true, :bg_color => "FFDFDEDF"
+ t_money = styles.add_style :b => true, :num_fmt => 5, :bg_color => "FFDFDEDF"
wb.add_worksheet do |sheet|
sheet.add_row
@@ -1,3 +1,4 @@
+$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
require 'axlsx'
package = Axlsx::Package.new
@@ -1,14 +1,9 @@
-require 'axlsx'
-package = Axlsx::Package.new
-workbook = package.workbook
+$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
-workbook.add_worksheet(:name => "Image with Hyperlink") do |sheet|
- img = File.expand_path('../image1.jpeg', __FILE__)
- sheet.add_image(:image_src => img, :noSelect => true, :noMove => true, :hyperlink=>"http://axlsx.blogspot.com") do |image|
- image.width=720
- image.height=666
- image.hyperlink.tooltip = "Labeled Link"
- image.start_at 2, 2
+require 'axlsx'
+package = Axlsx::Package.new do |package|
+ package.workbook.add_worksheet(:name => "imagex") do |sheet|
+ img_path = File.expand_path('../../image1.jpeg', __FILE__)
+ sheet.add_image(:image_src => img_path, :width => 720, :height => 666, :start_at => [2,2])
end
-end
-
+end.serialize 'images.xlsx'
@@ -1,19 +1,20 @@
+$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib"
+
require 'axlsx'
package = Axlsx::Package.new
-workbook = package.workbook
-
-workbook.styles do |s|
-
- black_cell = s.add_style :bg_color => "00", :fg_color => "FF", :sz => 14, :alignment => { :horizontal=> :center }
- blue_cell = s.add_style :bg_color => "0000FF", :fg_color => "FF", :sz => 20, :alignment => { :horizontal=> :center }
-
- wb.add_worksheet(:name => "Styles") do |sheet|
+package.workbook do |workbook|
+ workbook.styles do |s|
+ black_cell = s.add_style :bg_color => "00", :fg_color => "FF", :sz => 14, :alignment => { :horizontal=> :center }
+ blue_cell = s.add_style :bg_color => "0000FF", :fg_color => "FF", :sz => 20, :alignment => { :horizontal=> :center }
- # Applies the black_cell style to the first and third cell, and the blue_cell style to the second.
- sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
+ workbook.add_worksheet(:name => "Styles") do |sheet|
+ # Applies the black_cell style to the first and third cell, and the blue_cell style to the second.
+ sheet.add_row ["Text Autowidth", "Second", "Third"], :style => [black_cell, blue_cell, black_cell]
- # Applies the thin border to all three cells
- sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
+ # Applies the thin border to all three cells
+ sheet.add_row [1, 2, 3], :style => Axlsx::STYLE_THIN_BORDER
+ end
end
end
+package.serialize 'styles.xlsx'

0 comments on commit 46a9ee4

Please sign in to comment.