Apply RTF formatting
Hello,
Is there a way to apply formatting in RTF to text in a document?
Thanks!
Hi Natalie,
From the given details, we suspect that your requirement is to apply formatting
to the text in the RTF format document.
To achieve this, we suggest you to open the RTF document and get the required
text by using the Find API. Then apply the format to the text.
Please refer to the UG documentation below to know how to open the RTF format
document,
convert RTF
document into Word document
Please refer to the UG documentation below to know how to find text in a Word
document and highlight it.
Find
text in a Word document and format
Additionally, you can refer to the working sample on GitHub.
Please refer to the UG documentation below to know how to apply formatting to
the text,
Apply
formatting to the text
Additionally, you can refer to the working sample on GitHub.
If we misunderstood any of your requirements means, please share with us the
complete details about your end requirement. Also, kindly share with us the input
template and the expected output document/screenshot. Thereby, we
will check the feasibilities to meet your requirement and will provide you with
the appropriate solution at the earliest.
Regards,
Suriya Balamurugan.
Hello,
My question is a little different. What I mean is if I have a string of text in RTF format, can it be parsed into a format that can be applied to a .docx document?
For example, I have a RichTextbox in which the user can input text as well as formatting options like bold and italics and this information is returned to me in RTF. Then, I would like to take that information and apply it to text in my document created using the new WordDocument() command.
Thanks.
Natalie,
From the given details, we understand that your requirement is to copy the
format of the text from an RTF string and apply it to text in your DOCX format
document.
To achieve this, we have prepared a sample application, which can be downloaded
from the attachment below.
Note: Please find the input template document in the “Data” folder of
the attached sample application.
In this sample, we have done the following things.
1. Convert RTF format string to MemoryStream.
2. Open the RTF document using this
MemoryStream.
3. Find text and get character format of
the text from RTF document.
4. Open the DOCX document, find text and
get character format of the text from DOCX document.
5. Apply the character format of the
text in the RTF document to the text in the DOCX Word document.
6. Save the DOCX Word document.
Attachment: CopyformatfromRTFtoWord_63c456d4.zip
- 3 Replies
- 2 Participants
-
NW Natalie Westphal
- Jun 11, 2024 09:44 PM UTC
- Jun 13, 2024 07:07 PM UTC