Thanks guys worked perfect.
cheers ryan
On 23/06/06, Brian Silberbauer <[EMAIL PROTECTED]> wrote:
If you are targeting excel, try apache poi for creating spreadsheets -
very easy.
http://jakarta.apache.org/poi/
Brian
On 6/23/06, Ewald Horn <[EMAIL PROTECTED]> wrote:
>
>
> Hi Ryan,
>
> CSV files contain no formatting information, even the test I created failed
> to load correctly until I double-clicked on the cell to edit it. You simply
> write a $0A character wherever you want the new line to appear. Here's some
> sample code for you to look at. It's not perfect but it works for me.
>
> // code start
> import java.io.*;
>
> public class WriteCSV
> {
>
> public static void main (String args[])
> {
>
> try
> {
> DataOutputStream outFile = new DataOutputStream (new FileOutputStream
> ("mytest.csv"));
>
> for (int lines = 0 ; lines < 5 ; lines++)
> {
> outFile.writeBytes ("Test data line,\"");
>
> for (int i = 0 ; i < 5 ; i++)
> {
> outFile.writeBytes(Integer.toString(i));
> if (i < 4)
> outFile.writeByte (10); // $0A
> }
>
> outFile.writeBytes ("\",1,2,3,4,5");
> outFile.writeByte(13); // $0D // write $0D0A sequence for a new line
> outFile.writeByte(10); // $0A
> }
>
> }
> catch (Exception e)
> {
> // Sample code, lets hope nothing goes wrong
> }
>
>
> }
> }
> // code end
>
>
> I hope this helps.
>
> Kind regards
>
> Ewald Horn
> Business Manager
> NoFuss Solutions
> South Africa
> Cell : 083 519 1615
> Web: www.nofuss.co.za
> Custom software development
>
> >
>
>
--
Brian Silberbauer
Consultant
+27 (0)83 566 2705
skype: brian.silberbauer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CTJUG Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Forum
For the ctjug home page see http://www.ctjug.org.za
-~----------~----~----~----~------~----~------~--~---
- [CTJUG Forum] CSV files Ryan Meder
- [CTJUG Forum] Re: CSV files Ewald Horn
- [CTJUG Forum] Re: CSV files Brian Silberbauer
- [CTJUG Forum] Re: CSV files Ryan Meder
