i want to convert following file into table formate how do i do this? i wan to convert it pdf file

text file :-
2011012735981481 15:27:29 35235139 15:27:29 LARSEN & TOUBRO LTD. 10 D
(DEL) LARSEN & TOUBRO 10
(NET) LARSEN & TOUBRO 10
2011012736007203 15:29:32 35263544 15:29:32 OIL AND NATURAL GAS 5 D
(DEL) OIL AND NATURAL 5
(NET) OIL AND NATURAL 5

Then use iText or similar library

i have to separate ech value in seprate column

Is it so hard to browse the already linked resources? Wow, look what I found

my problem is that i have to read text file which is following formate then i have to convert that file into pdf table formate . there is also one problem that some column seprated by more than on space.and also if value of column is not present then in pdf that value goes in the different column
for ex.
col1 col2 col3 col4
val2 val3 val4
val1 val3 val4
val1 val2 val4

for.
col1 col2 col3 col4
no val2 val3 val4
val1 no val3 val4
val no val3 val4


no is used for blank space

What is hard about that?

public class MyTable{
  String col1, col2, col3, col4;

  public MyTable(String str1, String str2, String str3, String str4){
    col1 = str1;
    col2 = str2;
    col3 = str3;
    col4 = str4;
  }

  //getter and setter methods that I desire

  //handy method to print whole object as String
  public void toString(){
    System.out.println(getCol1() + "\t" + getCol2() + "\t" + getCol3() + "\t" + getCol4());
}

Somewhere in text processing class

ArrayList<MyTable> myTableList = new ArrayList<MyTable>();
//reading text

//sample list entries
myTableList.add(new MyTable("", "val2", "val3", val4"));
myTableList.add(new MyTable("val1", "val2", "", val4"));
myTableList.add(new MyTable("", "val2", "val3", "));

for(MyTable printTable : myTableList){
  printTable.toString();
}

So once you read your text file and populated some collection (in my case ArrayList) you can then call upon iText and start printing pdf.

how i read that text file so value for each column come in right place i.e
col1 get val1 because if i read that text file with help of bufferedReader
it read file line by line hence while extracting data if value for some column missing then in that column value for next column is stored so plz give some idea that how i first read that text file hence each column wil get correct value if there is no value for column then put blank space in that position

You asked about converting text to PDF with which I helped you to my best knowledge(even direct linking exact resources you need it). Now you want me to do also file reading? Sorry, but that is not possible. I can possibly help to fix some bugs in my spare time, but I'm damn sure I will not write code for you so you can hand it over to your boss as yours.
Do the task, show what you done and where you face difficulties (as we ask here)or look for help elsewhere...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.