Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Sep 07, 2011 8:36 am

Hello

I'm using following code
Code: Select all
Document document = new Document("Input.docx");
TextSelection selection = document.FindString("#FIND#", false, false);
Console.WriteLine("{0} elements found!", selection.Count);


I was expecting to find 3 items in the attached Document.
Is header and footer excluded from find?
How is it correct implemented?

Best regards,
Hubert

softecregistrierung
 
Posts: 22
Joined: Mon Mar 07, 2011 9:35 am

Tue Sep 13, 2011 9:55 am

Thank for your inquiry.
If you would like to find all matched strings, you can use the method FindAllString like this:
Document document = new Document("Input.docx");
TextSelection[] selections = document.FindAllString("Hello#", false, false);
Console.WriteLine("{0} elements found!", selections.Length);
Console.ReadKey();
It will find all matched strings, including in header and footer.
The method FindString only to return the matched string first found;
And the selections.Count return the count of including TextRange, not the count of the matched string
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Thu Sep 15, 2011 6:22 am

i tried the following code...
...and still get 1 element found!
What's wrong? Did you test it with my document?

Best regards,
Hubert

Code: Select all
Document document = new Document("Input.docx");
TextSelection[] selections = document.FindAllString("#FIND#", false, false);
Console.WriteLine("{0} elements found!", selections.Length);
Console.ReadKey();

softecregistrierung
 
Posts: 22
Joined: Mon Mar 07, 2011 9:35 am

Thu Sep 15, 2011 8:47 am

Hi Hubert,

Sorry for any inconvenience caused by us.
This issue is caused by a bug of Spire.Doc, we will fix it within the next week, and then we will inform you.
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Return to Spire.Doc