lib/rubyXL/writer/worksheet_writer.rb in rubyXL-1.1.5 vs lib/rubyXL/writer/worksheet_writer.rb in rubyXL-1.1.6
- old
+ new
@@ -121,12 +121,15 @@
row.each_with_index do |dat, j|
unless dat.nil?
#TODO do xml.c for all cases, inside specific.
# if dat.formula.nil?
dat.style_index = @workbook.style_corrector[dat.style_index.to_s]
- xml.c('r'=>Cell.convert_to_cell(i,j),
- 's'=>dat.style_index.to_s, 't'=>dat.datatype) {
+ c_opts = {'r'=>Cell.convert_to_cell(i,j), 's'=>dat.style_index.to_s}
+ unless dat.datatype.nil? || dat.datatype == ''
+ c_opts['t'] = dat.datatype
+ end
+ xml.c(c_opts) {
unless dat.formula.nil?
if dat.formula_attributes.nil? || dat.formula_attributes.empty?
xml.f dat.formula.to_s
else
xml.f('t'=>dat.formula_attributes['t'].to_s, 'ref'=>dat.formula_attributes['ref'], 'si'=>dat.formula_attributes['si']).nokogiri dat.formula
@@ -189,10 +192,10 @@
xml.pageSetup('orientation'=>'portrait',
'horizontalDpi'=>'4294967292', 'verticalDpi'=>'4294967292')
unless @worksheet.legacy_drawing.nil?
xml.legacyDrawing('r:id'=>@worksheet.legacy_drawing[:attributes][:id])
- end
+ end
unless @worksheet.extLst.nil?
xml.extLst {
xml.ext('xmlns:mx'=>"http://schemas.microsoft.com/office/mac/excel/2008/main",
'uri'=>"http://schemas.microsoft.com/office/mac/excel/2008/main") {