Jump to content
Changes to the Jaspersoft community edition download ×

How to export a simple (really unformatted) Excel file?


arthytrip

Recommended Posts

Hi all,

I have tried more export types but I can't get a very simple export, totally without formatting, containing only rows and columns, exactly as you would - for example - exporting a query from MySQL Workbech.
The purpose is to provide a customer with the possibility of exporting some particular reports on which to then perform pivoting and other processing.
I tried all four types of Excel export (Excel formatted and not, XLSX formatted and not) and frankly I don't see the difference, they all look the same and all formatted.
Is there an alternative solution?
Thanks in advance for your kind reply.

Arthy

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Exporting to Excel is kind of sport within Jasper... So first you need to warmup and think about your layout, then customize it and set some important export options and later fight against the patterns and formatting like font-sizes and so on. But it's possible.

So try to arrange EACH field side by side... without any space between. Also be aware, that each static texts in column headers are arranged like the fields.

Then you set the mentioned important xls-export options to surpress paging, unneeded column-footer, page-footers and so on.

Here are some nice tipps: https://community.jaspersoft.com/wiki/tips-exporting-excel

So again IT'S POSSIBLE, I've reached beautiful excel sheets for exporting to finance systems and so on... but not out of the box - because the "normal" excel-exporter want's to keep the page layout and also has another formatting than excel uses.

hth + regards

C-Box

Link to comment
Share on other sites

The purpose of JasperReports is to generate reports that all looks the same in different formats. So the reports in xls should looks the same as those in xlsx format. This is by design.

However, I've found that exporting to excel often requires a layout of it's own because each x coordinate of a field is made into  a column. That is, it's necessary to align start and end x coordinates of fields in title, page header, column header, etc. so they won't create new unwanted columns.

Link to comment
Share on other sites

Hello Arthy,

try to set the following properties for your report:

net.sf.jasperreports.export.xls.ignore.cell.border=true
net.sf.jasperreports.export.xls.detect.cell.type=true
net.sf.jasperreports.export.xls.remove.empty.space.between.columns=true
net.sf.jasperreports.export.xls.remove.empty.space.between.rows=true
net.sf.jasperreports.export.xls.white.page.background=true
net.sf.jasperreports.export.xls.ignore.graphics=true
net.sf.jasperreports.export.xls.collapse.row.span=true
 

Additionally you can also give your elements ID tokens and then exclude these elements from certain export formats using this property:

net.sf.jasperreports.export.{format}.exclude.key.{suffix}

Also make sure you're following the guidelines when designing the XLS oriented reports:

https://community.jaspersoft.com/wiki/making-html-xls-or-csv-friendly-reports

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...