Link to home
Start Free TrialLog in
Avatar of riteshromi
riteshromi

asked on

Create a table from java bean in rtf file format.

Hi,
  I am using the itext package for creating the rtf file, and I need to have the bean create a table in the same document. Is there a way to do so. Itried RtfTable class for that matter, but having some errors.

Thank you
Ritesh
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

>>Itried RtfTable class for that matter, but having some errors.

You'd better tell everybody what they are ;-)
Avatar of riteshromi
riteshromi

ASKER

for cehj .....What do u mean, I should tell u the errors.....
Yes
I want the arguments to be passed to the RtfTable so that the same document is updated. I tried document as the first parameter and int 3 as the second to specify the no. of columns.

Could you please tell me whats wrong in the code. sending the code....


public void addTable()
      {
            RtfTable table = new RtfTable(document, 3);
            RtfCell cell = new RtfCell(new Paragraph("header with colspan 3"));
            cell.setColspan(3);
            table.addCell(cell);
            table.addCell("1.1");
            table.addCell("2.1");
            table.addCell("3.1");
            table.addCell("1.2");
            table.addCell("2.2");
            table.addCell("3.2");
            cell = new RtfCell(new Paragraph("cell test1"));
            cell.setBorderColor(new Color(255, 0, 0));
            table.addCell(cell);
            cell = new RtfCell(new Paragraph("cell test2"));
            cell.setColspan(2);
            cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
            table.addCell(cell);
            document.add(table);

      }//end of addTable

thank you..This method should create the table in the rtf file where the Document object is document
I don't know this API, but i'm just getting you to give as explicit information as possible so you have the best chance of a solution. You still have not said what the errors are
using the above method gives the following errors...::>>total 13 errors.

cannot resolve symbol
symbol : Constructor RtfTable(com.lowagie.text.Document, int)
RtfTable table = new RtfTable(document, 3);
cannot resolve symbol
symbol : method addCell (com.l*.text.rtf.table.rtfCell)


all other are also cannot resolve symbols of the same type
hey CEHJ i have sent the errors also. please tell me what should I do, Is there any other way or a package to create and rtf file or table in rtf document.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial