Free Support Forum - aspose.com

Node.Range.Replace

I am currently using Aspose.Words and am calling Node.Range.Replace. I am having mixed results. It seems some files take much longer to process than others (minutes vs. seconds) regardless of size and the regular expression definition. Are there any known issues with types of formats of Word files that could cause the Node.Range.Replace method to behave this way?

I am currently using the Replace method with the following signature.

Replace(class [System]System.Text.RegularExpressions.Regex pattern, class Aspose.Words.ReplaceEvaluator evaluator, bool isForward)


This message was posted using Aspose.Live 2 Forum

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Could you please attach your sample document and provide me sample code, which will allow me to reproduce the problem I will investigate the issue and provide you more information.

Best regards.

I attached a document specifically detailing how I am calling the method.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. But could you also attach a sample document, which you need to process, here for testing? This will help me to handle your issue better.

Best regards.

Unfortunately the document is proprietary so I do not have permission to upload it. Do you have a list of causes that could trigger this issue? I could go through the list and troubleshoot them myself.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks you for additional information. I tried to reproduce the problem with simple dummy document, but find and highlight process takes less than one second. Here is simple code I used for testing:

DateTime start = DateTime.Now;

doc.Range.Replace(new Regex(regexString, RegexOptions.IgnoreCase), new ReplaceEvaluator(ReplaceEvaluatorFindAndHighlight), true);

Console.WriteLine("find and highlight process takes {0} seconds", (DateTime.Now - start).TotalSeconds);

You can try to remove sensitive data from your document and attach it here for testing.

Best regards.