Export data Telerik grid - telerik-grid

I'm using RadGrid from Telerik (RadGrid.Net2 (I know I should upgrade to a newer version, but that is not an option here..)). One of it's features is to export data to excel. With grid.MasterTableView.ExportToExcel(); an excel file is created with filtered and sorted data from the grid (all pages). How can i grab this data?
grd.ExportSettings.ExportOnlyData = true;
grd.ExportSettings.IgnorePaging = true;
grd.MasterTableView.ExportToExcel();
I want to grab the same data as Telerik is writing to excel but can't figure out how to do this..
grd.MasterTableView.GetExportDataAsDataTable() would be perfect ;)

I guess you could be able to do this by inspecting the code in ExportToExcel, and hooking on some logic to the MasterTableView, but I really don't think there are any 'standard' way of doing this..

Related

Tabulator - Download and re-use changes

I am new to Tabulator and started building my first project. While usage and setup is very intuitive and nicely built I struggle with one concept. I want to keep changes and entries I made to the table and load them again when re-opening the page.
My first thought was to download all entries as csv or xls and then import either from an array/JSON or from an HTML table. Is this the preferred way or is there another method I can use?
Thanks!
Note: I am using version 4.1
Tabulator doesn't include what you are looking for. However, you can use Tabulator to retrieve the table's values. As for saving and restoring the edited data, you may want to use your browser's localStorage: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

DataTables export to excel

I'm currently working on a project (developed using laravel, php, javascript, jquery, html), containing a large amount of data, so I'm using DataTables to display them with serverside set to true. What I'm trying to figure out is how to export the complete table to an excel file - right now it only saves one page (the one being shown at that very moment ) - using the Button extention.
I've been reading about it for a while now but still can't figure out a way to do this. I understand that, since serverside is set to true,
the only rows that exist on the client-side are those shown in the table at any one time.
But how can I get the complete table? Any help would be appreciated!
UPDATE:
So I create the excel file with the data I want in the backend, using PHPExcel, but now the problem is that it is saved server-side, while I wanna make it downloadable (client-side). From what I've been reading, I must add the appropriate headers to do so, but nothing I've tried works. Using
this, I managed to output the data of the excel in the screen, but it just shows gibberish... I should probably also mention that I'm new at this!

How to directly export a collection of DTOs to CSV, Excel or PDF?

I have a List<MyDto> which I want to export with PrimeFaces. I tried with <p:dataExporter>, but it seems that it only uses UI <p:dataTable> content.
How can I directly export a list of DTOs to CSV, Excel or PDF?
You need a library to handle this. Primefaces doesn't inherently know how to display your data (it analyzes the columns and then exports based on that) so you need to give it some hints. The short answer is that you can easily create a table either programatically via reflection on the DTO and binding it to the page or by creating a simple data-table and set it to a style of "display:none" and then using the exporter.
Alternatively you can look at a reporting suite like JasperReports that handles "printing" to the above formats, but again, you will need to do something to interpret it. If you don't care about performance JSON-Lib has a very nice "toXML" method that will rip down a DTO to xml which could then be easily exported to any of the formats you choose.
Basically, you're looking at ~ 1 hour of work if it is a complex set of DTOs or 10 minutes if it isn't--as long as bandwidth isn't an issue this should be completely painless.

how to import excel data and display in grid?

i am using ExtGWT(gxt). i have a requirement where i need to import excel data and display the data in a grid. please help me how to achive this?
Thanks!
This is two completely separate thing to do...
First you have the import of the excel file, you can put this directly on the grid as it will require being processed on server side. Likely into a database on the server.
A quick search found this library to do just that
The GXT application can then retrieve this data and place it into a grid by retrieving a list of POJOs and converting to BeanModel's for use in the ListStore of the grid
Best example of loading data into a Grid see explorer here.
This should get you started as I cannot be sure of specifics without more information of your set up.

SQLite data into Excel?

I wish to pull data from a large SQLite database into Excel. I'll want to do so quite interactively so don't want to export CSVs or anything like that. I have seen the sqliteodbc website on ch-werner.de but does that work with Excel 2007?
What are the best options?
Actually I have gone through the ch-werner.de file mentioned in the question and it works well, even in Excel 2007. Simply make sure to register your database using the ODBC option in the Windows control panel.
Excel recognizes XML and the format is something like this:-
<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:html=\"http://www.w3.org/TR/REC-html40\">
<DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">
You might want to create a sample of the output you want in Excel, save it as XML data. Open your regular text edit, and voila... you got the XML skeleton.
Now programmatically converting SQLite to Excel, that's another thing. You didn't mention what language you're conversant with.

Resources