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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Convert doc to HTML

Thread ID:





120638 Sep 29,2015 06:15 PM UTC Oct 1,2015 08:17 AM UTC ASP.NET Web Forms 3
Tags: DocIO
Gary Rumble
Asked On September 29, 2015 06:15 PM UTC

Is it possible to get DocIO to save to HTML as one file per page?

The default is one HTML file for the entire document.

Sathish K [Syncfusion]
Replied On September 30, 2015 05:56 AM UTC

Hi Gary,

Thank you for contacting Syncfusion support.

If your requirement is to save each and every pages of the Word document as separate HTML file, then kindly keep each and every pages as separate sections in the Word document and iterate each sections from the Word document then save them as separate HTML files using the below code example.

Code example:
//Opens the source document

WordDocument sourceDocument = new WordDocument(@"File location");

int i = 1;

//Iterates the sections

foreach (WSection section in sourceDocument.Sections)


//Instatiating the new WordDocument object

WordDocument htmlDocument = new WordDocument();

//Add the current section to the new Word document


//Saves the document.

htmlDocument.Save("DocIOHTML" + i.ToString() + ".html", FormatType.Html);

//Closing WordDocument instance




//Closing source document instance


Gary Rumble
Replied On September 30, 2015 03:42 PM UTC

Unfortunately, I don't have any control over the doc file, it's provided by someone else.

Currently, it looks like the file has one section, but multiple pages, so the code below doesn't work.

I can use the render as images to get individual pages, but save to HTML just gives me one file.

Divyalakshmi Vasudevan [Syncfusion]
Replied On October 1, 2015 08:17 AM UTC

Hi Gary,

Thank you for your update.

The Word document is a flow document in which contents will not be preserved page by page; instead the contents will be preserved sequentially section by section. Each section may extend to various pages based on its contents like table, text, images etc. Word viewer/editor renders the contents of the Word document page by page dynamically when opened for viewing or editing and these page wise rendered information will not be preserved in the document level as per the Word file format specification. Whereas Essential DocIO is a non UI component that provides a full-fledged document object model to manipulate the Word document contents. Hence currently it is not feasible to meet your requirement.

Please let us know in case of any other questions.

Divyalakshmi V


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon