Free Support Forum - aspose.com

Merge Regions

Hi guys,

Is there a way to detect whether a merge region exists within the code? I have looked through the documentation and am unable to find anything.

Thanks for your help,

Greg Pakes

Hi

Thanks for your inquiry. I think that you can try using something like this.

bool hasRegions = false;

string[] names = doc.MailMerge.GetFieldNames();

for (int i = 0; i < names.Length; i++)

{

if (names[i].ToLower()StartsWith("tablestart:"))

{

hasRegions = true;

}

}

I hope that this will help you.

Best regards.

Hi,

Thanks for the code. I am unable to get it to work in Classic ASP however. My code is as follows:

Dim fldNames

fldNames = DocLabels.MailMerge.GetFieldNames()

if isArray(fldNames) then
response.write "ISARRAY"
response.write fldNames(0)
End if

Here I get a type mismatch error on the "response.write fldNames(0)" line... any ideas?

thanks,

Greg

Hi

Thanks for your inquiry. It seems that you can’t use String[] in classic ASP. That’s why you should create wrapper class. For more information see the following link for more information.
How_to_create_a_wrapper_to_assist_in_calling_Aspose_Words_methods_from_classic_ASP.aspx

I hope that this will help you.

Best regards.