added exportToHtml api and tests