PrimeFaces DataExporter for big data - excel

I have 65000 data for getting from DB into excel.But PF DataExporter component is not writing big data into the excel.What can I use for this process?Is there a library for this process?

You can use:
Apache POI Some examples - Quick guide very easy to use and excellent simple examples
Jasper reports Just link - needs some time to figure it out
If you need just one excel export, use Apache POI.
If you have a lot of reports, i would recommend you to use Jasper reports because you can have option to export it to PDF, Excel, Word and other formats.
Good luck!

Related

Primefaces pdf generator multiple tables

I recently started using PrimeFaces dataExporter to generate pdfs. I am in need of not only inserting one of my data tables into the pdf but multiple. I am also in need of writing more information into the pdf.
I did research and it looks like there is still no implementation for multiple tables. Someone please confirm this. However, is it possible to write data to the pdf?
Thanks!
You cannot do this in the PrimeFaces dataExporter, but you can in the one that comes with PrimeFaces Extensions.
use this link
http://www.primefaces.org/showcase-ext/sections/exporter/multipleTables.jsf

Jboss export excel for large data

I am using Jboss 7.1 developer edition.
Currently i am using Apache poi for the excel export.
But i unable to export the large data from this jar, i want some other solution for the excel export.
While i try to use Apache poi , its endup with out of memory exception.
Approximately i need to export 50 X 8 cells in one sheet , totally 40 sheets in a single export
I saw some suggestion of , jboss seam excel export. Will it be helpful for me.
Please suggest any solution for this.
Thanks,
Ram.K
With JExcel you can choose if process data in memory or if use temporary files (setUseTemporaryFileDuringWrite(boolean)).
Take a look on EasyXLS Excel library:
http://www.easyxls.com/manual/getting-started/easyxls-java-excel-library.html
Here you can find some directions on how to use EasyXLS for better performance:
http://www.easyxls.com/manual/tips-and-tricks/export-large-excel-file.html

JasperReports: How to define a header in Excel

I'm cleaning up a legacy application which uses Jasper Reports 3.1.2, and am trying to figure out how to define a header that shows up as the header in the generated Excel spreadsheet (under Page Setup, Header/Footer). The existing code already does this for the footer using:
exportParameters.put(JRXlsAbstractExporterParameter.LEFT_FOOTER, "My footer text");
I can't find an equivalent parameter for the header in the JRXlsAbstractExporterParameter class.
Is there a way to do this in the JRXML template, or via the API ?
Adding a screenshot from the generated Excel report which shows that Excel detects the footer that was defined in the JRXlsAbstractExporterParameter class (code above). I am trying to do the same with the header.
Looking at JasperForge Config Reference, the JRXML header and footer properties are not supported until 3.7.5. In my opinion, it would be easier upgrading to at least version 3.7.5 to accomplish what you're attempting, update your jrxml files, and do regression testing with your existing reports. If upgrading is not possible and you're familiar with POI or JExcelAPI, I would suggest extending the JRXlsExporter or JRExcelApiExporter (limited to two links...sorry) and use custom exporter parameters in your API.
The version of Jasper Reports you're using really limits what you can do in excel. If you do upgrade, you may want to research the XLS properties available in versions above 4.0. If you're going to be doing more excel specific formatting with your existing reports, it would be more beneficial to uprade to a version higher than 4.0.

How best to export native data to Excel without introducing dependency on Office?

