From ac0600f12fb15d1b3fe0cce1ca7a2dced4cf5285 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Wed, 9 May 2012 08:21:39 +0900 Subject: patch nil row style issue https://github.com/randym/axlsx/issues/91 --- lib/axlsx/workbook/worksheet/cell.rb | 4 +++- lib/axlsx/workbook/worksheet/comment.rb | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index fe95e529..91efa8d9 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -288,9 +288,11 @@ module Axlsx # @param [String] str The string index the cell content will be appended to. Defaults to empty string. # @return [String] xml text for the cell def to_xml_string(r_index, c_index, str = '') - return str if @value.nil? str << '' if @value.nil? + case @type + when :string #parse formula if @value.start_with?('=') diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb index 7753a71a..708b6ac4 100644 --- a/lib/axlsx/workbook/worksheet/comment.rb +++ b/lib/axlsx/workbook/worksheet/comment.rb @@ -88,7 +88,8 @@ module Axlsx # by default, all columns are 5 columns wide and 5 rows high def initialize_vml_shape ws = self.comments.worksheet - @vml_shape = VmlShape.new(self, :row => ws[ref].row.index, :column => ws[ref].index) do |vml| + pos = Axlsx::name_to_indices(ref) + @vml_shape = VmlShape.new(self, :row => pos[1], :column => pos[0]) do |vml| vml.left_column = vml.row + 1 vml.right_column = vml.column + 4 vml.top_row = vml.row -- cgit v1.2.3