Logged In: NO

Hello,

I see ostermiller provides an excel (and non-excel) CSVPrinter class for writing csv files (see his test program below - though he seems to have forgotten to close his filestream with p.close()

However, I would still think very kind/relevant to your source project if you were to provide access to this functionality via field-mappings.

Of course, you would need to add one additional field mapping to the class so users can define the file path and file name. If user does not define, then write to System.out as ostermiller does below.

Finally, one additional field mapping to determine whether to utilize ostermiller's ExcelCSVPrinter or plain ole' CSVPrinter.

tia. George

private static void main (String[] args) {
OutputStream out;
try {
if (args.length > 0){
File f = new File(args[0]);
if (!f.exists()){
f.createNewFile();
if (f.canWrite()){
out = new FileOutputStream(f);
} else {
throw new IOException("Could not open " + args[0]);
}
} else {
throw new IOException("File already exists: " + args[0]);
}
} else {
out = System.out;
}
ExcelCSVPrinter p = new ExcelCSVPrinter(out);
p.print("unquoted");
p.print("escaped\"quote");
p.println("comma,comma");
p.print("!quoted");
p.print("!unquoted");
p.print(" quoted");
p.println("quoted ");
p.print("one");
p.print("");
p.print("");
p.print("");
p.println("");
p.println("two");
p.print("\nthree\nline\n");
p.println("\ttab");
} catch (IOException e){
System.out.println(e.getMessage());
}
}