Need a special offer?Find out if your project fits.
+

custom header to export

Resolved
Rafael Matos asked on April 3, 2018

Hello ,  I have a question, is it possible to configure or add a custom header with title, logo ... at the time of export?

5 answers

Public
Tanya Gryshko Tanya Gryshko Flexmonster April 4, 2018

Hello, Rafael,
Thank you for posting your question on our support forum.
With Flexmonster pivot you can configure custom headers and footers when exporting to PDF, HTML or printing. Also, when exporting to Excel you can add custom fields which will be shown in the exported table.
For more information and examples please refer to Export tutorial
Please share your feedback.
Regards,
Tanya

Public
Rafael Matos April 5, 2018

Hello, would you like to change the export param using the same menu?
is to use the export menu itself, but only add the export parameter for header creation in the exported documents.
 
function customizeToolbar(toolbar) {
// get all tabs
var tabs = toolbar.getTabs();
toolbar.getTabs = function () {
// delete the first tab
delete tabs[0];
delete tabs[1];
delete tabs[2];
console.log('tab5:: ',tabs[3].menu[5]);
tabs[3].menu[5].handler = function(){
this.pivot.exportTo('pdf', params);
};
return tabs;
}
}

Public
Rafael Matos April 5, 2018

so it does not generate the file.
function customizeToolbar(toolbar) {
// get all tabs
var tabs = toolbar.getTabs();
toolbar.getTabs = function () {
// delete the first tab
delete tabs[0];
delete tabs[1];
delete tabs[2];
//delete tabs[3];
tabs.push({
id: "fm-tab-export-pdf",
icon: this.icons.export_pdf,
title: 'PDF',
handler: function(){
this.pivot.exportTo('pdf', {
destinationType: 'server',
header:"<div>NEW PDF 123654</div>",
footer:"<div>##CURRENT-DATE##</div>",
url: 'your server-side script'
});
}
});
//console.log('tab5:: ', tabs ,tabs[3].menu[5]);
return tabs;
}
}

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster April 5, 2018

Hello Rafael,
 
I used the code you provided in the previous messages to create the following sample on JSFiddle: http://jsfiddle.net/flexmonster/mugLx40n/

The PDF file is being generated successfully with header and footer and saved locally.
 
The only change I made is that I replaced quotes and double quotes in your code sample. Also, I commented out destinationType: "server" and url parameter, because to save PDF to the server you should provide the component with a real path to the server-side script which can save this file.
 
Please let me know if the sample helped you to achieve the result you expected.
 
Kind regards,
Iryna

Public
Rafael Matos April 6, 2018

thank you so much.

Please login or Register to Submit Answer