summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-03-13 08:36:24 +0900
committerRandy Morgan <[email protected]>2012-03-13 08:36:24 +0900
commit02914fa87594b7377cbcb4eb0d69f1acf8fdcdec (patch)
tree4cf744e7ef528502f708647cb7871c25e94f15f6
parent719e4b9dfb601999287bdeae5cc8e29501ff131f (diff)
parent547c5e6acfe64c61550acb70cea235e4e9f89f0e (diff)
downloadcaxlsx-02914fa87594b7377cbcb4eb0d69f1acf8fdcdec.tar.gz
caxlsx-02914fa87594b7377cbcb4eb0d69f1acf8fdcdec.zip
Merge github.com:/randym/axlsx
-rw-r--r--lib/axlsx/workbook/worksheet/cell.rb2
-rw-r--r--test/workbook/worksheet/tc_cell.rb3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb
index 62fa539f..ff759cdf 100644
--- a/lib/axlsx/workbook/worksheet/cell.rb
+++ b/lib/axlsx/workbook/worksheet/cell.rb
@@ -230,7 +230,7 @@ module Axlsx
# @example Absolute Cell Reference
# ws.rows.first.cells.first.r #=> "$A$1"
def r_abs
- "$#{r.split('').join('$')}"
+ "$#{r.match(%r{([A-Z]+)([0-9]+)})[1,2].join('$')}"
end
# @return [Integer] The cellXfs item index applied to this cell.
diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb
index 97a9951b..efaee3ac 100644
--- a/test/workbook/worksheet/tc_cell.rb
+++ b/test/workbook/worksheet/tc_cell.rb
@@ -9,6 +9,8 @@ class TestCell < Test::Unit::TestCase
p.workbook.styles.add_style :sz=>20
@row = @ws.add_row
@c = @row.add_cell 1, :type=>:float, :style=>1
+ @ws.add_row (0..26).map { |index| index }
+ @cAA = @ws["AA2"]
end
def test_initialize
@@ -42,6 +44,7 @@ class TestCell < Test::Unit::TestCase
def test_r_abs
assert_equal(@c.r_abs,"$A$1", "calculate absolute cell reference")
+ assert_equal(@cAA.r_abs,"$AA$2", "needs to accept multi-digit columns")
end
def test_style