There are several major issues with the ExportHtml method. A large one being that the writer is never closed. This causes major problems such as much of the document never being written.
Some changes that would really help are as follows:
1) Convert the content to ASCII and store it temporarily. Use the temporary content for writing. This solves the encoding issue mentioned in the remarks. It can be done using the Encoding.Convert method.
2) Surround the content in a div tag like this
3) Close the writer
Some changes that would really help are as follows:
1) Convert the content to ASCII and store it temporarily. Use the temporary content for writing. This solves the encoding issue mentioned in the remarks. It can be done using the Encoding.Convert method.
2) Surround the content in a div tag like this
writer.WriteLine("<div style=\"float: left; white-space: pre; line-height: 1; \">");
.
// Write the document
.
writer.WriteLine("</div>");
Then just write the spaces directly instead of using non-breaking space.3) Close the writer
writer.Close();
Because of these problems I would recommend writing your own function using the code above and fixes.