{"id":553,"date":"2012-01-13T14:37:55","date_gmt":"2012-01-13T12:37:55","guid":{"rendered":"http:\/\/www.calvert.ch\/maurice\/?p=553"},"modified":"2018-12-17T13:19:10","modified_gmt":"2018-12-17T12:19:10","slug":"convert-excel-to-html-with-formatting","status":"publish","type":"post","link":"https:\/\/www.calvert.ch\/maurice\/2012\/01\/13\/convert-excel-to-html-with-formatting\/","title":{"rendered":"Convert Excel to HTML with formatting"},"content":{"rendered":"<p><a href=\"http:\/\/www.calvert.ch\/download\/HTMLWriter.xlsm\">This spreadsheet<\/a> contains the VBA code to write an Excel range as a clean, formatted HTML page, with optional auto-refresh.<br \/>\n<strong>NOTE<\/strong> If you click on the &#8216;This spreadsheet&#8217; link above and it opens a ZIP file or a set of HTML files, right-click on the link and choose Save As.<\/p>\n<p>Features:<\/p>\n<ul>\n<li>Correctly renders\u00a0<strong>all<\/strong> Excel formatting, including conditional formats.<\/li>\n<li>Renders embedded charts.<\/li>\n<li>Generates an HTML page with tabs identical to those in the Excel file.<\/li>\n<li>Creates clean, formatted HTML that validates to HTML 4.01 strict.<\/li>\n<li>Optimised stylesheet to ensure minimal page weight.<\/li>\n<li>Supports merged cells with ROWSPAN and COLSPAN.<\/li>\n<li>Updates the webpage automatically when cells&#8217; values are changed.<\/li>\n<li>The webpage automatically refreshes itself at a user-supplied interval.<\/li>\n<\/ul>\n<p>The result is almost pixel-perfect, compare\u00a0<a href=\"http:\/\/www.calvert.ch\/download\/HTMLWriter.png\" target=\"_blank\">this Excel screenshot<\/a> with <a href=\"http:\/\/www.calvert.ch\/download\/HTMLWriter.html\" target=\"_blank\">the HTML page it generated<\/a>.<\/p>\n<p>14 March 2013. Update, improved lower tab bar to stop over-spilling (thanks to Paul Palmer) and added support for 64-bit Office.<\/p>\n<p>21 August 2014. Many people have asked how to insert an image in the HTML page. It is not possible to get the contents of an embedded Excel image, but it <strong>is<\/strong> possible to get an embedded chart. Here&#8217;s how to perform this trick:<\/p>\n<ol>\n<li>In the sheet to be published, make sure no cells are selected<\/li>\n<li>Excel Menu->Insert->Chart and choose any chart type. This will insert an empty chart.<\/li>\n<li>Move and size the empty chart as required<\/li>\n<li>Select the chart by clicking its border<\/li>\n<li>Excel Menu->Layout and click the Picture icon<\/li>\n<li>Select an image file (JPG, BMP, etc) and Insert<\/li>\n<\/ol>\n<p>28 September 2014. Now handles Unicode text correctly.<\/p>\n<p>17 December 2018. Now outputs hyperlinks correctly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This spreadsheet contains the VBA code to write an Excel range as a clean, formatted HTML page, with optional auto-refresh. NOTE If you click on the &#8216;This spreadsheet&#8217; link above and it opens a ZIP file or a set of <a href='https:\/\/www.calvert.ch\/maurice\/2012\/01\/13\/convert-excel-to-html-with-formatting\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,11],"tags":[19,45],"class_list":["post-553","post","type-post","status-publish","format-standard","hentry","category-programming","category-technology","tag-excel","tag-html","category-47-id","category-11-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"_links":{"self":[{"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/posts\/553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/comments?post=553"}],"version-history":[{"count":13,"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/posts\/553\/revisions"}],"predecessor-version":[{"id":1117,"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/posts\/553\/revisions\/1117"}],"wp:attachment":[{"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/media?parent=553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/categories?post=553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.calvert.ch\/maurice\/wp-json\/wp\/v2\/tags?post=553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}