FindString in Header

Technical support for Spire.Doc

Moderator: iceblue support

FindString in Header

Postby softecregistrierung » 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
You do not have the required permissions to view the files attached to this post.
softecregistrierung
 
Posts: 21
Joined: Mon Mar 07, 2011 9:35 am

Re: FindString in Header

Postby Tina.Lin » 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

Re: FindString in Header

Postby softecregistrierung » 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: 21
Joined: Mon Mar 07, 2011 9:35 am

Re: FindString in Header

Postby harry.support » 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

Who is online

Users browsing this forum: No registered users and 0 guests