Is there any a way to style a cell in excel background yellow and alignment center at the same time.
Is there any a way to style a cell in excel background yellow and alignment center at the same time.
danishfarhaj
Posts: 1Questions: 1Answers: 0
I'm trying to assign multiple styles at the same time to my columns of datatables.
if i try to give it some background color it works perfect
$('row:nth-child(2) c[r^="A"]:first', sheet).attr( 's', '16' );
But after this line i tried to centralizer the content of cell
$('row:nth-child(2) c[r^="A"]:first', sheet).attr( 's', '6' );
it centralizer cell and remove background. It's overwriting the styling.
Is there a way to apply both at the same time.
This discussion has been closed.
Answers
Hi @danishfarhaj ,
The attributes are listed on this page - '51' is the code for centered text. But you're right, you can only chose one from the list, so either coloured or centered I'm afraid.
Cheers,
Colin
You would need to create your own style definition then append it to the
excelHtml5
styles. This is not a trivial task but can be done. There are many threads discussing this. If you are interested you could start by searching the forum for keywordnumFmtId
.Here are a couple threads to help get started:
https://datatables.net/forums/discussion/comment/137637/#Comment_137637
https://datatables.net/forums/discussion/comment/108887/#Comment_108887
Here is a doc to help get you started:
http://officeopenxml.com/SSstyles.php
If you have trouble implementing this please post a test case with your code so we can help debug. Its been a long time since I've looked at this so I don't have an answer readily available for you.
Kevin