export the table data as CSV format - smartgwt

in my web project there is no any servlet and other things. only pure core java with gwt packages.
In client side I have a ListGrid with some data. if want to export as .csv format, what should I have to do?
here I gone through samples and blogs are through servlet but I dont have any servlet at all.
how to save as .csv format
Thanks

Related

Is there a way to make an XML file in RDB using Jena?

I used apache-jena-3.1.0 and JDBC to read and save XML files on a table (nodes, prefixes, quads, and trips) that was pre-made in MariaDB.
I wonder if I can make an XML file by reading MariaDB using Apache-jena.
And I wonder if I can save the stored data (nodes, prefixes, and triples) back to MariaDB in its original form (appropriate for RDB).
I am constantly trying to search for related jar or mathod.
Thank you.

How to export data as a XES file in rails?

I am working on a application that allows users upload and edit CSV files containing process activity logs.
I am not storing the data in the database.
So far the user can download the data as a new .csv file.
Now I want to convert that data into a XES file (this a special XML format used mainly for process mining in tools such as ProM framework).
I couldn't find any hint on how to do that.
I wonder if there's a rails gem or something.
Thanks in advance
ps.: here is the project code.
A simple method would be imported in Disco and by using this tool, exported in XES format ( I always use this method).
If you don't access to Disco another solution would be used ProM software. There is a plugin for this platform for converting CSV file to XES format ( developed by F. Mannhardt).

Grails 2.4.4 How do I export excel file?

I've looked at some plugins but no success.
I tried Export Plugin 1.6 as well but the view doesn't recognize r:.. and export:.. tags.
What is the best way to export rows of data from postgresql database into an excel file from a click of a button?
Thank you.
you could create a gsp which renders a .csv-file and set the content-type of the response to application/vnd.ms-excel within the controller.
that's the easiest way, but you will not be able to control the format of cells.
Apache POI - as mentioned by Abincepto - is another solution which is more complex but gives you full control over the generated excel file
Did you try directly with apache poi ?
From the website:
The Apache POI Project's mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). In short, you can read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java. Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for porting other OOXML and OLE2 formats and welcome others to participate.
EDIT:
Here is a tutorial: Read / Write Excel file in Java using Apache POI
and a quick guide
EDIT2:
I just found another link using Grails that could help you. The example use another library: jexcelapi
The export plugin is dependent on the resources plugin. You can add the resources plugin and try again. I use resources 1.2.8. Also you need to add this to your dependencies:
dependencies {
............
// Needed for the export plugin?
compile 'commons-beanutils:commons-beanutils:1.8.3'
plugins {
............
runtime ":resources:1.2.8"

Importing csv/xls format files with smartGWT

I am using smartgwt free version (not EE). Is there a built in widget to handle importing .csv or excel format files?
I can currently export records from a listGrid to csv. I want to be able to open up another browser, and import the csv file, and based on the configuration that I have exported onto the csv file, re-create the records that I have exported.
I've done the same thing, to achieve that I would suggest a custom datasource using gwt-rpc. You can get the code here.
https://code.google.com/p/smartgwt-extensions/
The thing is I've used gwtupload to send the excel file to the server. Once that is done call fetch to your custom datasource with the file path that was uploaded to the server. Using Apache POI on the server side to parse the data and return that as a result to your datasource fetch call. Within the execute fetch create Record objects and add them to your grid.
you can get the gwtupload from here,
https://code.google.com/p/gwtupload/wiki/GwtUpload_GettingStarted

XML file or database in this particular case (file updated frequently)

I have a list of URL and I should loop over them every minute or so and save the last successful access time into an XML file or database. Obviously, the URL and some short description will be saved in file as well.
I'm wondering whether XML files are reliable enough or I'm better with a database? If I must go with the database option, which one?
Please advise. Thanks.
You can use XML file for this purpose.
There are lot of options for XML like XML Data Binding, TXMLDocument, XML with ClientDatasets etc.
The simplest option is XML with ClientDataSet.
This is the procedure:
Drop a ClientDataSet on the the form.
Add FieldDefs you need to the ClientDataSet.
Right click on the ClientDataSet component and click Create Dataset.
Right click again and click Save To MyBase XML Table.
You XML is ready and from now onwards you can use ClientDataSet1.LoadFromFile() and ClientDataSet1.SaveToFile() functions to load and save data.
Then you can assign ClientDataSet DataSource to the DBGrid.
I would also use a XML (or JSON) file storage. A simple way to build wrapper classes for a XML file is the XML Schema Binding Generator Wizard in Delphi Professional, or the Data Binding Wizard (in Enterprise / Architect). You only need to provide an example XML or a W3C XSD file. The wizard will create DOM based classes and binding code.
Tutorials:
Delphi XML Binding Wizard Tutorial
Delphi Programming Tutorial #39 - XML Data Binding
I would not use XML. To modify an XML file you have to rewrite it, XML is not good at random read and writes, unless you can modify it only in memory and then write it when needed. Well, every minute is not a problem, unless the XML gets very large. An XML file is reliable as much as your application is in writing it. If you need more, you should consider a database. For local access something alike SQLite or Firebird embedded could be your choice.

Resources