Jump to content
We've recently updated our Privacy Statement, available here ×

Excel - row height


robertsv

Recommended Posts

Hello :)

 

in order to show text which doesn't fit in the textField - I set isStretchWithOverflow="true". Exporting to excel - this solves the problem only partially (the row height is increased, but not enough).

If I understand correctly - there is no real solution for this problem?!

Link to comment
Share on other sites

  • Replies 14
  • Created
  • Last Reply

Top Posters In This Topic

 Hi,

I am facing the same problem does jasper reports support any of the following  options

1. Can jasper support adding an excel macro

2. Can jasper overwrite / append to an existing excel file (which contains a macro)

3. In jasper is there any way of explictly setting a row height (other than modifying the jrxml template)

4. can this be done for a particular row and not for entire excel

5. Is there any option to expand column width at run time

please suggest ?

Regards,

Vivek

Link to comment
Share on other sites

  • 3 months later...

robertsv
Wrote:

Hello :)

 

in order to show text which doesn't fit in the textField - I set isStretchWithOverflow="true". Exporting to excel - this solves the problem only partially (the row height is increased, but not enough).

If I understand correctly - there is no real solution for this problem?!

Has anyone come up with a solution to this problem yet?

Link to comment
Share on other sites

  • 1 month later...

It seems that there isn't a fix for this...

I wonder then, is there a way to specify a fixed row height increase when exporting to XLS? That is, I'd like to keep my heights dynamic (stretch with overflow, etc) but on an XLS export, is there a way to say "make all rows 20 percent taller?"

 

...or is this exactly what lucianc was saying that there is no POI capability for?

Link to comment
Share on other sites

iscribble
Wrote:

It seems that there isn't a fix for this...

I wonder then, is there a way to specify a fixed row height increase when exporting to XLS? That is, I'd like to keep my heights dynamic (stretch with overflow, etc) but on an XLS export, is there a way to say "make all rows 20 percent taller?"

 

...or is this exactly what lucianc was saying that there is no POI capability for?

There is no built-in feature to adjust the XLS row heights by a fixed ratio.  Log a feature request for this if you think it would be useful.

What I meant was that (afaik) POI does not support automatic adjusting of the row heights based on the cell contents.  So something like what you suggested (make all row heights 20% bigger) is possible, but making the rows exactly as tall as they need to be in order to fit the cell texts might not be possible.

Regards,

Lucian

Link to comment
Share on other sites

  • 6 months later...

I am also in need of embedding excel macro with Jasper reports.

Similarly I need to use existing excel pivot tables with Jasper reports.

Can someone update on these questions?

1. Can jasper support adding an excel macro

2. Can jasper overwrite / append to an existing excel file (which contains a macro or pivot table)

Thanks,

Avinash

Link to comment
Share on other sites

  • 5 months later...

I was able to improve the Excel row height problem (but not completely fix it) by making a small change in the JExcelApiExporter, and recompiling the jar.  This is JasperReports 3.5.3.  In the code below I changed the multiplier from 20 to 30.  It seems as though this provides an initial row height value, which Excel will later increase if the cell has a lot of content, but Excel often gets the calculation wrong.

But it is strange because Excel doesn't make a mistake on the files it generates, so I think there is something strange about the way JExcel generates xls files.

 

protected void setRowHeight(int y, int lastRowHeight) throws JRException
{
    try
    {
     // sheet.setRowView(y, (lastRowHeight * 20)); // twips
        sheet.setRowView(y, (lastRowHeight * 30)); // twips
    }
    catch (RowsExceededException e)
    {
        throw new JRException("Error generating XLS report : " + jasperPrint.getName(), e);
    }
}
 

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...

I am also having an issue with the cell height vs content in excel output.

POI may not have the ability to auto adjust the cell height based on content, but why is JasperReports not figuring out the correct cell height before it gets to POI?  If Jasper can tell that a given field is going to wrap and isStretchWithOverflow="true" and output is xls, double the cell height passed to POI.  Or some complicated formula along those lines. :)

Thanks,  

Scott

Link to comment
Share on other sites

  • 5 months later...

Hi,

i'm in the same trouble, and it would be very appreciated if these two issues have an answer:

1. Can jasper support adding an excel macro

2. Can jasper overwrite / append to an existing excel file (which contains a macro)

Thanks in advance,

 

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...