I guess I found the explanation for the strange excel headers.
In the org.displaytag.render.HssfTableWriter there is a method setting the 
style:

/**
* Obtain the style used to render a header or footer.
* @return The style used to render a header or footer.
*/
private HSSFCellStyle getHeaderFooterStyle()
{
    HSSFCellStyle style = this.wb.createCellStyle();
    style.setFillPattern(HSSFCellStyle.FINE_DOTS);
    style.setFillBackgroundColor(HSSFColor.BLUE_GREY.index);
    HSSFFont bold = this.wb.createFont();
    bold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    bold.setColor(HSSFColor.WHITE.index);
    style.setFont(bold);
    return style;
}

Since this is a private method, I guess I can´t override it... So the 
questions remains;
How can we change the header styles?

Regards,
Daniel


----- Original Message ----- 
From: Daniel Lindberg
To: displaytag-user@lists.sourceforge.net
Sent: Friday, August 15, 2008 3:41 PM
Subject: [displaytag-user] Problems with header styles exporting to excel


I´m having some issues with the color and fills of my headers and grand 
totalswhen exporting tables to excel.
I have modified the hssf decorator that comes with the display tag samples 
to implement my own grand total decorators for exporting to excel and 
pdf.PDF-exporting looks fine, but I´m getting really wierd colors and fills 
when exporting to excel.
Since I want my totals to be bold, with black foreground and white 
background,I included this code in my decorator
HSSFWorkbook wb = new HSSFWorkbook();
HSSFCellStyle style = wb.createCellStyle();
style.setFillBackgroundColor(HSSFColor.WHITE.index);style.setFillForegroundColor(HSSFColor.BLACK.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cell.setCellValue(my_total_value);
cell.setCellStyle(style);

But the result looks nothing like this at all.I get a white foreground on a 
grayish background,with a FillPattern that likes somethink like 
HSSFCellStyle.BIG_SPOTS. How can we change the behavior of the cell styles? 
RegardsDaniel



Jag använder en gratisversion av SPAMfighter för privata användare.
2455 spam har blivit blockerade hittills.
Betalande användare har inte detta meddelande i sin e-post.
Hämta gratis SPAMfighter idag!
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.6.3/1613 - Release Date: 2008-08-15 
05:58




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great 
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/



_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user 


-- 
Jag använder gratisversionen av SPAMfighter för privata användare.
 2459 spam har blivit blockerade hittills.
 Betalande användare har inte detta meddelande i sin e-post.
Hämta gratis SPAMfighter här: http://www.spamfighter.com/lsv


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to