| Issue 262: | escape double-quote in csv export please | |
| 1 person starred this issue and may be notified of changes. | Back to list |
see http://www.rfc-editor.org/rfc/rfc4180.txt page 2, paragraph 7
May 11, 2010
Project Member
#1
jeff.johnston.mn@gmail.com
May 12, 2010
I have write own CsvCellRenderer, where for the content of the cell call StringEscapeUtils.escapeCsv from org.apache.commons.lang package, and then put in the beginning and end of quotes.
May 12, 2010
Can you send those changes to me? Sounds like a great improvement! If so send them to jeff.johnston.mn@gmail.com and I will include it in the next release.
May 12, 2010
public class RfcCsvCellRendererImpl
extends CsvCellRendererImpl {
public RfcCsvCellRendererImpl(Column column, CellEditor cellEditor) {
super(column, cellEditor);
}
@Override
public Object render(Object item, int rowcount) {
StringBuilder data = new StringBuilder();
String property = getColumn().getProperty();
Object value = getCellEditor().getValue(item, property, rowcount);
String stringValue = StringEscapeUtils.escapeCsv(value.toString());
data.append(stringValue);
data.append(getDelimiter());
return data.toString();
}
}
but you need to check not put it StringEscapeUtils quotes. if you put, then their
second set did not need.
Mar 10, 2011
Putting the value in quotes is now being done by default.
Status:
Fixed
|