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.

document.FindAll

Thread ID:

Created:

Updated:

Platform:

Replies:

61563 May 29,2007 09:24 AM May 30,2007 02:20 PM ASP.NET Web Forms (Classic) 3
loading
Tags: DocIO
Andy Tawse
Asked On May 29, 2007 09:24 AM

Hi,
I'm trying to search through a document using the FindAll method, but it either doesn't seem to find all instances of word (or none at all).

Example:

TextRangesHolder[] foundRanges = document.FindAll("phrase", false, false);

foreach (TextRangesHolder rangeHolder in foundRanges) {

foreach (TextRange range in rangeHolder) {
substituteCodes.Add(range.Text);
debug ++;
}
}

I'm not entirely sure what TextRangesHolder and TextRange are because the documentation is not very clear but in this example the document has 26 instances of "phrase" but FindAll only finds 16.

Is there something I'm doing wrong with FindAll? Or are there any obvious reasons why it might not find all instances of a word?

If TextRangesHolder holds many TextRanges why does FindAll return an array? I'm really quite confused about the TextRange stuff.

Thanks for any help you can give me.

Andy

Sarath Kumar G [Syncfusion]
Replied On May 29, 2007 08:30 PM

Hi Andy,

Thank you for your interest in Syncfusion products.

TextRange:

TextRange is a collection of text, in other words it is the paragraph or the range text.

TextRangeHolder:

TextRangeHolder is a collection of TextRanges. The FindAll returns TextRangeHolder the collection of all text range that has the phrase that is given for replacement.

As per the code snippet provided by you, the number of instances of "phrase" depends on the occurrences of the phrase within a paragraph.(i.e., a paragraph might contain more than one instance of "phrase" which is considered a single occurrence. But, replacing is done to all the occurrences).

Here is the sample program for your reference.

http://websamples.syncfusion.com/samples/DocIO.Windows/F_61563/main.htm

Here is the generated document for your reference.

http://www.syncfusion.com/Support/user/uploads/FindAll_b7a8700d.zip

Please let me know if you face any issues.

Regards,
Sarath

Andy Tawse
Replied On May 30, 2007 05:46 AM

Thanks for that. I think I understand TextRanges now but in the particular document I am searching, it still doesn't find *any* occurrences of a phrase that is definitely in it. My code should do that.

Could I send you through the document in question in private. I can't post it on a public forum.

Thanks.

Sarath Kumar G [Syncfusion]
Replied On May 30, 2007 02:20 PM

Hi Andy,

Thank you for your continued interest in Syncfusion products.

Please create a Direct-Trac Incident with TITLE : [ Forum id (61563) - Title of Forum (document.FindAll) ]. You can post your sample document and code using which the issue is reproduced in that Incident. This will be more helpful for us to investigate further in this issue. Your sample document will be kept secured and will be used only for our internal Testing purpose.

Sorry for the inconvenience caused.

Regards,
Sarath

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.

;