How can I reassign the regions of field shown in verification?

  • 62 Views
  • Last Post 03 July 2018
PhinkTad posted this 03 July 2018

Hello,

Let's say I have two fields in my document definition.

They are not in order. After rearranging them through script, I notice that the 'yellow' region corresponding to the fields still point to the original area in the image.

I would like to manually assign the regions of fields after they have been changed programmatically.

How can I do this?

How to use the IFieldRegion.Delete() and IField.AddRegion ()

Can anyone give examples please?

PhinkTad posted this 03 July 2018

Figured it out myself.

For anyone who wants to do this..

The following example deletes the original region of a field f1 and assigns the region of f2 to it.



IField f1 = Context.Field("f1");

IField f2 = Context.Field("f2");

f1.Regions[0].Delete();

 

f1.AddRegion(Context.Document.Pages[0], f2.Regions[0].SurroundingRect.ToString());

Close