We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Using document.Find not only to find the first result, but everything

Thread ID:

Created:

Updated:

Platform:

Replies:

123784 Apr 21,2016 02:43 AM Apr 25,2016 03:27 AM ASP.NET MVC 5
loading
Tags: DocIO
Testname
Asked On April 21, 2016 02:43 AM


I use this:

TextSelection textSelection = document.Find(findThis, false, false);

                    if (textSelection != null)
                    {
                        WTextRange text = textSelection.GetAsOneRange();
                        text.CharacterFormat.TextColor = Color.Red;
                        text.CharacterFormat.FontSize = 12;
                        text.CharacterFormat.UnderlineStyle = UnderlineStyle.Thick;

                    }

Testname
Replied On April 21, 2016 03:24 AM

If I use document.Replace(findeDas, ersetzeDasProduktiv, false, false) he will replace everthing, but using TextSelection textSelection = document.Find(findThis, false, false); he will only find just one

Vijay Ramachandran [Syncfusion]
Replied On April 22, 2016 07:08 AM

Hi,

Thank you for contacting Syncfusion support.

On further analysis with given details, we suspect you are trying to find all the words in a Word document using WordDocument.Find method. As per the behaviour of WordDocument.Find API, it will finds only the first occurrence in the document. If you want to find all the matching word in a document, you can use
WordDocument.FindAll API, it will help you to find all the occurrence in the Word document.

Also you are using the WordDocument.Replace API to replace the text in Word document. As per the behaviour of this API, it will replace all the matches in Word document. If your requirement is only replacing first occurrence means you could make
WordDocument.ReplaceFirst property as True before you using the WordDocument.Replace API, it will replace only the first occurrence in the Word document.

Please refer the following UG documentation link to know more about the Find and Replace functionality of DocIO.

http://help.syncfusion.com/file-formats/docio/working-with-find-and-replace

If we misunderstood any of your requirement then kindly elaborate the actual requirement with detailed description. Thereby we will analyse further on the mentioned case and will provided you appropriate solution.

Regards,
Vijay R


Testname
Replied On April 22, 2016 07:51 AM

I used GetAsOneRange(); before to format a specific match, what should I use instead ?

My Code:

      WTextRange text = textSelections.GetAsOneRange();//GetAsOneRange()
                        text.CharacterFormat.TextColor = Color.Red;
                        text.CharacterFormat.FontSize = 12;
                        text.CharacterFormat.UnderlineStyle = UnderlineStyle.Thick;

Testname
Replied On April 22, 2016 07:53 AM

forget it I found the soulution

Vijay Ramachandran [Syncfusion]
Replied On April 25, 2016 03:27 AM

Hi,

Thank you for your update.

Let us know if you have any other clarification.

Regards,
Vijay R


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;