DEV Community

Cover image for HTML to Word? Weird right?
Sohail Pathan
Sohail Pathan

Posted on

HTML to Word? Weird right?

Recently, one user came to me asking whether we can provide this API.

The use case was quite simple - he wanted to export the HTML report to a Word file so that he could edit it. It was only possible in Word Documents due to the complex structures of the report and he was using ASP.net

I went to Google to find if there is any provider of this API that can solve the use case but nothing solid came to hand. We @ Apyhub decided to build this utility and today it's LIVE and available to test.

You can send an HTML file, it seamlessly converts it to a Microsoft Word File while preserving formatting and readability.

Note: One problem lies within fetching images which is problematic and we're trying to solve it.

Link to API: https://apyhub.com/utility/html-to-docx

But why I'm posting this here:

Firstly, It will be great to have feedback on this API. I would love to know if you find any more use cases where this API fits the need.

Second, A message from developer to developer - Anything can be built so don't restrict yourself from your limits. Give it a try - you will at least get validation.

Thanks :)

Top comments (3)

Collapse
 
ranjancse profile image
Ranjan Dailata • Edited

Great post.

HTML to DOCX was provided by at least 3 vendors from ages ;)

cloudconvert
convertio
aspose

Let's say, I choose an option of URL and provide the below sample URL, it fails.

html-to-docx

However, if I specify with sample.html it works fine.

When the API specifies the URL type, the least expected behavior of an API is to internally parse and handle the HTML response and then convert to DOCX or whatever intended format. However, currently it doesn't work that way for Apyhub

Collapse
 
iamspathan profile image
Sohail Pathan

@ranjancse Thanks for the feedback and for being a savior too ;)

For URL input, it's currently accepting hosted files with only .html format. However, the behavior you mentioned is fair. I'll take this to the team and add it to the improvement pipeline.

I went to Google to find if there is any provider of this API but nothing solid came to hand

This relates to the use case he was trying to solve and an alternative to phpdoc.org/

Collapse
 
ranjancse profile image
Ranjan Dailata

Some more strict validation and error handling and letting the users know about it needs to be done in a better manner.

Here is an example from cloudconvert

cloudconvert-html-2-docx-url