-
-
Notifications
You must be signed in to change notification settings - Fork 241
Open
Description
If I understand the documentation correctly, one should be able to pass an IO object to the spreadsheet.write() method, and indeed this does seem to produce some output, but...
This works:
book.write('timetable1.xls')
This also works:
buffer = StringIO.new
book.write(buffer)
buffer.rewind
File.open("timetable2.xls", "w:ASCII-8BIT") do |file|
file.write(buffer.read)
end
but this does not work:
File.open("timetable3.xls", "a+:ASCII-8BIT") do |file|
book.write(file)
end
A file is produced but it isn't recognized by anything as being an XLS file. The "a+" is necessary because without it the call on "book.write()" produces an exception because it can't read (!) from the file. The ASCII-8BIT I tried adding because it seems to be necessary on the second working version in order to produce output identical to the first version. However, it doesn't seem to help.
Metadata
Metadata
Assignees
Labels
No labels