Sheetjs: [export excel] text color settings

Created on 8 May 2015  路  16Comments  路  Source: SheetJS/sheetjs

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

Style

Most helpful comment

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

All 16 comments

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

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

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

+1

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

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'

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!

is this feature not yet added to js-xlsx?

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

@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 ,
I need to set the style for cell. i tried your code but dint work.

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 ,
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.

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

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

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.

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesbillinger picture jamesbillinger  路  4Comments

Alex0007 picture Alex0007  路  3Comments

eyalcohen4 picture eyalcohen4  路  3Comments

gustavosimil picture gustavosimil  路  3Comments

happy0088 picture happy0088  路  3Comments