We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Inserting preformatted text into a word document

Thread ID:

Created:

Updated:

Platform:

Replies:

78094 Nov 27,2008 11:26 AM Dec 6,2017 07:36 AM Windows Forms 5
loading
Tags: DocIO
Johannes Goetz
Asked On November 27, 2008 11:26 AM

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


Bhuvaneswari P [Syncfusion]
Replied On December 3, 2008 04:22 AM

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



Van Meerbeeck Jonathan
Replied On June 24, 2015 12:30 AM

Hello,

I want to copy RTF text as well into a word document. Is this feature already available?

Thank you

Kind regards
Jonathan

Sathish K [Syncfusion]
Replied On June 25, 2015 05:40 AM

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


Marimuthu
Replied On December 5, 2017 04:29 AM

Do you support, appending RTF content to Word document ? 

Ramanan  Hariharasubramanian [Syncfusion]
Replied On December 6, 2017 07:36 AM

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.

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/cref_files/file-formats/docio/Syncfusion.DocIO.Base~Syncfusion.DocIO.DLS.WordDocument~ImportContent.html

Kindly let us know if the sample fulfills your requirement.

Regards,
Ramanan H


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;