Rendering HTML content in Word and Excel (in .NET)

A key part of our cash collection service involves document conversion from HTML templates to DOC, XLS or PDF.

After years of usage, our current solution causes us conversion issues from time to time and we also started seeing limitations such as difficulty of integrating it into new APIs.

At Sidetrade, we welcome all opportunities to improve our processes and find better solutions to problems.

So, we decided to reconsider our options and enhance our home-made library. We wanted to find a viable, powerful and easy to maintain library that meets our needs and is easy to integrate into our current architecture.

The initial need was simple: convert HTML to other formats. But the task of choosing the best library for this becomes more complicated when you must consider the existing html contents for each customer without having to modify it.

After some research we came up with a list of questions to answer in order to evaluate new libraries: does it meet our needs? How easy is it to use within the .Net environment? Is there a Nuget package available? Is the documentation clear enough? And what about pricing?

We also wanted to avoid using any online conversion tools.

Considering the above, we have tried different libraries in our dev environment using existing html contents and we have compared the result with the documents generated using our existing tool.

Some of them did not work with the existing html content. Others gave us results with some imperfections such as invisible table borders, misaligned text and titles or poorly rendered images.

For context, we evaluated the following libraries/suppliers, in some detail…

  • Dev Express
  • Sautinoft
  • Aspose
  • Subsystems
  • GemBox
  • Syncfusion
  • iditect

Aspose stood out from other libraries by correctly handling our complex html requirements and the variety of different nuances we have to handle.

The first attempt to convert html to docx using Aspose gave us a better-looking result, which encouraged us to continue testing more complex html templates. Also, in the trial version there is no limit to the Html input size which is useful. As a result of these tests, we were convinced that Aspose can handle our html files without any adjustments.

Another good surprise was that Aspose is easy to integrate into our APIs as we can chose the right package to use depending on the programming environment (.NET). We can provide the HTML content as string input and Aspose converts it into a memory stream without saving the file to disk. This allows us to transfer the converted stream directly to the front end.

We have found useful examples here, in the Aspose Github repository.

Above all, our choice is confirmed by the fact that Aspose is a widely used library trusted by companies like Microsoft and meets the security requirements demanded by our CISO.

To conclude, Aspose allows us to manipulate complex html contents using few simple lines of code and reducing the development time. We believe that it will play a key role in delivering new features for our customers in a near future.

AI-powered Order-To-Cash Platform