Personally I think your over complicating things for yourself. FIrst work on getting a dataset which looks as you want it, then output it. There is no reason to do it all in one step. Secondly, your output file is not a CSV, it is a format you have come up with yourself, maybe based in some way on CSV, but its not. CSV file has one row of header labels separated by comma, then and until the EOF data for those columns separated by commas. You have two separate files in one. If you require output, then go directly to RTF or PDF and put each on separate pages, for data, keep the data, don't try to keep the output in some form of data?
... View more