Provide docx snippet for copy&paste into Word

Hi there,

I would like to provide content, representing either a complete Word document or just a part, to the system clipboard which can then be pasted into Word >= 2010.

I found a solution using the RTF format in this Forum (Copy Document To Clipboard), but would it be possible using, e.g., DOCX?

By using the RTF format, I would loose a lot of formatting information.

Thanks a lot!

Andreas

Hi Andreas,

Thanks for your inquiry. Could you please attach your input Word document (.docx) here for testing? Also, please execute the following code on your .docx file. Open a new blank document in MS Word and paste content in .rtf format from clipboard in it. Save the document and attach final document here for our reference.

Document doc = new Document(MyDir + @"Template-v1.docx");
using (MemoryStream stream = new MemoryStream())
{
    doc.Save(stream, SaveFormat.Rtf);
    Clipboard.SetText(Encoding.UTF8.GetString(stream.ToArray()), TextDataFormat.Rtf);
}

Please create screenshot(s) highlighting the problematic areas in the final document and attach them here for our reference. We will investigate the issue on our end and provide you more information.

Best regards,

Hi Awais,

thanks for your reply. After your answer I did a little research and was suprised, that I found RTF specification 1.9.1 from 2008 supporting Word 2007.

I thought, RTF has not been changed since the 90s, which is definitely wrong. Now, I will try the RTF way…

Does Aspose support the latest RTF specification or are there things which are not represented?

Thanks!

Best regards,

Andreas

Hi Andreas,

Thanks for your inquiry. Yes, Aspose.Words supports RTF specification 1.9.1.

Best regards,