Home Answers Viewqa JSP-Servlet how to set the tables one is left and another one is right

 
 


pradeep
how to set the tables one is left and another one is right
1 Answer(s)      3 years and 3 months ago
Posted in : JSP-Servlet

Here two tables are combined.i need to set the one table is left another one is right and ineed to gap between the two tables

Document document=new Document();
PdfWriter.getInstance(document,new FileOutputStream("C:/tablePDF.pdf"));
document.open();
PdfPTable table=new PdfPTable(2);

PdfPTable table1=new PdfPTable(1);
table1.addCell ("Roseindia");

PdfPTable table2=new PdfPTable(1);
table2.addCell ("Delhi");

table.addCell(table1);
table.addCell(table2);

document.add(table);
document.close();
View Answers

February 23, 2010 at 4:07 PM


Hi Friend,

Try the following code:

<%@page import="java.io.*"%>
<%@page import="com.lowagie.text.*"%>
<%@page import="com.lowagie.text.pdf.*"%>
<%
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("C:/table.pdf"));
document.open();

PdfPTable table1 = new PdfPTable(1);
PdfPCell cell1 = new PdfPCell(new Paragraph("Table1"));
table1.addCell(cell1);
table1.setWidthPercentage(20);

PdfPTable table2 = new PdfPTable(1);
PdfPCell cell = new PdfPCell(new Paragraph("Table2"));
table2.addCell(cell);
table2.setWidthPercentage(20);

PdfPTable table = new PdfPTable(2);
table.setWidthPercentage(100);
table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table.getDefaultCell().setFixedHeight(70);
table.addCell(table1);
table.addCell(table2);

document.add(table);
} catch (Exception de) {
de.printStackTrace();
}
document.close();
%>

Thanks









