Hi all,
I'm using the FireFox API to write to a binary file from my JavaScript based FireFox extension.
So far I am fully able to write the information to the file in BIFF5 format, and re-size the columns successfully.
The problem I'm running into is no matter what I try, I can not seem to get the XF index (ixfe) in the LABEL record to point to the XF record. (That or my XF record is faulty)
Basically I'm trying to change the font weight in a few cells to bold.
I know I can use for statements to clean this code up a bit, but while I'm troubleshooting I'm doing it one record at a time so I can easily see whats going on.
This is what I'm writing for the BOF:
excelData[excelData.length] = pack("vvvvvv", 0x809, 0x08, 0x0500, 0x10, 0x096C, 0x07C9); // BOF Worksheet
excelData[excelData.length] = pack("vvvvvvvvvvv", 0x003D, 0x0012, 0x0000, 0x0000, 0x25BC, 0x1572, 0x0038, 0x0000, 0x0000, 0x0001, 0x0258); // WINDOW1
excelData[excelData.length] = pack("vvv", 0x0022, 0x0002, 0x0000); // 1904
excelData[excelData.length] = pack("vv", 0x0031, 0x0F+7);
excelData[excelData.length] = pack("vvvvvCCCCC", 0x00C8, 0x0001, 0x7FFF, 0x0190, 0x0000, 0x0200, 0x00, 0x01, 0x00, 7); // calibri 10 normal - index 0
excelData[excelData.length] = "Calibri";
excelData[excelData.length] = pack("vv", 0x0031, 0x0F+7);
excelData[excelData.length] = pack("vvvvvCCCCC", 0x00C8, 0x0001, 0x7FFF, 0x02BC, 0x0000, 0x0200, 0x00, 0x01, 0x00, 7); // calibri 10 bold - index 1
excelData[excelData.length] = "Calibri";
excelData[excelData.length] = pack("vv", 0x0031, 0x0F+7);
excelData[excelData.length] = pack("vvvvvCCCCC", 0x00C8, 0x0001, 0x7FFF, 0x02BC, 0x0000, 0x0200, 0x00, 0x01, 0x00, 7); // calibri 10 bold - index 2
excelData[excelData.length] = "Calibri";
excelData[excelData.length] = pack("vv", 0x0031, 0x0F+7);
excelData[excelData.length] = pack("vvvvvCCCCC", 0x00C8, 0x0001, 0x7FFF, 0x02BC, 0x0000, 0x0200, 0x00, 0x01, 0x00, 7); // calibri 10 bold - index 3
excelData[excelData.length] = "Calibri";
excelData[excelData.length] = pack("vv", 0x0031, 0x0F+7);
excelData[excelData.length] = pack("vvvvvCCCCC", 0x00C8, 0x0001, 0x7FFF, 0x02BC, 0x0000, 0x0200, 0x00, 0x01, 0x00, 7); // calibri 10 bold - index 5
excelData[excelData.length] = "Calibri";
excelData[excelData.length] = pack("vv", 0x0031, 0x0F+7);
excelData[excelData.length] = pack("vvvvvCCCCC", 0x00C8, 0x0001, 0x7FFF, 0x02BC, 0x0000, 0x0200, 0x00, 0x01, 0x00, 7); // calibri 10 bold - index 6
excelData[excelData.length] = "Calibri";
excelData[excelData.length] = pack("vv", 0x0031, 0x0F+7);
excelData[excelData.length] = pack("vvvvvCCCCC", 0x00C8, 0x0001, 0x7FFF, 0x02BC, 0x0000, 0x0200, 0x00, 0x01, 0x00, 7); // calibri 10 bold - index 7
excelData[excelData.length] = "Calibri";
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0xFFF5, 0x2020, 0x20C0, 0x8140, 0x15B3, 0x2040); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0x00, 0x2020, 0x20C0, 0x0000, 0x0000, 0x0000); //XF Messed up?
excelData[excelData.length] = pack("vvvvvvvvvv", 0x00E0, 0x0010, 0x0006, 0x0000, 0x00, 0x2020, 0x20C0, 0x0000, 0x0000, 0x0000); //XF Messed up? // User Defined
This is what I'm writing for the LABEL:
excelData[excelData.length] = pack("vvvvvv", 0x0204, Number(L)+8, Row, Col, 0x11, L);
excelData[excelData.length] = Value; // Cell Value
So if I'm not mistaken, 0x11 in the LABEL, is pointing to ixfe 17 which is the 16th XF record.
The XF record is pointing to ifnt (font index) of 0x0006 which is ifnt 6, or the 6th FONT record thanks to index 4 being unused.
What is happening is that the cells are still just using the default font (ifnt 0) regardless of what I have changed the ixfe in the LABEL record, or the ifnt in the XF record to.
I have read every ounce of documentation I could find, as well as tried to reverse engineer a few of the libraries that are out there for PHP.
At this point, any guidance would be greatly appreciated because I am completely out of ideas.
Thanks alot, folks!
EDIT
I have learned alot in the past couple hours, thanks for your help. I will be posting a new question for the new problem I'm facing regarding the Workbook Stream.
New question for anyone whom may track this down and have similar issues: http://stackoverflow.com/questions/3714051/biff5-excel-workbook-stream-problems-corrupt-file