Title: Message Title
|
|
Here is the Excel-compatible version: {code:java} /** * Excelkompatibler CSV-Export: * <ol> * <li>Feldtrenner muss ein Semikolon sein.</li> * <li>Bei UTF-8 Kodierung <strong><a * href="" href="http://wiki.sdn.sap.com/wiki/display/ABAP/Excel+files+-+CSV+format" style="color: #3b73af; text-decoration: none">http://wiki.sdn.sap.com/wiki/display/ABAP/Excel+files+-+CSV+format" * >muss</a></strong> der BOM vorhanden sein, sonst ist die Datei für Excel * nicht sauber lesbar. Obwohl der BOM <a * href="" href="http://unicode.org/faq/utf_bom.html#bom5" style="color: #3b73af; text-decoration: none">http://unicode.org/faq/utf_bom.html#bom5">nicht empfohlen</a> wird bei * UTF-8</li>. * </ol> */ public class ExcelCompatibleCsvView extends CsvView { @Override protected String getDocumentStart() { // Write Byte Order Mark return "\ufeff"; } @Override protected String getCellEnd() { return ";"; } @Override protected String escapeColumnValue(Object value) { String stringValue = StringUtils.trim(value.toString()); if (!StringUtils.containsNone(stringValue, new char[] { '\n', ';' })) { return "\"" + //$NON-NLS-1$ StringUtils.replace(stringValue, "\"", "\\\"") + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return stringValue; } } {code}
|
|
|
|
|
* UTF8 header needs to be captured before we reset the headers. * Line feeds caused spreadsheet applications to render columns incorrectly. * Added BOM to csv export file so spreadsheet applications know what to display text as.
|
|
|
|
------------------------------------------------------------------------------
_______________________________________________
displaytag-devel mailing list
displaytag-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-devel