{
Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8")); //$NON-NLS-1$
try
{
CSVPrinter printer = new CSVPrinter(writer);
printer.setStrategy(STRATEGY);
printer.println(new String[] { Messages.CSVColumn_Date, //
Messages.CSVColumn_Type, //
Messages.CSVColumn_Value, //
Messages.CSVColumn_ISIN, //
Messages.CSVColumn_WKN, //
Messages.CSVColumn_TickerSymbol, //
Messages.CSVColumn_Description });
for (AccountTransaction t : account.getTransactions())
{
printer.print(dateFormat.format(t.getDate()));
printer.print(t.getType().toString());
printer.print(currencyFormat.format(t.getAmount() / Values.Amount.divider()));
printSecurityInfo(printer, t);
printer.println();
}
}
finally
{
writer.close();