You're converting it to an integer with to_i. Pull the string and do what
you want with it, integers don't have a leading 0, strings do. Unless anyone
has a better idea, you'd be better off working with the basic string
yourself and converting it.

-c

On 5/9/07, Tunde Jinadu <[EMAIL PROTECTED]> wrote:

I'm running a script to read data from a spreadsheet using the following
script

# open the spreadsheet and get the values
    excel = WIN32OLE::new('excel.Application') # define the type of
application to connect too
    workbook = excel.Workbooks.Open('d:\Smoke_Test2.xls') # spreadsheet
location
    worksheet = workbook.Worksheets(1) #get hold of the second worksheet
    worksheet.Select  #bring it to the front -need sometimes to run
macros, not for working with a worksheet from ruby
    range=worksheet.range("a1", "bw50") # range of spreadsheet
    #~ excel['Visible'] = false #make visible, set to false to make
invisible again. Don't need it to be visible for script to work


the value I am picking out of the spreadsheet is a number

11111111

using the following

ie.text_field
(:id,/AccountNumber/).set(spreadsheetdata[:'accountnumber'].to_i)

when the script enters data into the field it attempts to enter data as
follows 11111111.0 (decimal place materialises.)

I think ruby changes the format of the number 1111111 extracted from the
spreadsheet from an integer as specified using .to_i to another format
(hence the decimal place being displayed in the form field) How can I ensure
the format of the data extracted from excel stays as an integer or text,
allowing a leading zero as '01111111' or '11111111'








--
The second half of a man's life is made up of nothing but the habits he
has acquired during the first half.
  - Fyodor Dostoevsky
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to