sheetjs icon indicating copy to clipboard operation
sheetjs copied to clipboard

[export excel] text color settings

Open esoni opened this issue 11 years ago • 16 comments

Hi, can you kindly explain how can i change the font color of the cell ? Can you show an example about it ? Thanks Dario

esoni avatar May 08 '15 15:05 esoni

This feature will be coming soon.

You can use protobi's (pietersv) branch for cell formatting for now: https://github.com/protobi/js-xlsx

Refer to this issue for more details on cell formatting as it relates to js-xlsx: https://github.com/SheetJS/js-xlsx/issues/128

harbhub avatar May 08 '15 15:05 harbhub

Thanks. Have you got a simple example ? i need the code of an export where a text inside a cell is red

esoni avatar May 11 '15 13:05 esoni

Do you know when the cell formatting will be released to master? We would love to make use of it. Thanks.

osecki avatar May 27 '15 20:05 osecki

+1

Also, anyone knows how to set background color of a cell?

rokj avatar May 28 '15 12:05 rokj

As far as I know, at this moment it is not posible. You can use protobi's (pietersv) branch for cell formatting for now (https://github.com/protobi/js-xlsx) and use this coffeescript code to achieve your aim.

Or you can wait till protobi's fork will be merged in js-xlsx master.

Best regards!

    cell =
            v: 'cell text'
            s:
              border:
                left:
                  style: 'thick'
                  color:
                    auto: 1
                top:
                  style: 'thick'
                  color:
                    auto: 1
                bottom:
                  style: 'thick'
                  color:
                    auto: 1
              fill:
                fgColor:
                  rgb: "FFFF0000"
              font:
                name: 'Arial'
                sz: 14
                color:
                  rgb: 'FFFFFFFF'

capitantrueno avatar Jun 10 '15 11:06 capitantrueno

Hi capitantrueno -- Thanks very much for the code snippet example.

Does anyone have a timeline for when protobi's fork will be merged into js-xlsx master? What is it waiting on? Thanks!

osecki avatar Jun 10 '15 12:06 osecki

is this feature not yet added to js-xlsx?

ashaik27 avatar Aug 12 '16 21:08 ashaik27

is this feature available now. seems like we cannot set cell styling...

OmalW avatar Sep 28 '17 10:09 OmalW

@OmalW : var excelCell = { v: coloumnVal, t: "s", s: { font: { name: 'Arial', sz: 12, bold: true, italic: false, wrapText: true, underline: false }, alignment: { wrapText: true, vertical: 'top' }, fill: { fgColor: { rgb: "FFFFAA00"} }, border: { top: { style: "thin", color: { auto: 1} }, right: { style: "thin", color: { auto: 1} }, bottom: { style: "thin", color: { auto: 1} }, left: { style: "thin", color: { auto: 1} } } } }; Try this, " fill: { fgColor: { rgb: "fce0b5"} }, "

Albion87 avatar Feb 08 '18 09:02 Albion87

@Albion87 , I need to set the style for cell. i tried your code but dint work.

kamthe avatar Apr 17 '18 10:04 kamthe

Above code help me to do all the styling for my excel file. @kamthe : Not sure what sort of style you need Try this website

Albion87 avatar Apr 17 '18 11:04 Albion87

@Albion87 , I am using write function. this function does not have cellStyle argument. I have array of array object such as [[column1,value1]]. it need to write this into excel. i need to apply style to cells. i believe that only read function has cellStyle argument.

kamthe avatar Apr 17 '18 12:04 kamthe

@Albion87 , Which function did you use for the code you have pasted?Are you reading/writing the excel?

kamthe avatar Apr 18 '18 07:04 kamthe

this is just possible in Pro version of this library in the free version dosn´t

JAntoniodomga avatar May 02 '18 19:05 JAntoniodomga

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 17:05 SheetJSDev

@OmalW : var excelCell = { v: coloumnVal, t: "s", s: { font: { name: 'Arial', sz: 12, bold: true, italic: false, wrapText: true, underline: false }, alignment: { wrapText: true, vertical: 'top' }, fill: { fgColor: { rgb: "FFFFAA00"} }, border: { top: { style: "thin", color: { auto: 1} }, right: { style: "thin", color: { auto: 1} }, bottom: { style: "thin", color: { auto: 1} }, left: { style: "thin", color: { auto: 1} } } } }; Try this, " fill: { fgColor: { rgb: "fce0b5"} }, "

this is not working for me ?how to use it

samgodar64 avatar Apr 09 '19 06:04 samgodar64