Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


pradeep
how to set the tables one is left and another one is right
1 Answer(s)      4 years and 8 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();

Advertisement
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:
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 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
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 Class
how 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 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?  
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
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
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
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
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 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
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
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
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
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
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
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
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
converting one file format to another
converting one file format to another  Hi ser I need a code to export data from data grid to PDF and XL format plz help me out
update one table from another table
update 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
right and left shift operators
right 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
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 write content of one file to another file and calculate checksum for accuracy.
to another file. And calculate the value of checksum at writing time with the help.... void read(byte b) Method read one byte of data from.... void write(int b) Method writes one byte of data
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 <
 

 

 

DMCA.com