selva4210-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2013-Oct-17 09:08 UTC
Fwd: Read a Number column with leading zeros using Roo gem
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? 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Colin Law
2013-Oct-17 09:37 UTC
Re: Fwd: Read a Number column with leading zeros using Roo gem
On 17 October 2013 10:08, selva4210-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <selva4210-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.