D
Daniel Berger
Hi all,
I've got a user who's having a problem with the spreadsheet-excel package. It
looks like the Format#font_biff method is returning a bogus result. Here's
some code that simulates the default behavior:
# fontbiff.rb
font = "Arial"
dyheight = 200
cch = font.length
length = 0x0F + cch
record = 0x31
reserved = 0x00
grbit = 0x00
color = 32767
bold = 0x0190
font_script = 0
underline = 0
font_family = 0
font_charset = 0
fields = [dyheight, grbit, color, bold, font_script, underline]
fields.push(font_family, font_charset, reserved, cch)
header = [record, length].pack("vv")
data = fields.pack("vvvvvCCCCC")
p header + data + font
That should result in this string (on big endian machines):
"1\000\024\000\310\000\000\000\377\177\220\001\000\000\000\000\000\000\005Arial"
This can be confirmed by running this snippet, which should give you the same
string:
require "spreadsheet/excel"
include Spreadsheet
p Format.new.font_biff
But he's reporting this as the result:
"\0001\000\024\000\310\000\000\177\377\001\220\000\000\000\000\000\000\005Arial"
Any ideas what's happening here?
Thanks,
Dan
PS - Come to think of it, I forgot to ask him which version of Ruby he's
running, and which version of OSX.
I've got a user who's having a problem with the spreadsheet-excel package. It
looks like the Format#font_biff method is returning a bogus result. Here's
some code that simulates the default behavior:
# fontbiff.rb
font = "Arial"
dyheight = 200
cch = font.length
length = 0x0F + cch
record = 0x31
reserved = 0x00
grbit = 0x00
color = 32767
bold = 0x0190
font_script = 0
underline = 0
font_family = 0
font_charset = 0
fields = [dyheight, grbit, color, bold, font_script, underline]
fields.push(font_family, font_charset, reserved, cch)
header = [record, length].pack("vv")
data = fields.pack("vvvvvCCCCC")
p header + data + font
That should result in this string (on big endian machines):
"1\000\024\000\310\000\000\000\377\177\220\001\000\000\000\000\000\000\005Arial"
This can be confirmed by running this snippet, which should give you the same
string:
require "spreadsheet/excel"
include Spreadsheet
p Format.new.font_biff
But he's reporting this as the result:
"\0001\000\024\000\310\000\000\177\377\001\220\000\000\000\000\000\000\005Arial"
Any ideas what's happening here?
Thanks,
Dan
PS - Come to think of it, I forgot to ask him which version of Ruby he's
running, and which version of OSX.