summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-09-11 11:01:15 +0900
committerRandy Morgan <[email protected]>2013-09-13 00:08:39 +0900
commit923e7b7ff9157bdfe95584b8d311e2f6099ab71d (patch)
tree0af22b454d592a5e4e4287660ac469cbe456fbcb /examples
parent2067c6940fc3a7ef1e8398474ac2c862130504ce (diff)
downloadcaxlsx-923e7b7ff9157bdfe95584b8d311e2f6099ab71d.tar.gz
caxlsx-923e7b7ff9157bdfe95584b8d311e2f6099ab71d.zip
Fixes for anchor swapping when adding images. - Two -> One swap still pending.
Diffstat (limited to 'examples')
-rw-r--r--examples/anchor_swapping.rb28
-rwxr-xr-xexamples/example.rb4
2 files changed, 30 insertions, 2 deletions
diff --git a/examples/anchor_swapping.rb b/examples/anchor_swapping.rb
new file mode 100644
index 00000000..88302005
--- /dev/null
+++ b/examples/anchor_swapping.rb
@@ -0,0 +1,28 @@
+$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
+require 'axlsx'
+xls = Axlsx::Package.new
+wb = xls.workbook
+wb.add_worksheet do |ws|
+ img = File.expand_path('../image1.jpeg', __FILE__)
+ ws.add_image(:image_src => img) do |image|
+ image.start_at 2, 2
+ image.end_at 5, 5
+ end
+end
+wb.add_worksheet do |ws|
+ img = File.expand_path('../image1.jpeg', __FILE__)
+ ws.add_image(:image_src => img, :start_at => "B2") do |image|
+ image.width = 70
+ image.height = 50
+ end
+end
+wb.add_worksheet do |ws|
+ img = File.expand_path('../image1.jpeg', __FILE__)
+ ws.add_image(:image_src => img, :start_at => [1,1]) do |image|
+ image.end_at "E7"
+ end
+end
+
+
+
+xls.serialize 'anchor.xlsx'
diff --git a/examples/example.rb b/examples/example.rb
index 17e67411..6c8fbd0e 100755
--- a/examples/example.rb
+++ b/examples/example.rb
@@ -720,8 +720,8 @@ if examples.include? :page_breaks
ws = wb.add_worksheet(:name => "page breaks") do |sheet|
sheet.add_row ["A"] * 10
sheet.add_row ["A"] * 10
- sheet.add_page_break("A2")
- sheet.add_page_break(sheet.rows.last.cells[5])
+ sheet.add_page_break("B2")
+ sheet.sheet_view.view = :page_layout # so you can see the breaks!
end
end