Excel cell autoadjustment

Hello all,

I want to auto adjust cell length (cell length should get increase when data length is increase) when i export jasper report to excel format. Please anybody let me know how to do this?

It is possible with DynamicJasper. So I guess it should also possible in JasperReports.

shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago

11 Answers:

shamphadtale
Wrote:
 

Hello all,

I want to auto adjust cell length (cell length should get increase when data length is increase) when i export jasper report to excel format. Please anybody let me know how to do this?

It is possible with DynamicJasper. So I guess it should also possible in JasperReports.

You can set this two properties in the Jrxml, and set the  isStretchWithOverflow to false:

 

<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>

 

<property name="net.sf.jasperreports.export.xls.wrap.text" value="false"/>

 

yyun's picture
121
Joined: Aug 12 2011 - 4:27am
Last seen: 12 years 1 month ago

Thanks yyun!

Setting isStreachWithOverFlow to false affects View of report. Viewer shows truncated data. If  this property is true data get wrapped to next line, so showing whole data. I am using single Jrxml file and creating different kinds of report using JRSaveContributor. So how can i set isStreachWithOverflow to false only for Excel reports?

When we open exported CSV file in Microsoft Excel, is it possible to provide auto resizing of cell to it by setting some property or by some java code?

Regards,

Sham P.



Post Edited by shamphadtale at 09/23/2011 08:56
shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago

Hi,

For the moment the autosize feature is not supported in JR. But it's already considered for the next JR releases.

We'll let you know when the new functionality will become available.

Thank you,

sanda

 

shertage's picture
22162
Joined: Sep 26 2006 - 8:06pm
Last seen: 2 months 2 weeks ago

Thanks allot Sanda,

It is realy good news for me

It will be great if this feature - autosize - will be applicable to CSV files also.

Regards,

Sham P.

shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago

Hello Sanda,

Is this - autoResize of cell as per data size - feature added in Jasper 4.13? If yes which properties I need to set at export time?

Regards,

Sham P.

shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago

Hello Sham,

The (row and column) autofit properties were not introduced in the 4.1.3 release, but in the present they are in the testing phase. They will be rendered fully functional in the near future.

Other 2 resizing properties were made available in 4.1.3:

net.sf.jasperreports.export.xls.column.width

net.sf.jasperreports.export.xls.column.width.ratio

Maybe one of these 2 will be helpful in resizing cells as you need, until the autosize will be part of the JR release.

Hope this helps,

sanda

 

shertage's picture
22162
Joined: Sep 26 2006 - 8:06pm
Last seen: 2 months 2 weeks ago

Hello Sanda,

I have seen these properties and they are quite useful for me. So I was looking for autoResize(). Any way for now I will use them and once autoResize() come I will update my code with autoResize().

 

Thanks allot!

Sham

 

 

shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago

 

 

 

When I open exported CSV report in Microsoft Excel, data does not display properly. I need to use excel functionality Format ---> AutoFit Column Width for getting data display neatly. Does jasper report has some property by which column lengh get adjusted automatically when CSV report is open in Microsoft Excel?

OR

For CSV are there any similar properties like -

 

net.sf.jasperreports.export.xls.column.width

net.sf.jasperreports.export.xls.column.width.ratio

shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago

Hi Sham,

There are no equivalent properties for CSV format, because CSV files don't store such layout information. For instance, try to run Format ---> AutoFit Column Width for a column in a CSV file, save the modified CSV and close it. Open again the CSV file and see that the autofit setting is gone. If you try to manually set the column width, you'll get the same result.

CSV are designed to store data only, any format setting is dropped when the file is saved.

Regards,

sanda

shertage's picture
22162
Joined: Sep 26 2006 - 8:06pm
Last seen: 2 months 2 weeks ago

Yeah, I checked as you told me, after reopening CSV file it is as before, I need to do formatting again.

Thanks allot for your quick reply!

shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago

Thanks allot Sanda

shamphadtale's picture
Joined: Sep 15 2011 - 3:04am
Last seen: 12 years 1 week ago
Feedback
randomness