CSS code in column value not recognized while using export csv/pdf in datatables 1.9
CSS code in column value not recognized while using export csv/pdf in datatables 1.9
Hi,
I have a column which has the following value
p { text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } Sample entry
The css style has to be applied to the data "Sample entry".
When i tried to export the table value to pdf/csv file, I noticed that the html code is getting ignored whereas along with the text "Sample entry", the css code is also getting exported.
The data in my pdf/csv file after export is
p { text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } Sample entry
Is there anyway wherein the css style can be applied before exporting to pdf/csv file in datatable.
Following is the snippet I am using
var SDomVal= '<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"Ti>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"p>';
var oTable = $("#Sample").dataTable({
bJQueryUI: false,
"sDom": SDomVal,
"oTableTools": {
"sSwfPath": "DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "Save As Excel",
"mColumns": [0]
},
{
"sExtends": "pdf",
"sButtonText": "Save as PDF",
"mColumns": [0]
},
{
"sExtends": "copy",
"sButtonText": "Copy",
"mColumns": [0]
}
]
},
"aButtons": ["test"],
"aaData": aNew,
"bRetrieve": true,
"aoColumns": [
{
"sTitle": "Value",
"bVisible": true,
"fnRender": function (obj) {
var val = obj.aData[0];
return val;
}
}
],
iDisplayLength:30
});
Please guide me.
Thanks in advance.
I have a column which has the following value
p { text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } Sample entry
The css style has to be applied to the data "Sample entry".
When i tried to export the table value to pdf/csv file, I noticed that the html code is getting ignored whereas along with the text "Sample entry", the css code is also getting exported.
The data in my pdf/csv file after export is
p { text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } Sample entry
Is there anyway wherein the css style can be applied before exporting to pdf/csv file in datatable.
Following is the snippet I am using
var SDomVal= '<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"Ti>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"p>';
var oTable = $("#Sample").dataTable({
bJQueryUI: false,
"sDom": SDomVal,
"oTableTools": {
"sSwfPath": "DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
{
"sExtends": "xls",
"sButtonText": "Save As Excel",
"mColumns": [0]
},
{
"sExtends": "pdf",
"sButtonText": "Save as PDF",
"mColumns": [0]
},
{
"sExtends": "copy",
"sButtonText": "Copy",
"mColumns": [0]
}
]
},
"aButtons": ["test"],
"aaData": aNew,
"bRetrieve": true,
"aoColumns": [
{
"sTitle": "Value",
"bVisible": true,
"fnRender": function (obj) {
var val = obj.aData[0];
return val;
}
}
],
iDisplayLength:30
});
Please guide me.
Thanks in advance.
This discussion has been closed.
Replies
Allan