Related Pages:
how to set the tables one is left and another one is right - JSP-Servlet
how to set the tables one is left and another one is right  Here two tables are combined.i need to set the one table is left another one is right and ineed to gap between the two tables Document document=new Document
how to do two database tables in one page?
how to do two database tables in one page?  dear all: i want to show these two database tables in one page. one table on the left (dbtable.jsp) and the other on the right (table2.jsp). how can i do that with HTML? this is my
How to compare two tables, and insert values which r not in one table to another table?
How to compare two tables, and insert values which r not in one table to another table?  Hi I need to compare two tables MainTable and OUTTable...="right" width=37> <strong><img title="Go back" src="Undo.gif" width
Hibernate one-to-one relationships
Hibernate one-to-one relationships  How does one to one relationship work in Hibernate?   Hibernate Mapping One-to-One Hibernate provides.... here is an example showing one to one relationship using hbm.xml. We have two
JPA One-to-One Relationship
a single value association to another entity.  One-to-One: In one-to-one.... There are two tables: person and address. Both are related to each other through the one... JPA One-to-One Relationship   
Result Set one to many mapping
Result Set one to many mapping  Suppose there are 5 tables in database named A,B,C,D and E. A has one to many relationship with B,C,D and D has one... Suppose result contains single entry of One record for A, Two records for B
how to change password into one jsp to another jsp
how to change password into one jsp to another jsp  i have two jsps in one jsp i give one password and confirm password, in another jsp i want change my password compare with 1st jsp how to write code please give me answer?  
align a table to the right (or left).
align a table to the right (or left).  How do I align a table to the right (or left
align a table to the right (or left).
align a table to the right (or left).  How do I align a table to the right (or left
Mysql Left Join
; Mysql Left Join return you the set of records of right table matches with the left table. The unmatchable records from right table with the left table... | +-------+-----------+------------------+ 3 rows in set (0.00 sec) Left Join:- Query to join the data
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
Copy one file into another
Copy one file into another In this section, you will learn how to copy content of one file into another file. We will perform this operation by using...;This string is copied from one file to another\n"); bf.close(); InputStream
How To Pass data from one GUI to another in java swing
How To Pass data from one GUI to another in java swing  I'm new to java and part of our assignment is to build a GUI and display a result set from data input. I'm stuck at how to get the user's input from JTextFields and combobox
SQL LEFT JOIN
. In this example, we describe you, how to use left join in table using select... tables. The Left Join is used to return all rows from the left table ,even... SQL LEFT JOIN      
Copy data from one JTextField to another JTextField
, you will learn how to copy the data from one JTextField into another... Copy data from one JTextField to another JTextField... data into first JTextfield and select the entered text, right click, copy
How to forward the control from one jsp to another?
How to forward the control from one jsp to another?  Hi! This is Prasad Jandrajupalli. I have the 3 JSP's, but I want communicate with each other.i.e. First JSP is communicating with the second JSP, Second JSP
how to pass a string from one class to another
how to pass a string from one class to another  hi all, Good morning... string from one class to another. import java.util.*; class A{ static String... string from one class to another. import java.io.*; class Class1 { public
How to navigate from one jsf to another in eclipse
How to navigate from one jsf to another in eclipse  Hi there is my jsf code... <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="f" uri="http
SQL LEFT JOIN
. In this example, we describe you, how to use left join in table using select... tables. The Left Join is used to return all rows from the left table ,even... SQL LEFT JOIN      
how to print from right to left in java????
how to print from right to left in java????   can anyone pls tell how to print from right to left in java
Hibernate Many One One Mapping
between two tables. The relationship may be One-To-One, One-To-Many, Many-To-One and Many-To-Many. An Example of One To Many mapping is given below Address... Student s left join s.address as obj"; /* Right Join */ // String hql
Join tables in the specific database
records between two or more tables. It relates one table to another. Joining... the table in more than one table. In this section, we are going to see how to join... can join the tables various types like: Natural join, Natural left join
Java - Copying one file to another
how to copy contents from one file to another file. This topic is related... Java - Copying one file to another   ... This program copies one file to another file. We will be declaring a function
swings:how to link from one form to another form
swings:how to link from one form to another form  how to link from one form to another form
File copy from one directory to another in java
File copy from one directory to another in java  I am trying to find very good code example for copying a file from one directory to another... from a directory to another directory. How to achieve this? Is there any API
how to Use jsp:setProperty to set one bean in other bean while to be set bean is of type java.util.List<beantype>
how to Use jsp:setProperty to set one bean in other bean while to be set bean... here, But I am not getting how do I set the value of chapters properties... goes to another jsp(say b.jsp). In b.jsp I am using Standard tag as follows <
Java - Copying one file to another
Java - Copying one file to another       This example illustrates how to copy contents from one... the contents from one specified file to another specified file. copyfile(String
how to copy file from one directory to another in java with examples
how to copy file from one directory to another in java with examples  how to copy file from one directory to another in java with examples? I want... copy from one directory to another in java. Thanks
passing data from one jframe to another
passing data from one jframe to another  I have two JFrame,built by using the GUI Editor netbeans 6.9.i have to pass a data from a Jtextfield in the first Jframe to another JLabel in the other JFrame.Can you please help me,how
how to pass an array from one jsp to another jsp - JSP-Servlet
how to pass an array from one jsp to another jsp  hi friedns, can any One tell me how to send an array from one jsp to another jsp,pls any one send the code for this.also porvid the code how to retrive the arry in another jsp
Copy One Database Table to Another
Copy One Database Table to Another       In this section, you will learn to copy one database table to another database table. That means we copy one table to a different table
Hibernate Many-to-one Relationships
is where one entity contains values that refer to another entity (a column... Hibernate Many-to-one Relationships       Hibernate Many-to-one
JPA One-to-Many Relationship
the one-to-many relationship and how to develop a one-to-many relation in your JPA.... There are three tables: parent, child and parentchild. One parent has many... JPA One-to-Many Relationship     
JPA Many-to-one Relationship
about the many-to-one relationship and how to develop a many-to-one relation... have one parent. The parent and child tables are integrated... JPA Many-to-one Relationship   
How to pass variable from one class to another in java
How to pass variable from one class to another in java  How to pass variable from one class to another in java?   Example: public class...; } } //Another class Class2. public class Class2 { public static void main(String
how to use one form out of multiple form from one jsp to another jsp
how to use one form out of multiple form from one jsp to another jsp  Hi All. please give me your valuable advise for below requirement.. I have... one form from abc.jsp as it is to another .jsp(say def.jsp).Your advise
How to write content of one file to another file.
the associated stream. void write(int b) Method writes one... is : 1836825431 Content of one file successfully written in other file
Hibernate One-to-one Relationships
-to-one relationships in Hibernate. In next section we will learn how... Hibernate One-to-one Relationships       Hibernate One-to-one Relationships
how to go from one frame to another frame in swings - Java Beginners
how to go from one frame to another frame in swings  Hi, My task is to go from one frame to another.......... let us think that iam having two... this task in swings or applet......... i have gone through one example of login
how to write function of copy from one to another location in this code
how to write function of copy from one to another location in this code  I need to write a code to copy a file from one location to another using browse button in it. i have written code for the browse button. please help me
parser xml one page to another
parser xml one page to another  parser xml one page to another
Data fetch from multiple SQL tables - Hibernate
multiple tables using left and right outer joins. I need to convert this JDBC data... clause sample: FROM table9 il LEFT OUTER JOIN table4 RIGHT OUTER JOIN... RIGHT OUTER JOIN table6 RIGHT OUTER JOIN table5 LEFT OUTER JOIN table1
PHP SQL Left Join
; This Example illustrates how to use left join clause in the sql query.  JOIN is used to query data from two or more tables. The left join is used in case of need to return all rows from the left table, even if the right table
PHP SQL Right Join
; This Example illustrates how to use right join clause in the sql query.  JOIN is used to query data from two or more tables. The right join is used in case of need to return all rows from the right table, even if the left table
jsp one to one mapping
jsp one to one mapping  how to perform one to one mapping in jsp....code of one to one mapping with .xml file
how to make a button left justification which is at right end
how to make a button left justification which is at right end  how to make a button left justification which is at right end thanks in advance
Moving file or directory from one directory to another
Moving file or directory from one directory to another... directory is moved from one directory to another directory. This program... from one directory to another. In this section an example is given
problem in sending data from one ip to another ip in JAVA
problem in sending data from one ip to another ip in JAVA  Hi guys . this is naveen kumar...i need a help. i want to connect one ip to another ip... device in JAVA. i know how to ping but don't how to send the msg's to another IP
Hibernate One-to-many Relationships
Hibernate One-to-many Relationships       Hibernate One-to-many Relationships - One to many example code in Hibernate using the xml file as metadata. Here
Join tables with the NATURAL LEFT JOIN operation
to retrieve data according to match the field name of another tables. NATURAL LEFT... Join tables with the NATURAL LEFT JOIN operation  ...\jdbc\jdbc\jdbc-mysql>java NatLeftJoinTable Natural Left Join Tables

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.