docx editor.ReplaceText insert line-break

7 posts, 1 answers
  1. Daniel
    Daniel avatar
    8 posts
    Member since:
    Jun 2012

    Posted 06 Jul Link to this post

    Hi,

    I have a fairly complex docx file, in which I want to replace some text using the ReplaceText method, and managed to do so, until today, when I tried to insert a newline into my "new text". To be more specific

    Old text: "lorem ipsum VAR_TEXT".

    Using: editor.ReplaceText("VAR_TEXT", "dolor"), it works, and the output is "lorem ipsum dolor", as expected.

     

    Now I want to do this: editor.ReplaceText("VAR_TEXT", "dolor \n\r sit amet"), and achieve:

    lorem ipsum dolor

    sit amet

    but what I always get is lorem ipsum dolor sit amet

    I also tried with: Environment.NewLine, \n, \n\r, \r\n, <br>, <br />, <w:br /> ...all failed.

     

    Can you please help me out? Thank you!

  2. Answer
    Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 11 Jul Link to this post

    Hi Daniel,

    A new line in the document you could insert using the Break element. At this point, the Find and Replace API of RadWordsProcessing performs a text-based search and allows you replace only (with) text values. Therefore, only string values are supported when replacing.

    We already have a feature request to implement a Find functionality that will allow you position RadFlowDocumentEditor based on the results of the search and insert the desired element on this position. You could vote for this and track the feature's progress through the related public item in our feedback portal.

    Hope this information is helpful.

    Regards,
    Tanya
    Telerik by Progress

  3. Daniel
    Daniel avatar
    8 posts
    Member since:
    Jun 2012

    Posted 11 Jul in reply to Tanya Link to this post

    Hello,

    Yes, the Find functionality, combined with the Break element would fix my issue. I guess I will wait for that to be implemented.

    Thank you for your answer!

  4. Luis
    Luis avatar
    8 posts
    Member since:
    Jul 2016

    Posted 24 Aug Link to this post

    I can´t use the replace text method, it do not appears in my Radloweditor, is it only available for 2016 version?
  5. Luis
    Luis avatar
    8 posts
    Member since:
    Jul 2016

    Posted 24 Aug Link to this post

    I can´t use the replace text method, it do not appears in my Radfloweditor, is it only available for 2016 version?
  6. Tanya
    Admin
    Tanya avatar
    405 posts

    Posted 24 Aug Link to this post

    Hello Luis,

    The Find and Replace API (including the ReplaceText() method) is introduced in Q2 2015. In order to work with this API, you should use version Q2 2015 or later.

    Regards,
    Tanya
    Telerik by Progress

  7. Luis
    Luis avatar
    8 posts
    Member since:
    Jul 2016

    Posted 24 Aug in reply to Tanya Link to this post

    Thank you very much, I have requested the upgrade to the right version to our corresponding area, :D
Back to Top