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. Image for the cookie policy date
close icon

Export Workbook to HTML saves the active worksheet only?

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

5 Replies

AV Abirami Varadharajan Syncfusion Team 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 



EB Edward Brown 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.


AV Abirami Varadharajan Syncfusion Team 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 



EB Edward Brown 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.


AV Abirami Varadharajan Syncfusion Team 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 


Loader.
Live Chat Icon For mobile
Up arrow icon