TableTools PDF export: Align text left but numbers right
TableTools PDF export: Align text left but numbers right
hkd66
Posts: 2Questions: 0Answers: 0
Hi
Within the DataTable on the web page everything is fine: I gave the s with numbers the css class .text-right and they are displayed as numbers should be displayed. :-)
[code]
.text-right {
text-align: right;
}
[/code]
However, in the PDF-output generated by TableTools all columns are aligned left. This makes large numbers together with small numbers in the same column quite unreadable.
Any ideas how to solve this?
Within the DataTable on the web page everything is fine: I gave the s with numbers the css class .text-right and they are displayed as numbers should be displayed. :-)
[code]
.text-right {
text-align: right;
}
[/code]
However, in the PDF-output generated by TableTools all columns are aligned left. This makes large numbers together with small numbers in the same column quite unreadable.
Any ideas how to solve this?
This discussion has been closed.
Replies
Allan
I have PHP+MySQL data and i'm printing on datatable. I want to style PDF, so i changed some ActionScript on AlivePDF. But I can't align right per now...Maybe with "datagrid" instead of "grid"...
Allan
[code]
{
"sExtends": "pdf",
"sButtonText": "PDF",
"sTitle": "Title",
"bSelectedOnly": true,
"bFooter": true,
"fnCellRender": function ( sValue, iColumn, nTr, iDataIndex ) {
// Append the text 'TableTools' to column 5
if ( iColumn === 10 ) {
var dato = sValue + " €";
return padspace(dato,9); /* fill with _ to 9 length */
}
return sValue;
},
"mColumns": [ 1, 2, 9, 10],
"sToolTip": "Exportar como PDF"
},
[/code]
and the function padspace:
[code]
function padspace(n, length) { // fill with _
n = ("_______________" + n).slice(-length);
return n;
}
[/code]
and the pdf shows align right:
[quote]
_123.45 €
__23.45 €
___3.45 €
[/quote]