On 17 October 2013 10:08, [email protected] <[email protected]> wrote:
> Hi all,
>
> I am trying to open and read a xlsx file, which I have attached. The
> upc column in that file, is the one I'm talking about. If I open the
> file in the Open Office Spreadsheet, it is correctly displaying with
> leading zeros. But if I read it with Roo gem it truncates the leading
> zeros. I understand this is the expected behavior since the column
> type is Number. But how is Open Office correctly displaying it? Is
> there is way to achieve the same using Roo or any other gem?
>
> One way I'm thinking is to patch the gem and add method which will
> just return the raw content of any cell. Will this work, or anybody have
> a better idea?

Just format the display however you want.

irb(main):001:0> "%03d" % 5
=> "005"

Colin



>
> Thanks in Advance :)
>
> --
> Azhagu Selvan
>
> http://tamizhgeek.in
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/CABX9RmyJJHUGvuQSHzJDbumQfS%2BkBfrvuaQyGmqpp30aw0fyvQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLu3uC28zjU59epfiz%3DDt%2BCVaJfJk2UY-NrKtvS64qT9xw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to