An update on this…when using relative widths the cell alignment is correct however this causes the form field to stretch which is not the desired effect.  Any help on this would be greatly appreciated.

 


From: Jon Galentine
Sent: Tuesday, November 14, 2006 9:43 AM
To: 'itext-questions@lists.sourceforge.net'
Subject: Formfield Placement Within Nested Table

 

I am attempting to add a RadioCheckField to a PdfPTable which is then added as a nested table within another PdfPTable.  The table that contains the RadioCheckField also houses a Chuck object representing the label of the RadioCheckField.  I have successfully created the RadioCheckField cell with a fixed width however the placement of the cell within the encasing table seems incorrect.  I’ve listed the code I am using and have additionally attached a screen print of the output.  As the screen print indicates the RadioCheckField for the Gender field is added to the middle of the table cell.  I am unable to determine why the cell would not align to the left, which is the stated default behavior.  Any assistance on this would be greatly appreciated. 

 

Table Creation:

 

float[] colWidths = {20f, 55f};

fieldTable.setWidths(colWidths);   

fieldTable.setTotalWidth(75f);

fieldTable.setLockedWidth(true);

                   

fieldCell.setCellEvent(new FieldPositioningEvents(writer,

                            createRadioButton(inputTag)));

 

fieldTable.addCell(fieldCell);

fieldTable.addCell(labelCell);

 

 

Pertinent lines within the createRadioButton() method:

 

RadioCheckField bt = new RadioCheckField(writer,

                    new Rectangle(0, 0, 3, 3), idAtt+ (Math.random() * 100), value);

            bt.setCheckType(RadioCheckField.TYPE_CIRCLE);

            bt.setBox(new Rectangle(0, 0, 3, 3));

            bt.setBackgroundColor(Color.white);                   

            if ("checked".equalsIgnoreCase(checkedAtt)) {

                bt.setChecked(true);

            } else {

                bt.setChecked(false);

            }

            

            ck = bt.getCheckField();

 

The table containing the formfield and label is added to its parent table with the following code:

 

pTable.addCell((PdfPTable) ret);

 

The parent table is then added to the document via the document.add() method.

 

Thanks,

 

Jon Galentine

Pharmanet, Inc.

1001 Winstead Drive Suite 505

Cary, NC 27513

 

Phone: 919-388-4002

Fax: 919-678-0395

email: [EMAIL PROTECTED]

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to