Our product has the requirement of exporting its native format (essentially an XML file) to Excel for viewing/editing. However, what this entails is having a dependency on Excel (or Office) itself for our product build - something that we do not want.
What we have done is export the data from our native format to a csv file which can be opened in Excel. If user selects an option to open the generated report as well, we (try to) launch Excel application to open it (ofcourse it requires Excel to be already present on the client system).
The data for most part is flat list of records.
Is there a better format (or even a better way) to handle this requirement? This is a common requirement for many products - how do you handle this?
Excel versions, both 2007 and several previous, have native XML formats. 2007, obviously, is XML by default, and earlier versions have the ability to save as XML. This SO question deals with the issue. I'd guess a little inspection would give an idea of what's required. I don't know if a XSD/DTD exists for older versions, but a little creative Googling might yield something.
As other people pointed out, it is reasonably easy to generate Excel XML files. You can do this in multiple ways. For example:
By creating a template Excel XML document, and then using XML DOM to stuff your data into the template, or
Converting the template Excel XML into an XSLT, and then simply passing your proprietary XML as input to XSLT.
I'm using ExcelPackage to create spreadsheets in one of my side projects. Works pretty good, but (at least the version I'm using) its a bit limited when it comes to styling and calculations.
ExcelPackage lets you create OOXML docs (.xslx files) that are natively compat with 2k7, but you can download a plugin for previous versions of Office from MS.
We export our data either using Excel objects (COM based code) on client side or CSV file (usually on server side, but can be used on client side too). And we allow copy data from grids in simple html format, what can be pasted into Excel without problems.
For one customer we even had to export data [from sql stored procedure] into csv-like tab-separated format, but named file like xxxxx.xls - this way excel opened that file in more correct way than csv file. Ugly hack, but worked well.
CSV is most compatible format (no dependencies on external applications or libraries), but customers don't like it. Maybe we need to incorporate some XLS export code, this way all users will be happy :)
If .csv isn't formatted enough, you could create a template in Excel, and use a little bit of VBA code to import the CSV and format it appropriately. This way your app is only concerned with generating the .CSV, and will use the same .XLS for each export.
If you're careful, you should be able to get this to work with most versions of Excel seamlessly.
With Perl there are several modules that can be used to produce .xlsx files without requiring an Office installation. Among those :
https://metacpan.org/pod/Excel::Writer::XLSX is the most well-known, with support for many Excel features like colors, formatting, etc.
https://metacpan.org/pod/Excel::ValueWriter::XLSX (I'm actually the author) has less features but is optimized for fast writing of large amounts of data
If you are working in Java, Checkout the POI project from APACHE.
http://poi.apache.org/
Simple, nice, complete, powerful.
We started with Office on the server, but that's not very nice. We had to kill processes that hung, and had quite a bit of a performance dip. We thought about putting it on a different machine, but didn't bother after trying and using Aspose (commercial). We don't have a very large number of simultaneous users, but complex documents. Simple ones can be handled easier with csv.
I've used FlexCel Studio for a couple of projects now. It's very functional and fast. 100% managed code, no dependencies. Sounds like you'd use the "Reports" feature which allows you to define an empty report template in Excel, then pass datatable and volia, it's populated with your data.
TMS Software
We use a combination of OleDB and Interop. We found that Interop was much faster and used less memory, but it's a pain for compatibility issues, especially when using different language installs of Office.
OleDb has the advantage that you don't require Excel to be installed on the client machine. Both Interop and OleDb support multiple sheets (tables) per workbook which you cannot do with csv.
If you're using C# or VB.Net, and your data is in a a DataSet, DataTable or List<>, then you can use my free "Export to Excel" class.
It uses the free Microsoft OpenXML libraries (so you don't need to have Excel on your server), and lets you export your data into a "real" .xlsx file with just one line of code, eg:
DataSet ds = CreateSampleData();
CreateExcelFile.CreateExcelDocument(ds, "C:\\Sample.xlsx");
All source code is provided on the following page along with a demo project, completely free of charge (and popups !)
http://mikesknowledgebase.com/pages/CSharp/ExportToExcel.htm
Hope this helps !

How do I import an Excel Spreadsheet into a blog..?

We are interested in trying to import an Excel spreadsheet into our Blog.
A sample of the Excel spreadsheet that we generate each day and want to export into our Blog is located at:
http://www.wallstreetsignals.com/WhatsWorking.html
Our Blog is located at:
http://whatsworkinginthestockmarket.blogspot.com/
We are interested in a program or method that would allow us to just import the Excel spreadsheet into our Blog instead of having to hand input all the data, which is what we are doing now.
Thank you for your thoughts and the cost to have you help accomplish our goal.
Philip
WallStreetSignals.com
Well, outside of creating a program (which is possible, using PHP, Perl, Java, etc and either an excel input module or converting to CSV or XML and processing that)...
Have you considered using Google Documents or another online spreadsheet software? It's easy to import an excel spreadsheet, and then embed the spreadsheet in the blog post or webpage. Then if you need to change it, modify the google document spreadsheet and the changes are rendered on the webpage or blog post immediately.
-Adam
The easiest thing might be to use Google Docs. Upload your spreadsheet, then publish from Google Docs to your blog. See this article.
Can your blog consume XML? You can set up an XML Schema in Excel 2007 and just export it to an XML file. You would need to write an XSLT.
I also have a macro that will write out XML to a file... can upload that if it would help...
If your spreadsheet is generated by a macro, you could just modify a macro to generate html or some other sort of blog markup ready for copy and paste.
Excel can save as HTML, which you could then strip the metadata from and use in your website. Unfortunately the HTML that it generates is very bloated. If you do not mind client lock-in, you could consider embedding the XLS file directly on your website, and having your viewers use the IE embedded excel viewer.
If you can use ASP.NET you could use SpreadsheetGear for .NET to load an Excel workbook, grab values, formatted values or even images to display on a web page. There are live ASP.NET samples with source if you want to check it out.
Disclaimer: I work for SpreadsheetGear LLC

Resources