Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu May 21, 2015 10:44 am

Hi,

I would like to take a word document and read the contents into a string (HTML) so that I can return it in an AJAX response. C#

mark3rown
 
Posts: 1
Joined: Thu May 21, 2015 9:00 am

Fri May 22, 2015 3:43 am

Hello,

Thanks for your inquiry.
Please refer the following code:
Code: Select all
Document doc = new Document();
Section sec = doc.AddSection();
Paragraph par = sec.AddParagraph();
par.Text = "hello, world";
String htmlString = "";
using (MemoryStream ms = new MemoryStream())
{
  doc.SaveToStream(ms, FileFormat.Html);
   htmlString = System.Text.Encoding.UTF8.GetString(ms.ToArray());
}


Best Regards,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue May 26, 2015 8:45 am

Hello,

Have you tried the code ? Has your issue been resolved? Could you please give us some feedback at your convenience ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.Doc