Table tools, pdf: add style? At least bold and italic?
Table tools, pdf: add style? At least bold and italic?
overnoise
Posts: 1Questions: 0Answers: 0
Hi, probably I'm missing something.
Datatables saved my life but now I have a really bad problem for me:
I need to export a pdf from a table that has some and text...
Without them the table is pretty illegible...tell me I can do that!! :(
Datatables saved my life but now I have a really bad problem for me:
I need to export a pdf from a table that has some and text...
Without them the table is pretty illegible...tell me I can do that!! :(
This discussion has been closed.
Replies
Allan
but in the download package, i can not find the copy_cvs_xls_pdf.swf's Flex project source code. After modifying the ZeroClipboardPdf.as code, is there any way to recompile it and output a new copy_cvs_xls_pdf.swf?
For my question, i want to export a pdf with japanese font supported. any suggestion?
thank you for your good work!
[code]
/* Compile using: mxmlc --target-player=10.0.0 -static-link-runtime-shared-libraries=true -library-path+=lib ZeroClipboardPdf.as */
[/code]
You'll need the Flex 4 SDK to build the SWF - which you can get free from the Adobe open source pages.
Allan
However the column name with
tag in html can not not be rendered correctly in PDF. What shall i do with this?
for example
now: AA
BB in html, AABB in pdf
excepted: AA
BB in html, AA\nBB in PDF
Thank you!
For the
issue, I think you'll need to add in a 'replace'. str.replace('
','\n'); or something like that should do it.
Allan
1.modify PDF.as,
- var txt2:String = findAndReplace(')','\\)',findAndReplace('(','\\(',findAndReplace('\\','\\\\',text)));
+ var txt2:String = escapeIt(text);
s - but I'm such a novice, I can't seem to get anything to work.
First of all, where in ZeroClipboardPdf.as would I add the recommended str.replace('
','\n');?
And I've tried following instructions on recompiling the file, but I keep getting this error: "A file found in a source-path 'ZeroClipboardPdf' must have the same name as the class definition inside the file 'ZeroClipboard'." I was able to compile the ZeroClipboard.as file to a .swf, so it seems there is something wrong with the ZeroClipboardPdf.as file?
-library-path+=lib - is this the path to the lib inside of the as3 directory (tabletools), or the lib inside of the flex_sdk directory?
Also, I have some tables that have images in them (checkmark by certain entries in the table. Datatables picks them up and can even sort by them which I didn't expect which is great, but again tabletools comes along and do not display them on the PDF (the checkmarks being the important part of the PDF.
Another issue was when using the print button, there is no inherent way to put a title on top or the printout. I don't know what other people use tabletools for, but I imagine it would be mostly report related, which by definition has data in a table, and a title on top. I have the title on the page already, but because table tools ONLY shows the table itself when the print button is pressed. I made a crud workaround where I put hidden fields on the page, used jquery to get the values, and was able to re display them on the top of the print preview, again, very cumbersome, shotty output.
Datatables is PERFECT, can't find one thing that could be changed. Tabletools however is great in concept, but so pooorly done, that i cant see anyone using this with full satisfaction, and anyone who is using it, is probably putting up with the limitations because the are few other altnatives, but it is so inefficient, that the idea it is supposed to help cut down time and effort for developers is silly. The only part of my fairly complicated web app that I can't easily control is all the tabletools stuff, so that leaves dropping tabletools and adopting a more user friendly, php PDF solution which are majorly customizable, readily available, and clear documentation, but does unfortunately take some development, however i feel it would have been less time overall considering all the time spent implementing tabletools just to find all the limitations, and hope no one else wasted as much time on tabletools as I did, for such mediocre and clumsy output,
Allan
Thanks for writing table tools. I've read through the above thread, but I'm still not clear... How can I add a newline to the "sPdfMessage" section, so I can have a multi-line header on my generated PDF?
Thanks a lot...
-- Chad
Looking at the TableTools code, I don't think it is possible at the moment. The issue is that TableTools is using \n as a field separator, so if you add \n for your new line, it will treat the next line as a new field. A bit naff that :-(.
It would need a change to both he TableTools JS and AS3 scripts. Something I'll consider for v3, although pull requests before then are welcome :-). In the mean time the easiest solution is to modify the AS3 to treat '---' (for example) as a newline in the message string - just to do a replace on it.
Allan
I also implemented the same thing but there is no action when i click on the buttons.
What should I do . Please suggest me something I have got stuck.
My code is
$('#table1').dataTable( {
"bJQueryUI": true,
/* "sPaginationType": "full_numbers", */
"bProcessing": true,
"bServerSide": true,
"bDestroy": true,
"bAutoWidth": true,
"sScrollX": "940px",
//"sScrollY": "250px",
"bScrollCollapse": true,
"aoColumns": [
null,
null,
null,
null,
null,
null,
{ "bSortable": false }
] ,
"sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
"oTableTools": {
//"sSwfPath": "/public/swf/ZeroClipboard.swf",
"sSwfPath": "//swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
"csv",
"xls",
{
//"sExtends": "collection",
"sExtends": "pdf",
"sTitle": "Report Name",
"sPdfMessage": "Summary Info",
"sPdfOrientation": "landscape",
//"sSwfPath": "/swf/ZeroClipboard.swf",
"fnClick": function( nButton, oConfig ) {
this.fnPrint( true, oConfig );
},
"print"
]
},
"sAjaxSource": url,
"fnServerData": function ( sSource, aoData, fnCallback ) {
// Add some extra data to the sender
//aoData.push();
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
});
The buttons of TableTools are getting displayed but nothing is happening on clicking on them,