Read and respond to this message at: http://sourceforge.net/mailarchive/message.php?msg_id=37112574 By: Oemer Guersoy
Hi everyone! I still have wrong formatting in my Excel exports. The dates and currencies are formatted as text. That's why the dates are shown wrong and I can't build an accumulation over the currency cells. Using the default tab seperated file the formatting is only wrong in Excel 2000. Using POI the formatting is also wrong in Excel 2003. Do you have an idea? The table: ========================================================================= <div id="zahlungseingaenge" class="table"> <display:table name="${form.zahlungseingaenge}" id="row" requestURIcontext="false" requestURI="" export="true" pagesize="20" sort="list"> <display:setProperty name="export.pdf.filename" value="zahlungen-zahlungseingaenge.pdf" /> <display:setProperty name="export.csv" value="true"/> <display:setProperty name="export.pdf" value="false"/> <display:setProperty name="export.excel" value="true"/> <display:setProperty name="export.xml" value="true"/> ... ... ... <display:column media="excel xml csv" titleKey="zahlungen.zahlungen.param.zahlungseingaenge.betrag" autolink="true" paramId="betrag" property="betrag" decorator="de.opitzconsulting.pvs.web.util.DisplaytagMoneyWrapper" /> <display:column media="html" headerClass="betrag" paramId="betrag" sortProperty="betrag" sortable="true" titleKey="zahlungen.zahlungen.param.zahlungseingaenge.betrag" property="betrag" class="betrag" decorator="de.opitzconsulting.pvs.web.util.DisplaytagMoneyWrapper" /> </display:table> </div> ========================================================================= The ColumnDecorator: ========================================================================= public class DisplaytagMoneyWrapper implements DisplaytagColumnDecorator { private static String moneyToString(double wert) { DecimalFormat decimalFormat = (DecimalFormat) DecimalFormat.getInstance(Locale.GERMAN); decimalFormat.applyPattern("#,###,##0.00"); String string = decimalFormat.format(round(wert)); return string; } private static double round(double wert) { long longWert = Math.round(wert * 100); double doubleWert = longWert; doubleWert = doubleWert / 100; return doubleWert; } public Object decorate(Object columnValue, PageContext pageContext, MediaTypeEnum media) throws DecoratorException { return columnValue != null ? moneyToString((Double) columnValue) : moneyToString(0); } } ========================================================================= -- GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist! NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ displaytag-user mailing list displaytag-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/displaytag-user