Excel export cells with color
Excel export cells with color
Hi,
I have a table with selects in it which I'm trying to export with background color of the select element.
I'm using customize to do this:
customize: function( xlsx ) {
var sheet = xlsx.xl.worksheets['sheet1.xml'];
table.cells().every( function () {
var data = this.data();
if( $(data).is("select")){
var color = $(data).find(':selected').parent().css('backgroundColor');
if(color == "rgb(255, 64, 64)"){
$(data).parent().attr( 's', '35' );
console.log(color);
}
}
} );
}
I've managed to get the color with console, but cannot set it in Excel.
Can you please help?
Answers
See if the examples in this thread help. They look a bit different than what you have. If not please post a test case so we can work with your code to understand what you have and make suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Here is an example:
http://live.datatables.net/sotocuza/1/edit
I want to export all the fields with background-color in all rows.
The best way to do that would be to modify
exportOptions
, modifyingrows
to have a function for therow-selector
- something similar to this which is modifyingcolumns
,Colin