Error parsing xlsx file created by rubyXL with font styles #25

Closed
ameliaj8 opened this Issue Apr 4, 2012 · 4 comments

Comments

Projects
None yet
5 participants
@ameliaj8

ameliaj8 commented Apr 4, 2012

Writing an XLSX file:

workbook = RubyXL::Workbook.new()
worksheet = RubyXL::Worksheet.new(workbook,'Blah'')
workbook.worksheets[0] = worksheet #overwrite initial 'Sheet1' worksheet

Make the first row 'Blah'

workbook.worksheets[0].add_cell(0,0,'Blah')
workbook.worksheets[0].change_row_bold(0,true) # text in Bold
workbook.worksheets[0].change_row_fill(0, 'BFBFBF') #sets color to grey
workbook.worksheets[0].change_row_font_color(0, '5A5A5A') #sets title in grey

Add some content from row 1 here....

Make row 1 bold

workbook.worksheets[0].change_row_bold(1,true)
workbook.worksheets[0].change_row_fill(1, '5A5A5A') #sets color to grey
workbook.worksheets[0].change_row_font_color(1, 'FFFFFF') #sets text white

Write to file

workbook.write(xlsx_filename)

Read same file

workbook = RubyXL::Parser.parse(xlsx_filename)

Error:
undefined method []' for nil:NilClass /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:142:inblock in fill_styles' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:139:in each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:139:infill_styles' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:72

@brazir

This comment has been minimized.

Show comment Hide comment
@brazir

brazir Apr 5, 2012

Contributor

I will have to take a look thanks for sending in the error.

Sent from my iPhone

On Apr 3, 2012, at 8:50 PM, ameliaj8reply@reply.github.com wrote:

Writing an XLSX file:

workbook = RubyXL::Workbook.new()
worksheet = RubyXL::Worksheet.new(workbook,'Blah'')
workbook.worksheets[0] = worksheet #overwrite initial 'Sheet1' worksheet

Make the first row 'Blah'

workbook.worksheets[0].add_cell(0,0,'Blah')
workbook.worksheets[0].change_row_bold(0,true) # text in Bold
workbook.worksheets[0].change_row_fill(0, 'BFBFBF') #sets color to grey
workbook.worksheets[0].change_row_font_color(0, '5A5A5A') #sets title in grey

#Add some content from row 1 here....

Make row 1 bold

workbook.worksheets[0].change_row_bold(1,true)
workbook.worksheets[0].change_row_fill(1, '5A5A5A') #sets color to grey
workbook.worksheets[0].change_row_font_color(1, 'FFFFFF') #sets text white

#Write to file
workbook.write(xlsx_filename)

#Read same file
workbook = RubyXL::Parser.parse(xlsx_filename)

Error:
undefined method []' for nil:NilClass /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:142:inblock in fill_styles' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:139:in each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:139:infill_styles' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:72


Reply to this email directly or view it on GitHub:
gilt#25

Contributor

brazir commented Apr 5, 2012

I will have to take a look thanks for sending in the error.

Sent from my iPhone

On Apr 3, 2012, at 8:50 PM, ameliaj8reply@reply.github.com wrote:

Writing an XLSX file:

workbook = RubyXL::Workbook.new()
worksheet = RubyXL::Worksheet.new(workbook,'Blah'')
workbook.worksheets[0] = worksheet #overwrite initial 'Sheet1' worksheet

Make the first row 'Blah'

workbook.worksheets[0].add_cell(0,0,'Blah')
workbook.worksheets[0].change_row_bold(0,true) # text in Bold
workbook.worksheets[0].change_row_fill(0, 'BFBFBF') #sets color to grey
workbook.worksheets[0].change_row_font_color(0, '5A5A5A') #sets title in grey

#Add some content from row 1 here....

Make row 1 bold

workbook.worksheets[0].change_row_bold(1,true)
workbook.worksheets[0].change_row_fill(1, '5A5A5A') #sets color to grey
workbook.worksheets[0].change_row_font_color(1, 'FFFFFF') #sets text white

#Write to file
workbook.write(xlsx_filename)

#Read same file
workbook = RubyXL::Parser.parse(xlsx_filename)

Error:
undefined method []' for nil:NilClass /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:142:inblock in fill_styles' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:139:in each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:139:infill_styles' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-1.2.5/lib/rubyXL/parser.rb:72


Reply to this email directly or view it on GitHub:
gilt#25

@mblake

This comment has been minimized.

Show comment Hide comment
@mblake

mblake Apr 26, 2012

I have a problem a lot like this. I discovered by that removing all of the calls to change_horizontal_alignment, it went away. Calling change_horizontal_alignment seemed to mess up the formatting in other cells.

mblake commented Apr 26, 2012

I have a problem a lot like this. I discovered by that removing all of the calls to change_horizontal_alignment, it went away. Calling change_horizontal_alignment seemed to mess up the formatting in other cells.

@pauldoerwald

This comment has been minimized.

Show comment Hide comment
@pauldoerwald

pauldoerwald Jun 26, 2012

+1

+1

@weshatheleopard

This comment has been minimized.

Show comment Hide comment
@weshatheleopard

weshatheleopard Jan 12, 2014

Owner

I tried, and this no longer happens on the latest version. Closing.

Owner

weshatheleopard commented Jan 12, 2014

I tried, and this no longer happens on the latest version. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment