The API should allow you to perform a text-based search and return the parent element(s) of the result(s) or directly the found element(s).
5 comments
ADMIN
Tanya
Posted on:09 Oct 2019 10:29
Hello Bob,
I am sorry to hear your disappointment with this missing functionality.
We are actively developing the Telerik Document Processing libraries and introducing features and bug fixes on them each release.
To determine whether the section exists using its title, you can enumerate the document elements and check the content of the Runs inside. The following snippet demonstrates how you can obtain all the paragraphs which have heading styles and their content:
foreach (var titleParagraph inthis.document.EnumerateChildrenOfType<Paragraph>().Where(p=>p.StyleId.Contains("Heading")))
{
StringBuilder paragraphContent = new StringBuilder();
foreach (var run in titleParagraph.EnumerateChildrenOfType<Run>())
{
paragraphContent.Append(run.Text);
}
}
Hope this is helpful.
Regards,
Tanya
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.
Bob
Posted on:02 Oct 2019 13:02
4 years since this was requested. Are you actively maintaining this code, if not please make it publicly available to the community on github.
I would like to insert a section if it does not already exist. How do i find out of it exists, it has a title?
ADMIN
Tanya
Posted on:18 Sep 2018 21:46
Hi Tom,
I am sorry to hear about the time you have spent in searching for the functionality. As you have already found, it is currently not supported. Please, make sure to cast your vote for the implementation and continue following this item so you can get a notification when its status changes.
Regards,
Tanya
Tom
Posted on:08 Sep 2018 10:40
Seconded. I spent ages looking for this assuming that "Find must exist because there's a Find and Replace, so surely there must be a Find"!
Roger
Posted on:26 Aug 2016 15:06
I'm coming from this post:
http://www.telerik.com/forums/docx-editor-replacetext-insert-line-break
As mentioned in other post, this feature here could be used as a workaround, but IMO a find functionality is crucial anyway and really useful for many scenarios!