[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Parseexcel retrieve strange chars

Luiz

12/27/2006 2:49:00 PM

Hi,

I am a Ruby newbie, and I am trying to use parseexcel library to
retrieve some information from a spreadsheet, but when I try this, I
receive the chars contained on the cell alternated square chars. Does
anybody knows how to solve this?

Thanks,

Luiz

2 Answers

Luiz

12/27/2006 7:49:00 PM

0

I print the square code char and it is zero (nil). Please, somebody
help me.

workbook = Spreadsheet::ParseExcel.parse('myspreadsheet.xls')

# usually, you want the first worksheet:
worksheet = workbook.worksheet(0)

# now you can either iterate over all rows, skipping the first
number of
# rows (in case you know they just contain column headers)
myVal = worksheet.cell(0,4).value
puts myVal

Luiz wrote:
> Hi,
>
> I am a Ruby newbie, and I am trying to use parseexcel library to
> retrieve some information from a spreadsheet, but when I try this, I
> receive the chars contained on the cell alternated square chars. Does
> anybody knows how to solve this?
>
> Thanks,
>
> Luiz

Chris Shea

12/27/2006 8:02:00 PM

0


Luiz wrote:
> I print the square code char and it is zero (nil). Please, somebody
> help me.
>
> workbook = Spreadsheet::ParseExcel.parse('myspreadsheet.xls')
>
> # usually, you want the first worksheet:
> worksheet = workbook.worksheet(0)
>
> # now you can either iterate over all rows, skipping the first
> number of
> # rows (in case you know they just contain column headers)
> myVal = worksheet.cell(0,4).value
> puts myVal
>

If you're sure they're all null characters, you can always use gsub to
get rid of them:

myVal.gsub!(/\000/,'')


Chris Shea