How to add header content to Material-UI's DataGrid Export to CSV? - material-ui

I would like to add header content to Material-UI's DataGrid Export to CSV feature. The Export to CSV only exports the contents of the table, but I'm working on a project where the client needs attribution and metadata added to the csv contents. By header content I mean additional string content that is not part of the table data. The content I am looking to add is basic string data and would likely only amount to a few lines.
I'm also open to using the paid XGrid version if that would allow for this.
Any thoughts or ideas for how to achieve this would be appreciated!

The API method getDataAsCSV() allows you to get the CSV as a string. Then, you can replace the Export CSV Button with a custom one which will call getDataAsCSV(), add the metadata to the string and save it.
If you think this is a good-to-have feature, you can open an issue to add metadata as an argument of CsvExportOptions.

Related

how to select header section in OpenOffice ODT document with TinyButStrong TBS

I can successfully manipulate fields in the header and footer sections of a DOCX document with TinyButStrong (TBS) through this code:
$TBS->PlugIn(OPENTBS_SELECT_HEADER);
$TBS->MergeField('abk', 'ainfo', true);
$TBS->PlugIn(OPENTBS_SELECT_FOOTER);
$TBS->MergeField('abk', 'ainfo', true);
However, this does not work with an ODT file that is just the DOCX file saved in a different format through LibreOffice.
I found out that I can make it work by manually selecting the enclosed file "style.xml", but this seems not the right way to do it as it does not address a document section in the abstract sense:
$TBS->PlugIn(OPENTBS_SELECT_FILE, 'styles.xml');
$TBS->MergeField('abk', 'ainfo', true);
Does anybody have a better solution?
I later found out that a multi-section DOCX document causes a similar problem and only its first section is processed. As Skrol29, the maintainer of openTBS, kindly noted, there is a small bug in version 1.10.0 that prevents proper selection of document parts. As a workaround do this:
$TBS->PlugIn(OPENTBS_SELECT_FILE, 'word/header2.xml', false);
$TBS->MergeField('abk', 'ainfo', true);
Proceed with all the sections (header3, header4...) you have. Note that the footers need extra selection.

Cannot retrieve the fields name from form PDF using pdftk

When I try to using
pdftk my.pdf dump_data_fields >result.txt
have empty data result
Your file my.pdf may not be compatible with pdftk. Convert the file first using the following command:
>pdftk my.pdf output my_converted.pdf
Then try,
>pdftk my_converted.pdf dump_data_fields > result.txt
I've taken this from the following http://www.fpdf.org/en/script/script93.php where the converting process is suggested when the fields won't write to the pdf file so converting before dumping the fields may not help.
If your pdf has fields you it should be fillable in your pdf viewer. If in isn't fillable then it would seem that it has no fields.
This is most likely because the pdf you are using doesn't have any data fields to dump! Use a tool like Adobe Acrobat to open the pdf, go to wherever you need to to Edit Fields, and add fields anywhere you need them to show up. Make sure they are named so you can utilize them by using the attributes[] call in pdftk.
I recommend using snake case (i.e. text box named 'first_name') and then you should have access to it using attributes[:first_name] = 'your text'.
Hope this helps, let me know if you have any other questions/issues.

Purpose for Word Open XML and content controls binding

For word report generation, I am looking at binding XML to content controls to see if it is any easier than to use Word Interop and hardcode index reference to content controls to assign values to them.
However, I don't really understand how to do it.
My work flow is entering information in Excel and then generate an XML file to have content controls populated by XML, however, what I read is the other way round: Word Control Control Toolkit and descriptions where the XML is populated by user entering information in Word, and then programmer to unzip docx file to retrieve the XML file.
How can I populate content controls with XML?
There are samples on generating Word documents from Word templates, XML and data bound content controls # http://worddocgenerator.codeplex.com/
Set up the mapped content controls in the 'template' docx using the content control toolkit or similar. Do this using a sample XML file containing your Excel data.
Now you have that template document, at run time you can inject your XML file into it (ie replace the custom xml part it contains, with your instance data), in C# or Java or whatever.
When the user opens the document in Word 2007/2010, the information in the custom XML part will automatically be copied into the bound controls, and visible to the user.
Note that content control data binding doesn't easily support repeating data (eg populating table rows) in Word 2007/2010, though there are ways to do it.

Crystal Report: export to excell generates "page break", column header is reapeated

Trying to export a report to excel, the generated document has kind of page break. The column header is repeated. The "page break" are in the same positition than if I generate a PDF report.
How can I remove this page break when exporting to excel? Is there some page size definition?
Have you tried ExportFormatType.ExcelRecord instead of ExportFormatType.Excel? The xls file will be created without formatting.
If actually the user is exporting report using ReportViewer Toolbar Export button you can:
Replace the CrystalReportViewer Control with the ReportExporter Control. It will export the report in the format you choose.
Or hide Export button from toolbar and put in the page buttons that exports programmatically
Call ExportToHttpResponse method
CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.ExcelRecord, this.Response , false, "report.xls");
Call ExportToDisk method
reportDocument.ExportToDisk(ExportFormatType.ExcelRecord, "report.xls");
Export dataset to excel (Look at Ahmed answer)
You can choose the way that best fits your needs, but you must try if it works with the runtime you use either in development or in release server.
ExportFormatType.ExcelRecord means that is generated an xls file, without formatting. If you set ExportFormatType.Excel fields that are marked as "Can Grow" are merged with an otherwise blank row below them.

Exporting data in enhanced Grid to csv or xml format using dojo

In my project we are using dojo framework in UI. We are having a functionality to exporting the data in the enhanced grid into excel/csv files. In the dojo toolkit, they are binding the id in the textarea but i need those values in the excel/csv file...can any one help in this issue...? if possible pls tell me how to export the enhanced grid data to excel/csv files...
If you are already using the Enhanced Data Grid, you should be able to include the exporter plugin - dojox.grid.enhanced.plugins.exporter.CSVWriter - to get the CSV text.
This will give you access to two main functions exportGrid and exportSelected that will take the contents and export them as CSV text.
Unfortunately that doesn't get them as a separate file (click to download), just the formatted text in a textarea (or whatever).
To get a "click to download CSV function), you could write a servlet/jsp proxy, which would take a POST from your page with the CSV text (from the plugin above) as part of the form and simply copy it back out with the correct headers to make it appear as an attachment.
response.setContentType("text/csv"); response.setHeader("Content-Disposition","attatchment;filename=name.csv")
This would require something server side though.. and at that point, you may want to consider having a servlet simply produce the CSV text directly.
http://dojotoolkit.org/reference-guide/dojox/grid/EnhancedGrid/plugins/Exporter.html