mcoddington Posted March 3, 2013 Share Posted March 3, 2013 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 More sharing options...
mathewd Posted October 30, 2013 Share Posted October 30, 2013 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 More sharing options...
Solution mcoddington Posted April 27, 2014 Author Solution Share Posted April 27, 2014 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 More sharing options...
hozawa Posted September 1, 2014 Share Posted September 1, 2014 Encountered a similar situation. I've found that the problem exists with Excel exporter but now with xlsx exporter. So, the solution for us was to use use xlsx exporter instead of Excel exporter. Link to comment Share on other sites More sharing options...
filippov.sem Posted March 13, 2020 Share Posted March 13, 2020 The exact steps to solve the problem in my case were: Set net.sf.jasperreports.export.xls.create.custom.palette=true in jasperWEB-INFclassesjasperreports.properties 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now