rubyXL 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.10
1
+ 1.0.11
@@ -2,9 +2,9 @@ module RubyXL
2
2
  class Cell < PrivateClass
3
3
 
4
4
  attr_accessor :row, :column, :datatype, :style_index, :value, :formula, :worksheet
5
- attr_reader :workbook
5
+ attr_reader :workbook,:formula_attributes
6
6
 
7
- def initialize(worksheet,row,column,value=nil,formula=nil,datatype='s',style_index=0)
7
+ def initialize(worksheet,row,column,value=nil,formula=nil,datatype='s',style_index=0, fmla_attr={})
8
8
  @worksheet = worksheet
9
9
 
10
10
  @workbook = worksheet.workbook
@@ -14,6 +14,7 @@ module RubyXL
14
14
  @value = value
15
15
  @formula=formula
16
16
  @style_index = style_index
17
+ @formula_attributes = fmla_attr
17
18
  end
18
19
 
19
20
  # changes fill color of cell
@@ -244,8 +244,13 @@ module RubyXL
244
244
  end
245
245
  end
246
246
  cell_formula = nil
247
- if(value.css('f').to_s != "")
248
- cell_formula = value.css('f').children.to_s
247
+ fmla_css = value.css('f')
248
+ if(fmla_css.to_s != "")
249
+ cell_formula = fmla_css.children.to_s
250
+ cell_formula_attr = {}
251
+ cell_formula_attr['t'] = fmla_css.attribute('t').to_s if fmla_css.attribute('t')
252
+ cell_formula_attr['ref'] = fmla_css.attribute('ref').to_s if fmla_css.attribute('ref')
253
+ cell_formula_attr['si'] = fmla_css.attribute('si').to_s if fmla_css.attribute('si')
249
254
  end
250
255
 
251
256
  unless @data_only
@@ -256,7 +261,7 @@ module RubyXL
256
261
 
257
262
  wb.worksheets[i].sheet_data[cell_index[0]][cell_index[1]] =
258
263
  Cell.new(wb.worksheets[i],cell_index[0],cell_index[1],cell_data,cell_formula,
259
- data_type,style_index)
264
+ data_type,style_index,cell_formula_attr)
260
265
  cell = wb.worksheets[i].sheet_data[cell_index[0]][cell_index[1]]
261
266
  end
262
267
  end
@@ -121,9 +121,13 @@ module Writer
121
121
  #TODO do xml.c for all cases, inside specific.
122
122
  # if dat.formula.nil?
123
123
  xml.c('r'=>Cell.convert_to_cell(i,j),
124
- 's'=>@workbook.style_corrector[dat.style_index.to_s].to_s, 't'=>dat.datatype) {
124
+ 's'=>@workbook.style_corrector[dat.style_index.to_s].to_s, 't'=>dat.datatype) {
125
125
  unless dat.formula.nil?
126
- xml.f dat.formula.to_s
126
+ if dat.formula_attributes.empty?
127
+ xml.f dat.formula.to_s
128
+ else
129
+ xml.f('t'=>dat.formula_attributes['t'].to_s, 'ref'=>dat.formula_attributes['ref'], 'si'=>dat.formula_attributes['si']).nokogiri dat.formula
130
+ end
127
131
  end
128
132
  if(dat.datatype == 's')
129
133
  unless dat.value.nil? #empty cell, but has a style
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rubyXL}
8
- s.version = "1.0.10"
8
+ s.version = "1.0.11"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Vivek Bhagwat"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyXL
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 10
10
- version: 1.0.10
9
+ - 11
10
+ version: 1.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vivek Bhagwat