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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export Workbook to HTML saves the active worksheet only?

Thread ID:

Created:

Updated:

Platform:

Replies:

145308 Jun 17,2019 10:23 AM UTC Jun 20,2019 04:59 PM UTC WinForms 5
loading
Tags: XlsIO
Edward Brown
Asked On June 17, 2019 10:23 AM UTC

Hello,

I've been testing the export to HTML of an entire multi-sheet workbook. It appears that only the active worksheet is exported. I had hoped it would export each sheet and include in the exported HTML a way to move between the sheets. However I can't find anything online saying what should be exported under these circumstances. Any clarity and / or workarounds would be appreciated.

Thanks

Ed

Abirami Varadharajan [Syncfusion]
Replied On June 18, 2019 07:36 AM UTC

Hi Edward, 

Greetings from Syncfusion. 

You can export particular worksheet or an entire workbook to HTML using SaveAsHtml. Please find the code below to save the workbook as HTML. 

//Save the workbook as HTML file 
workbook.SaveAsHtml("Output.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default); 

You can refer to below documentation and online sample to know more about Exporting excel file as HTML in detail. 



Regards, 
Abirami 


Edward Brown
Replied On June 18, 2019 08:12 AM UTC

Thanks for the reply. However, my question was about the conversion of an entire workbook to HTML, and how this is supposed to behave.

For example, if a workbook is made up of three worksheets - then if I use SaveAsHTML on the workbook, it only appears to save the active sheet. I just want to know if this is the expected behaviour, and if there's any way to convert the entire workbook into HTML.

Abirami Varadharajan [Syncfusion]
Replied On June 19, 2019 10:10 AM UTC

Hi Edward, 

While converting entire workbook to HTML, active sheet’s content should be visible in the web page. You can switch to view other sheet’s content by clicking the sheet name in the sheet tab at bottom of the page.  

We have prepared video screenshot and sample for your reference which can be downloaded from following links. 



If you still face issue, kindly modify the sample above to reproduce the issue and get back to us with an issue reproducing sample which will be helpful for us to validate further from our side. 

Regards, 
Abirami 


Edward Brown
Replied On June 19, 2019 11:18 AM UTC

Hello,

Thank you for the example. It pointed me in the right direction. The HTML file it produces works fine in Chrome - I get the tabs across the bottom and can click them to switch between the worksheets.

The program I am developing uses the classic ActiveX WebBrowser control (with registry settings to have it use IE11) to display the converted workbook. IE is finding the 'mark of the web' in the top level webpage, and preventing the Tabs frame from loading, as it contains javascript. Therefore, the WebBrowser displays the active worksheet but not the tab area, leading to my initial, incorrect conclusion.

I think I can take it from here, possibly by just removing the mark of the web line.

Abirami Varadharajan [Syncfusion]
Replied On June 20, 2019 04:59 PM UTC

Hi Edward, 

Thank you for updating us. 

Yes, you may face sheet navigation issue while opening the output file in Internet Explorer as we restrict running the javascript. We request you to remove below line from the generated file in order to switch between sheet tabs. 

<!-- saved from url=(0014)about:internet --> 

Regards, 
Abirami 


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.

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

Live Chat Icon For mobile
Live Chat Icon