forked from sheetjs/sheetjs
biff8 write column widths
This commit is contained in:
parent
36a1a4e9b8
commit
bf4736e966
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,4 +1,3 @@
|
||||
*.*s linguist-documentation
|
||||
*.html linguist-documentation
|
||||
|
||||
*.md text eol=lf
|
||||
|
@ -967,6 +967,20 @@ function parse_ColInfo(blob, length, opts) {
|
||||
if(opts.biff >= 5 || !opts.biff) o.level = (flags >> 8) & 0x7;
|
||||
return o;
|
||||
}
|
||||
function write_ColInfo(col, idx) {
|
||||
var o = new_buf(12);
|
||||
o.write_shift(2, idx);
|
||||
o.write_shift(2, idx);
|
||||
o.write_shift(2, col.width * 256);
|
||||
o.write_shift(2, 0);
|
||||
var f = 0;
|
||||
if(col.hidden) f |= 1;
|
||||
o.write_shift(1, f);
|
||||
f = col.level || 0;
|
||||
o.write_shift(1, f);
|
||||
o.write_shift(2, 0);
|
||||
return o;
|
||||
}
|
||||
|
||||
/* [MS-XLS] 2.4.257 */
|
||||
function parse_Setup(blob, length) {
|
||||
|
@ -164,6 +164,16 @@ function write_ws_biff8_hlinks(ba/*:BufArray*/, ws) {
|
||||
delete ws['!links'];
|
||||
}
|
||||
|
||||
function write_ws_cols_biff8(ba, cols, ws) {
|
||||
if(!cols) return;
|
||||
var cnt = 0;
|
||||
cols.forEach(function(col, idx) {
|
||||
if(++cnt <= 256 && col) {
|
||||
write_biff_rec(ba, "ColInfo", write_ColInfo(col_obj_w(idx, col), idx));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function write_ws_biff8_cell(ba/*:BufArray*/, cell/*:Cell*/, R/*:number*/, C/*:number*/, opts) {
|
||||
var os = 16 + get_cell_style(opts.cellXfs, cell, opts);
|
||||
if(cell.v == null && !cell.bf) {
|
||||
@ -227,6 +237,8 @@ function write_ws_biff8(idx/*:number*/, opts, wb/*:Workbook*/) {
|
||||
write_biff_rec(ba, "HCenter", writebool(false));
|
||||
write_biff_rec(ba, "VCenter", writebool(false));
|
||||
/* ... */
|
||||
if(b8) write_ws_cols_biff8(ba, ws["!cols"], ws);
|
||||
/* ... */
|
||||
write_biff_rec(ba, 0x200, write_Dimensions(range, opts));
|
||||
/* ... */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user