Thanks for the pointer. Here is a simpler java code for my problem.

Thanks in advance.
-Ekta-

On Tue, Mar 25, 2008 at 12:22 PM, Ekta Agarwal <[EMAIL PROTECTED]> wrote:

> I am using the setCellEvent to add a text field to a cell. But after this,
> the borders on my table dissappear. I am confused as to why would this
> happen? I even explicity set the BorderColor and Width of the cell, but this
> does not help.
>
> Attached is a snippet of the code, I would greatly appreciate any answers.
>
> Thanks.
>
>
>

import java.awt.Color;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.TextField;

public class myTextFieldTest {
        public static Font black_8 = 
FontFactory.getFont(FontFactory.TIMES_ROMAN,8, Font.NORMAL, new Color(0x00, 
0x00, 0x00));
        public static void main(String[] args) {
                Document document = new Document();
                try {
                        PdfWriter writer = PdfWriter.getInstance(document,      
new FileOutputStream("AdminForm.pdf"));
                        //PdfWriter writer = PdfWriter.getInstance(document, 
baosPDF);
                        document.open();        
                                    
            float[] table5Widths = {72*4.0f, 72*4.0f};   
            PdfPTable table5 = new PdfPTable(table5Widths);
            table5.setTotalWidth(576f);
            table5.setLockedWidth(true);
            float[] outerTableWidths = {140f,140f};
                        PdfPTable outerTable = new PdfPTable(outerTableWidths);
                        outerTable.setTotalWidth(280f);
                        outerTable.setLockedWidth(true);
                        PdfPCell currentCell = createCellNoBorderBlack_8("3. 
DATE ADMINSTRATIVE DEBT WAS INCURRED:");
                        currentCell.setFixedHeight(36f);
                        outerTable.addCell(currentCell);
                        currentCell = createCellNoBorderBlack_8("mm/dd/yyyy");
                        currentCell.setFixedHeight(36f);
                        outerTable.addCell(currentCell);
                currentCell = new PdfPCell(outerTable);
                currentCell.setBorderColor(Color.BLACK);
            table5.addCell(currentCell);
            currentCell = createCellNoBorderBlack_8("4. IF COURT JUDGEMENT, 
DATE OBTAINED:");
                currentCell.setFixedHeight(36f);
                outerTable = new PdfPTable(outerTableWidths);
                outerTable.setTotalWidth(280f);
                outerTable.setLockedWidth(true);
                outerTable.addCell(currentCell);
                currentCell = new PdfPCell();
                TextField t = new TextField(writer,new 
Rectangle(0,0,15,15),"date");
                t.setFont(black_8.getBaseFont());
                t.setFieldName("date");
                t.setFontSize(8);
                t.setBackgroundColor(Color.GRAY);
                t.setText("");
                try {
                        currentCell.setCellEvent(new 
FieldCell(t.getTextField(), 
                                        140, writer));
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (DocumentException e) {
                        e.printStackTrace();
                }               
                currentCell.setFixedHeight(36f);
                currentCell.setBorderColor(Color.BLACK);
                outerTable.addCell(currentCell);
            table5.addCell(outerTable);
            document.add(table5);
                }catch (IOException ie) {
                        System.err.println(ie.getMessage());
                        
                }  
                catch (DocumentException de) {
                        System.err.println(de.getMessage());
                        
                } 
                document.close();
                
}       
                        
        public static PdfPCell createCellNoBorderBlack_8(String aString){
                Paragraph p = new Paragraph();
                Chunk caseChunk = new Chunk(aString,black_8 );
                p.add(caseChunk);
                PdfPCell cell = new PdfPCell(p);
                cell.setBorderColor(new Color(255,255,255));
                return cell;
        }

}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to