Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

Export with additional lines in header

Answered
Jaffrezic asked on December 26, 2019

Hi 
I need export pivot table with additional lines in header.
When I export a pivot I would like to add some lines in header. 
See file in atachment
Is it possible ?
Thanks
Regards
Franck

6 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster December 26, 2019

Hello, Franck,
 
Thank you for reaching out to us.
 
We would like to recommend using the customFields property of the report object. This property allows setting custom fields for Excel export or storing some additional information. They are not shown on the grid, but they will be displayed in an exported Excel table. Each object has the following properties:

  • name – String. Name of the custom field.
  • value – String. Value of the custom field.

 
The structure has to be similar to the following:

report: {
    "customFields": [
        {
            "name": "Field1",
            "value": "Value1"
        },
        ...
    ],
    ...
}

 
More about the report object and its properties can be found by the link: Report Object.
 
Please check out an example demonstrating an approach described above.
 
We hope it works for you.
 
Regards,
Illia

Public
Jaffrezic December 26, 2019

Hi Illia
Thanks for your answer, but your solution works only for excel export, but I need for all export : html, csv, jpg…
 
It’s possible ?
 
Thanks
Regards
Franck

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster December 27, 2019

Hello, Franck,
 
Thank you for your feedback.
 
Our team would like to kindly inform you that for now, there is no generic approach allowing add a header while exporting. However, we would like to recommend using the following approaches in order to implement such functionality for exporting in different formats.
 

  • Creating a custom title for HTML and PDF is possible using the header parameter of the exportTo API call. The header is set in HTML format. For PDF, it is rendered in the browser and added as an image to the exported file. More information about the exportTo method and its parameters can be found by the link: exportTo API call.
  • Data can be appended to the CSV using the following approach:
    • Get the data in CSV format using destinationType property of the params object that is a parameter of the exportTo method.
    • The data will be passed into the callbackHandler parameter of the exportTo API call, where it can be changed in the desired way.
  • For now, the only way to append additional information while exporting to the image is to define the title property of the grid object. The grid object itself is a property of options object. More information about options object and its properties: Options Object.

 
Please check out an example we have prepared, demonstrating the approaches described above.
 
We hope it helps.
 
Kind regards,
Illia

Public
Jaffrezic December 30, 2019

Hi Illia
Thanks for your answer.
Your approach for html and pdf is ok but your approach for csv and xls is not realy easy for our application. 
It should be great if we can have the same approach for each export (csv, html, xls, png).

Example :
for csv we could have
options.header = “My title\nMy sub title”
for xls we could have
options.header = “My title\nMy sub title”
Would it be possible to develop this functionality ?
Thanks
Franck

Public
Dmytro Zvazhii Flexmonster December 30, 2019

Hello Frank,
Thank you for your feedback.
The idea of making the CSV and XLS export header’s input consistent sounds reasonable. We a going to add an approach that should fit both of them.
 
Also, our dev team is going to add headers support for export to the image. We expect it to be consistent with the PDF and HTML exports.
 
All of that will be a part of the minor release with ETA Jan 27.
We will notify you as soon as it is available.
 
Regards,
Dmytro

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster January 28, 2020

Hello, Franck,
 
We are pleased to inform you that headers and footers for Excel, CSV and image export were added.
Now exports are consistent and can be applied through “headers” and “footers” export options properties.
For CSV and Excel, there is an option to apply mutly-rows headers adding the headers/footers the following way “Row1\nRow2\nRow3”.
 
Please check out an example we have prepared.
 
This is available in the 2.7.24 version of Flexmonster: https://www.flexmonster.com/release-notes/
 
You are welcome to update the component.
Here is our updating to the latest version tutorial for guidance: https://www.flexmonster.com/doc/updating-to-the-latest-version/ 
 
Please contact us in case any questions arise.
 
Best regards,
Illia

Please login or Register to Submit Answer