Jump to content
Changes to the Jaspersoft community edition download ×

Multisheet Report in Excel changes Font Color in Print Preview


mcoddington
Go to solution Solved by mcoddington,

Recommended Posts

Hi,

I am having an odd problem with a report that is exported to Excel that I am unsure how to diagnose.  When I open the excel report, click Print, and choose to 'Print Entire Workbook', all of the sudden the font color changes for the whole report.  It changes to a seemingly random color, changes each time I do it.  It doesn't change the font in the regular view of excel.  If I exit the print preview the text is back to black.  But if I execute the print it does print in that new color.  I have a lot of different reports exported to excel, and this only seems to happen on the one report I have that creates multiple worksheets.

I've removed all the coloring that I had in my template, and this still happens.  

Does anyone have any idea what could be causing this, or suggestions on debugging it?

Thanks in advance, Mike

 

Link to comment
Share on other sites

  • 7 months later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Our application is generating Excel spreadsheets with the same problem, but I can't find anything online that addresses the issue.  Could somebody from Jasper please respond to this thread?

In my case, the spreadsheet displays all cell fonts black, but when you print (or print preview) it prints in a random color.  It doesn't happen with all spreadsheets, but when it does you can print ten times and get ten different colors.  I thought this might be an Excel problem until I found this thread.

My app is using Jasper 4.1.3 and Apache POI 3.6-20091214.  Can somebody please respond to let us know if this may be a known issue?  I can provide a JRXML file if needed, and possibly even a spreadsheet that displays the problem.

Thanks!

Link to comment
Share on other sites

  • 5 months later...
  • Solution

Over a year later I came back to this issue and finally made some progress. I still do not know the root cause or whether it's an issue with Jasper, Excel or both; I've got a work around though.

 

New information: Noticed that in Excel, the cells that were changing color when printing had a color set to 'Automatic' instead of #000000 (Black), as defined in the report template. Also, cells where I had a conditional style resulting in a Red color were unaffected by the color change bug.

 

Work around to prevent this issue: I set my default style to have a forecolor of #010101 instead of #000000. This prevents the cells from having a color of 'Automatic' and prevents the color change when printing.

Link to comment
Share on other sites

  • 4 months later...
  • 5 years later...

The exact steps to solve the problem in my case were:

  1. Set
    net.sf.jasperreports.export.xls.create.custom.palette=true

    in

    jasperWEB-INFclassesjasperreports.properties

  2. Add the property forecolor="#000001" to a style tag with isDefault="true", e.g.:
    <style name="defaultStyle" isDefault="true" forecolor="#000001"/>

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