Jason Fox
10/12/2006 11:04:00 PM
The rewind worked! -- I don't quite understand why though.
After writing out the temporary file I am passing the _name_ of the
file to the ParseExcel parse method, so why is the file pointer at the
end of the file? Doesn't ParseExcel just open up a new IO stream using
the passed in filename?
# create the temporary file from the data stored in the database
(RoR model)
temp_file = Tempfile.new('project_file')
temp_file.write(project_file.file_data)
# parse the spreadsheet with parseexcel
workbook = Spreadsheet::ParseExcel.parse(temp_file.path)
Thanks for your help!
P.S. - Is there a way to have parseexcel work directly off of an IO
stream or do you _always_ have to have a file on-hand?
Regards,
Jason
Hannes Wyss wrote:
> > Hannes I have emailed you this message along with the files that I am
> > using and the complete stack trace.
> .. so far nothing has arrived on my side of the atlantic.
>
> > When I use parseexcel in the console to parse the original file, it
> > works fine. However, when I parse the temp file that I create from the
> > database it throws this exception. The files are of identical size, but
> > a call to diff reports that they do indeed differ. Excel, however,
> > opens the temp file without issue.
> Ah, well then it _would_ be good to see your code.
> Do you maybe need to rewind your file before passing it to ParseExcel?
>
> all the best
> Hannes