HTML Export Reference Implementation

The KeyView Export SDK includes a reference implementation that demonstrates how to export documents to HTML. The reference implementation includes source code for a library named libkvhtmlexport, and a sample program named kvhtmlexport.

The libkvhtmlexport library is written in C++ and provides a simple interface to HTML Export. You can:

  • use the library in your own product, if it provides the functionality you need.
  • modify the library to provide the functionality you desire.
  • look at the source code to help you learn how to use the C API, which provides much greater flexibility.

The library uses partition information provided by KeyView to provide the following features out-of-the-box:

  • A "print" view for word-processor documents. This creates a web page containing a representation of the original document, which is easy to read because it uses the correct page widths and margins.
  • A "tabbed" view for spreadsheet files. This shows spreadsheets using a familiar tabbed interface, with one worksheet on each tab.
  • A "list" view for presentations. This displays multiple slides, arranged in a vertical column one after another, on a single web page.
  • A "full screen" view for presentations. This displays one slide at a time. You can navigate between slides using the arrow keys on your keyboard or the scroll wheel on your mouse.

When the reference implementation is used to export a file that contains subfiles, the subfiles are listed in a side panel.

The following image shows a Microsoft Word document that has been exported to HTML, being displayed in a web browser:

The following image shows a Microsoft Excel workbook that has been exported to HTML, being displayed in a web browser. Additional sheets can be viewed by clicking the tabs at the bottom of the window.

The interface for the library is in htmlexport/libkvhtmlexport/include/libkvhtmlexport.h, and the implementation is in htmlexport/libkvhtmlexport/src/. Building the reference implementation requires C++11.

The kvhtmlexport sample program uses the library to convert documents to HTML. The source code is provided in htmlexport/libkvhtmlexport/sample/src/. A compiled binary is also provided, in the PLATFORM/bin folder, so that you can try it without having to build it yourself. For more information, see kvhtmlexport.

NOTE: The compiled binary for kvhtmlexport has an embedded trial license, which expires approximately five months after release. If you set the environment variable KV_SAMPLE_PROGRAM_LICENSE_FROM_FILEPATH to a file path, the sample program reads your license from the specified file. This allows you to use the program after the embedded trial license has expired, and to test or troubleshoot with your own license.