This is a migrated thread and some comments may be shown as answers.

docx editor.ReplaceText insert line-break

11 Answers 723 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 06 Jul 2016, 01:05 PM

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!

11 Answers, 1 is accepted

Sort by
0
Accepted
Tanya
Telerik team
answered on 11 Jul 2016, 12:46 PM
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

0
Daniel
Top achievements
Rank 1
answered on 11 Jul 2016, 01:59 PM

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!

0
Luis
Top achievements
Rank 1
answered on 24 Aug 2016, 02:26 PM
I can´t use the replace text method, it do not appears in my Radloweditor, is it only available for 2016 version?
0
Luis
Top achievements
Rank 1
answered on 24 Aug 2016, 02:26 PM
I can´t use the replace text method, it do not appears in my Radfloweditor, is it only available for 2016 version?
0
Tanya
Telerik team
answered on 24 Aug 2016, 02:48 PM
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

0
Luis
Top achievements
Rank 1
answered on 24 Aug 2016, 02:53 PM
Thank you very much, I have requested the upgrade to the right version to our corresponding area, :D
0
RJ
Top achievements
Rank 1
answered on 01 Feb 2018, 12:08 PM

Hi Tanya,

Is replace text to new line now works with latest version? e.g. editor.ReplaceText("<BR>", code for newLine) 

If yes, whats the code for new line?

Thanks!

0
IT Development Manager
Top achievements
Rank 1
answered on 16 Aug 2018, 09:36 AM

Hi,

I see that the feature request for the find functionality as detailed at the following URL has been approved.

https://feedback.telerik.com/Project/184/Feedback/Details/176879-wordsprocessing-implement-find-search-functionality

Can you tell me whether it has been implemented and is available yet? 

Kind regards,

Dominic.

0
Tanya
Telerik team
answered on 16 Aug 2018, 08:10 PM
Hello,

The "Approved" status of an item means that it is included in our planning and prioritization processes. However, the task is not scheduled at this point and I cannot say when it might be implemented. Please, make sure to cast your vote for the implementation and subscribe to the item so you can receive notifications about status changes on it.

Regards,
Tanya
Progress Telerik

0
Jayashree
Top achievements
Rank 1
answered on 25 Jan 2019, 11:45 AM

Hi team,

Does the implementation of replacing the text of multi line or text containing (Environment.NewLine) has been implmented or not?

Could you please give an alternative for the same.

Thanks in advance :)

0
Tanya
Telerik team
answered on 29 Jan 2019, 09:30 AM
Hello Jayashree,

The task concerning the replacement of text with other document elements is currently not implemented. You can vote for it as well as subscribe to track its status using the following feedback item: Introduce a way to replace text with other document elements. In the description of this item, you will also find a sample code allowing you to achieve a similar scenario.

Hope this is helpful.

Regards,
Tanya
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
WordsProcessing
Asked by
Daniel
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Daniel
Top achievements
Rank 1
Luis
Top achievements
Rank 1
RJ
Top achievements
Rank 1
IT Development Manager
Top achievements
Rank 1
Jayashree
Top achievements
Rank 1
Share this question
or