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();
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 Tutorials/Questions & Answers:
Advertisements
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 use string of one class into another Classhow to use string of
one class into
another Class I created textField(JTextField t1=new JTextField();(it is in ClassA. The input of this textField i.e t1.getText() is to be used in different(
another Class say in ClassB.
How can
how to change password into one jsp to another jsphow 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?
 
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 anotherhow 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 eclipseHow 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
How to pass variable from one class to another in javaHow 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
Copy one file into anotherCopy
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
Result Set one to many mappingResult
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 Pass data from one GUI to another in java swingHow 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
add one row after anotheradd
one row after another
how i add
one row after
another on click of add button
$(document).ready(function() {
var counter = 2;
$("#addData").click(function() {
if (counter > 10
update one table from another tableupdate
one table from
another table hello, i need to update
one table fields by using
another table fields. I have to
tables Products... enter the Quantity field in table 'Products_Purchased'In table 'Products'
one item
Java - Copying one file to another
Java - Copying
one file to
another
This example illustrates
how to copy contents from
one... copies
one file to
another file. We will be declaring a function
called copyfile
File copy from one directory to another in javaFile 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
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
 ....
Explanation
This program copies
one file to
another file. We
JPA One-to-One Relationship will learn about the
one-to-
one
relationship. In the
one-to-
one relation mapping a single value association
to
another entity.
One-to-
One: In
one-to-
one... JPA
One-to-
One Relationship
 
Convert One Unit to Another
Convert
One Unit to
Another
Again in this section, you will learn to convert
One
Unit to
Another. The following program helps you in converting some more units
to
another. 
copying data from one table to anothercopying data from
one table to another i need to copy data from
one table to
another table..
i.e the 1st eid of employee table must be copied to the 1st eid in appusers table, 2nd eid of employee to the 2nd eid of appusers
passing data from one jframe to anotherpassing 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 right and left shift operatorsright and
left shift operators hi
i am jane
pls explain the
differentiate between
right shift and
left shift operators
 ...;>"operator shifts the
left operand to the
right side with sign extension
calling one jap page from another jsp pagecalling
one jap page from
another jsp page i created a button in
one jsp page i need to call
another jsp page as an action to that button. so
how can i call.. plz any
one explain. its urgent