Inserting preformatted text into a word document
Hi everybody !!
Initial situation: I got a string, which contains a RTF text like this:
{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
This is some {\b bold} text.\par
}
Now I want to insert this text into a word document and keep the with rtf defined format.
Another way could be copying the rtf-formatted text into the clipboard. But how do I insert text from the clipboard into a document?
Thanks
.Net 2.0 | Essential Studio 6.4.0.15
Initial situation: I got a string, which contains a RTF text like this:
{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
This is some {\b bold} text.\par
}
Now I want to insert this text into a word document and keep the with rtf defined format.
Another way could be copying the rtf-formatted text into the clipboard. But how do I insert text from the clipboard into a document?
Thanks
.Net 2.0 | Essential Studio 6.4.0.15
SIGN IN To post a reply.
5 Replies
BP
Bhuvaneswari P
Syncfusion Team
December 3, 2008 09:22 AM UTC
Hi Johannes,
Thank you for your interest in Syncfusion product.
Currently we don't have support to insert the RTF text into the word document using DocIO. We have planned to implement this feature in our next release.
We don't have any API's to insert the Copy clipboard to word document. But we can work around this by converting the Clipboard object to image and then insert the image into the table cell. Please find the below code snippet to do so:
[C#]
WordDocument doc = new WordDocument();
doc.EnsureMinimal();
Bitmap image = null;
if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap))
image = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
doc.LastParagraph.AppendPicture(image);
doc.Save("sample.doc");
Process.Start("Sample.doc");
Please let me know if you need any further assistance.
Best Regards,
Bhuvana
Thank you for your interest in Syncfusion product.
Currently we don't have support to insert the RTF text into the word document using DocIO. We have planned to implement this feature in our next release.
We don't have any API's to insert the Copy clipboard to word document. But we can work around this by converting the Clipboard object to image and then insert the image into the table cell. Please find the below code snippet to do so:
[C#]
WordDocument doc = new WordDocument();
doc.EnsureMinimal();
Bitmap image = null;
if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap))
image = (Bitmap)Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
doc.LastParagraph.AppendPicture(image);
doc.Save("sample.doc");
Process.Start("Sample.doc");
Please let me know if you need any further assistance.
Best Regards,
Bhuvana
VM
Van Meerbeeck Jonathan
June 24, 2015 04:30 AM UTC
Hello,
I want to copy RTF text as well into a word document. Is this feature already available?
Thank you
Kind regards
Jonathan
SK
Sathish K
Syncfusion Team
June 25, 2015 09:40 AM UTC
Hi Jonathan,
Thank you for contacting Syncfusion support.
We have created a separate incident under your account for the better follow up on your query. Kindly follow that incident to get solution for your query. Please let us know if you need any further assistance. We will be happy to assist you as always.
Regards,
Sathish
Thank you for contacting Syncfusion support.
We have created a separate incident under your account for the better follow up on your query. Kindly follow that incident to get solution for your query. Please let us know if you need any further assistance. We will be happy to assist you as always.
Regards,
Sathish
MA
Marimuthu
December 5, 2017 09:29 AM UTC
Do you support, appending RTF content to Word document ?
RH
Ramanan Hariharasubramanian
Syncfusion Team
December 6, 2017 12:36 PM UTC
Hi Marimuthu,
At present, DocIO does not have direct API to append the RTF content into an existing Word document.
You can use the below solution to append RTF content to an existing Word document.
1. Open the RTF content as new WordDocument instance.
2. Import this WordDocument instance, to the destination Word document using ImportContent() method. At present, DocIO does not have direct API to append the RTF content into an existing Word document.
You can use the below solution to append RTF content to an existing Word document.
1. Open the RTF content as new WordDocument instance.
We have prepared sample for the same. Please find the sample from below location.
Sample link:
http://www.syncfusion.com/downloads/support/forum/78094/ze/Sample-492701203
To know more about ImportContent method kindly refer the below UG documentation link.
https://help.syncfusion.com/cr/file-formats/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_ImportContent_Syncfusion_DocIO_DLS_IWordDocument_
Kindly let us know if the sample fulfills your requirement.
Regards,
Ramanan H
SIGN IN To post a reply.
- 5 Replies
- 6 Participants
-
JG Johannes Goetz
- Nov 27, 2008 04:26 PM UTC
- Dec 6, 2017 12:36 PM UTC