We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Extract text from a paragraph

Hi,


Below is my requirement:

  • I have a paragraph and i need to search for a particular text in the current paragraph.
  • If current paragraphs contains my search text i need to extract the matched text and move it to next line. i.e. create a new paragraph and move the matched text to the newly created paragraph.
  • Also please note that i need to retain all the formatting.

Thanks
Timothy

This message was posted using Page2Forum from Aspose.Words for .NET - Documentation

Hello

Thanks for your inquiry. I think in your case you can try using IReplacingCallback. Please see the following link for more information:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.ireplacingcallback.html

Please let me know in case of any issues. I will be glad to help you.

Best regards,

Hi ,
Thanks for your quick response.
    ''' NOTE: This is a simplistic method that will only work well when the match
    ''' starts at the beginning of a run.

That is where the problem lies. We need to implement something like split the run
and get only matched text with all formatting.

So can you please help me out.

Thanks
Timothy

Hi

Thanks for your inquiry. Here you can find extended version of IReplacingCallback implementation, which will allow you to achieve what you need:

Hope this helps.

Best regards,