1

In my application I am using Ckeditor, and i saved ckeditor text as a word Document, with the following code.

string Text = "<html><body>" + CKEditor1.Text + "</body></html>";
        string DownPath = @"c:\Files";

            using (System.IO.StreamWriter file = new System.IO.StreamWriter(DownPath + @"\" + "Filename" + ".Doc"))
            {
                file.Write(Text);
            }

Here the text and styles are saved as it is,But if there are any images in Ckeditor text, they are not displayed in the word document.

I have attached a snap of the word Image error .Error

Issue

How can i save ckeditor data to word with Images?

Nayantara Jeyaraj
  • 2,624
  • 7
  • 34
  • 63

1 Answers1

0

What your code did there could only create a text-based document, but not really a Word document.

In order to write image data into your document, you will have to use MS Word Object Model class. Just reference the Microsoft.Office.Interop.Word .NET library in your project and you will get heaps of related APIs that can be exposed in your code.

Take a look at this post, and it might be helpful to you.

Community
  • 1
  • 1
woodykiddy
  • 6,074
  • 16
  • 59
  • 100