• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

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
0
riteshromi
Asked:
riteshromi
  • 4
  • 4
1 Solution
 
CEHJCommented:
>>Itried RtfTable class for that matter, but having some errors.

You'd better tell everybody what they are ;-)
0
 
riteshromiAuthor Commented:
for cehj .....What do u mean, I should tell u the errors.....
0
 
CEHJCommented:
Yes
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
riteshromiAuthor Commented:
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
0
 
CEHJCommented:
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
0
 
riteshromiAuthor Commented:
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
0
 
riteshromiAuthor Commented:
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.
0
 
CEHJCommented:
You can't make an RtfTable like that. I can't find the online javadoc. If you can, please post a link. It would guess that you can write tables in pdf then simply export it as rtf. Why? See:

http://itext.sourceforge.net/examples/com/lowagie/examples/general/HelloWorldMultiple.java
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now