sheetjs icon indicating copy to clipboard operation
sheetjs copied to clipboard

Set cell style when creating new .xlsx

Open jsonDoge opened this issue 9 years ago • 7 comments

Is it possible to set cell style? if, yes how? When trying to parse it clearly returns it: A1: { t: 'n', v: 1, w: '1', s: { patternType: 'solid', fgColor: { rgb: 'FFFF00' }, bgColor: { indexed: 64 } } } }

But what about setting it?

jsonDoge avatar Mar 29 '17 13:03 jsonDoge

Writing styles is currently not supported, and we will be changing the style representation soon. Stay tuned.

SheetJSDev avatar Mar 29 '17 14:03 SheetJSDev

The only question that remains : when ?? I'd love to do my part in this if you need !

sebius8780 avatar Apr 21 '17 09:04 sebius8780

@SheetJSDev Any ideas on when that would land? It would be really awesome to incorporate into my current project. We're looking into some pretty ugly workarounds right now and a supported solution would obviously be way better.

shoshannamb avatar May 09 '17 17:05 shoshannamb

@Matas555 , @shoshannamb , i just make a fork, where try to implement styles and images from another forks to current version in main project (0.10.2) https://github.com/xSirrioNx/js-xlsx

xSirrioNx avatar May 17 '17 12:05 xSirrioNx

@SheetJSDev : is it possible to format XLSX document before export from the html

Albion87 avatar May 18 '17 15:05 Albion87

@xSirrioNx -- I tried your branch with the following configs, and it did not work. Any suggestions?

    let wb = XLSX.utils.table_to_book(tbl);
    wb.Sheets.Sheet1.A1.s = { fill: {patternType: "none",fgColor: {rgb: "FF000000"},bgColor: {rgb: "00000000"}} }
    let wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'binary' });

vinhboy avatar Jun 19 '17 22:06 vinhboy

We offer this in the Pro compendium. Since companies have paid for the features already, it would be unfair to them if we turned around and made it available as open source. We have a longer comment in a gist.

SheetJSDev avatar May 20 '18 18:05 SheetJSDev