开发者

iTextSharp acroFields.SetField method and multiple form fields with same name

In case of multiple fields with same name iTextSharp acroFields.SetField(Name, Value) sets value for first field only. How to set the value for the rest of the fields? When looping thru the acroFields.Fields the field names are reported as

form1[0].#subform[0].TextField1[0] - TextField
form1[0].#subform[0].TextField2[0] - TextField
form1[0].#subform[0].TextField2[1] - TextField
form1[0].#subform[0].TextField2[2] - TextField

When using

acroFields.SetField("TextField1", Value);

the value of text field named as TextField1 is set. there is only one field named as TextField1 so it is fine. However when using

acroFields.SetField("TextField2", Value);

the value of first text field named as TextField2 is set. The rest two fields named as TextField2 are left开发者_StackOverflow中文版 unset.

The PDF is created with Adobe LiveCycle and saved as Static PDF i.e. it is not Dynamic XFA.


Can you just use the full field name?

acroFields.SetField("form1[0].#subform[0].TextField2[0]", Value);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