roo-rb / roo

Roo provides an interface to spreadsheets of several sorts.
MIT License
2.78k stars 502 forks source link

bold, italic & underline problems when we select whole cell. #503

Open clubbavi opened 5 years ago

clubbavi commented 5 years ago

Steps to reproduce

  1. I am uploading an excelx file in my rails application.

xlsx_file = Roo::Spreadsheet.open(params[:file].path) # Not able to read the tags here itself. xlsx_file.sheet(0).parse(headers: true).drop(1).each do |data| # I am not getting the data here with tags end `

Issue

In a cell if I am doing only certain texts(not all) bold/italic/underline, it works. While uploading, I am getting proper format with tags(<html><b>some texts</b> ... some texts ... </html>). The problem starts when I select all texts in the cell and make it bold/italic/underline. It doesn't works. It doesn't send tags back to the controller.

System configuration

Roo version: 2.8.2

Ruby version: 2.3.6

Rails version: 4.2.7.1

chopraanmol1 commented 5 years ago

@clubbavi currently roo doesn't support wrapping cell content based upon cell-specific property. But you can check if the cell has bold property with following

xlsx.font(1,1).bold?

Refer Following Links:

https://www.rubydoc.info/gems/roo/2.8.2/Roo%2FExcelx:font https://www.rubydoc.info/gems/roo/2.8.2/Roo/Font

clubbavi commented 5 years ago

@chopraanmol1 ... so Roo::Spreadsheet.open(params[:file].path) will not provide xlsx.font(1,1).bold? method ? We have to use Excelx for that instead of Spreadsheet?

And it works if we select only few words in a cell ? If we select all it doesn't.