It looks like it works but it doesn't. It changes the acroform but not
the xfa and if you return to Designer the changes will be gone.
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of VanderMolen, David
> Sent: Friday, February 29, 2008 4:16 PM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Nullpointer in setListOption()
>
> I used Designer, and the setListOption works if passed the
> Field key, but not the field name. Methods like setField use
> the xfa.findFieldName and so work with the name, not just the key.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Behalf Of Paulo
> Soares
> Sent: Friday, February 29, 2008 10:16 AM
> To: Post all your questions about iText here
> Subject: Re: [iText-questions] Nullpointer in setListOption()
>
>
> iText only supports setField() with PDFs created with Designer.
>
> Paulo
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of VanderMolen, David
> > Sent: Friday, February 29, 2008 3:07 PM
> > To: itext-questions@lists.sourceforge.net
> > Subject: [iText-questions] Nullpointer in setListOption()
> >
> > I am using a pdf created with Adobe Designer 7.0...
> >
> > When calling setListOption with a shortened (non-key) field
> > name, the method fails with a nullpointer exception on the
> > Item. Is there a reason that the fieldName parameter that
> > works for setField doesn't work here?
> >
> > public boolean setListOption(String fieldName, String[]
> > exportValues, String[] displayValues) {
> > if (exportValues == null && displayValues == null)
> > return false;
> > if (exportValues != null && displayValues != null &&
> > exportValues.length != displayValues.length)
> > throw new IllegalArgumentException("The export
> > and the display array must have the same size.");
> > int ftype = getFieldType(fieldName);
> > if (ftype != FIELD_TYPE_COMBO && ftype != FIELD_TYPE_LIST)
> > return false;
> > Item fd = (Item)fields.get(fieldName);
> > //--nullpointer here for valid field name, expects the
> > .whatever[0]. pathing
> >
> > public boolean setListOption(String fieldName, String[]
> > exportValues, String[] displayValues) {
> > if (exportValues == null && displayValues == null)
> > return false;
> > if (exportValues != null && displayValues != null &&
> > exportValues.length != displayValues.length)
> > throw new IllegalArgumentException("The export
> > and the display array must have the same size.");
> > int ftype = getFieldType(fieldName);
> > if (ftype != FIELD_TYPE_COMBO && ftype != FIELD_TYPE_LIST)
> > return false;
> >
> > //(stole this code from setField method, which works)
> > if (xfa.isXfaPresent()) {
> > fieldName = xfa.findFieldName(fieldName, this);
> > if (fieldName == null)
> > return false;
> > String shortName =
> > XfaForm.Xml2Som.getShortName(fieldName);
> > }
> > Item fd = (Item)fields.get(fieldName); //--sets
> > values correctly
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/