GrabzIt's DOCX API makes it easy to convert HTML and web pages into the Microsoft Word file format. This HTML to DOCX and URL to DOCX service uses a browser to render the HTML first as a web page. This then helps to generate more accurate conversions when creating the Word documents.
As you can see in the demo. The HTML to DOCX API will allow a developer to convert any HTML into an editable word document. Of course, HTML pages are not directly equivalent to Word docs. As some features of HTML, such as background images, do not translate well into DOCX files. To overcome these problems there are additional options to restrict what features are converted into a DOCX.
Why would you want to create Word documents over something like PDF? The main advantage of that DOCX file type is that it is both an open format and can be easily edited. Which is a common requirement in many apps. One such example would be to create a report or invoice template for the user to edit.
After testing the rendering of our URL to DOCX and HTML to DOCX services. We are confident our HTML converter is providing the best DOCX conversions available today.
Use GrabzIt's HTML to DOCX functionality to add the ability to convert HTML snippets into Word documents, directly from your app. Or if you are wondering how to convert HTML files to Word documents. This is also possible by using the FileToDOCX
rather than the HTMLToDOCX
method shown below.
The demo code below demonstrates how simple it is to create a Word document from HTML using any ASP.NET language such as C#, which is shown below. To start converting HTML to DOCX just follow these instructions to start using the a ASP.NET demo app.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); grabzIt.HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>"); grabzIt.SaveTo("documents/result.docx");
The demo code below demonstrates how simple it is to create a Word document from HTML using Java. To start converting HTML to DOCX just follow these instructions to start using the a Java demo app.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); grabzIt.HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>"); grabzIt.SaveTo("documents/result.docx");
The demo code below demonstrates how simple it is to convert HTML to DOCX using JS. To start creating DOCX documents first download GrabzIt's JavaScript Library. Then get your key and secret, add the domain you want to use the GrabzIt on. Then check out the screenshot API documentation for JavaScript to find out all the ways you can use GrabzIt's API.
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@<%= APIVersion.JavaScript %>/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertHTML("<html><body><h1>Hello World!</h1></body></html>",
{"format": "pdf"}).Create();
</script>
The demo code below demonstrates how simple it is to create a Word document from HTML using Node.js. To start converting HTML to DOCX just follow these instructions to start using the a Node.js demo app.
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); client.html_to_docx("<html><body><h1>Hello World!</h1></body></html>"); client.save_to("documents/result.docx", function (error, id){ if (error != null){ throw error; } });
The demo code below demonstrates how simple it is to create a Word document from HTML using Perl. To start converting HTML to DOCX just follow these instructions to start using the a Perl demo app.
#!/usr/bin/perl use GrabzItClient; $grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); $grabzIt->HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>"); $grabzIt->SaveTo("documents/result.docx");
The demo below demonstrates a simple HTML to Word converter script. That converts HTML to word in PHP. To use PHP for HTML to Word conversions just follow these instructions and start using the a PHP demo app.
include("GrabzItClient.php"); $grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); $grabzIt->HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>"); $grabzIt->SaveTo("documents/result.docx");
The demo code below demonstrates how simple it is to create a Word document from HTML using Python. To start converting HTML to DOCX just follow these instructions to start using the a Python demo app.
from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>") grabzIt.HTMLToDOCX("<html><body><h1>Hello World!</h1></body></html>") grabzIt.SaveTo("documents/result.docx")
The demo code below demonstrates how simple it is to create a Word document from HTML using GrabzIt's RESTful API.
curl
-d key=Sign in to view your Application Key
-d format=docx
-d html=%3Chtml%3E%3Cbody%3E%3Ch1%3EHello%20World%21%3C%2Fh1%3E%3C%2Fbody%3E%3C%2Fhtml%3E
https://api.grabz.it/services/convert
The demo code below demonstrates how simple it is to create a Word document from HTML using Ruby. To start converting HTML to DOCX just follow these instructions to start using the a Ruby demo app.
require 'grabzit' grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")%>") grabzItClient.html_to_docx("<html><body><h1>Hello World!</h1></body></html>") grabzItClient.save_to("documents/result.docx")
If you need to convert a web page to DOCX then GrabzIt's URL to DOCX API is what you need. This API will convert any webpage to DOCX using our network of globally positioned servers to generate Word documents as quickly as possible.
It is also easy to create a Word document from a webpage using our ASP.NET API. Just specify the URL you want to convert, as shown in the C# example below. To start converting URL's to DOCX just follow these instructions to start using the a ASP.NET demo app.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); grabzIt.URLToDOCX("https://www.tesla.com"); grabzIt.SaveTo("documents/result.docx");
It is also easy to create a Word document from a webpage using our Java API, just specify the URL you want to convert, as shown below. To start converting URL's to DOCX just follow these instructions to start using the a Java demo app.
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); grabzIt.URLToDOCX("https://www.tesla.com"); grabzIt.SaveTo("documents/result.docx");
It is also easy to create a Word document from a webpage using our JavaScript API, just specify the URL you want to convert, as shown below. To start creating DOCX documents download GrabzIt's JavaScript Library. Then get your key and secret, add the domain you want to use GrabzIt on. Then check out the screenshot API documentation for JavaScript to find out all the ways you can use GrabzIt's API.
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@<%= APIVersion.JavaScript %>/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("https://www.tesla.com",
{"format": "docx"}).Create();
</script>
It is also easy to create a Word document from a webpage using our Node.js API, just specify the URL you want to convert, as shown below. To start converting URL's to DOCX just follow these instructions to start using the a Node.js demo app.
var grabzit = require('grabzit'); var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); client.url_to_docx("https://www.tesla.com"); client.save_to("documents/result.docx", function (error, id){ if (error != null){ throw error; } });
It is also easy to create a Word document from a webpage using our Perl API, just specify the URL you want to convert, as shown below. To start converting URL's to DOCX just follow these instructions to start using the a Perl demo app.
#!/usr/bin/perl use GrabzItClient; $grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); $grabzIt->URLToDOCX("https://www.tesla.com"); $grabzIt->SaveTo("documents/result.docx");
It is also easy to create a Word document from a webpage using our PHP API, just specify the URL you want to convert, as shown below. To start converting URL's to DOCX just follow these instructions to start using the a PHP demo app.
include("GrabzItClient.php"); $grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>"); $grabzIt->URLToDOCX("https://www.tesla.com"); $grabzIt->SaveTo("documents/result.docx");
It is also easy to create a Word document from a webpage using our Python API, just specify the URL you want to convert, as shown below. To start converting URL's to DOCX just follow these instructions to start using the a Python demo app.
from GrabzIt import GrabzItClient grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")%>") grabzIt.URLToDOCX("https://www.tesla.com") grabzIt.SaveTo("documents/result.docx")
It is also easy to create a Word document from a webpage using our RESTful API, just specify the URL you want to convert, as shown below.
https://api.grabz.it/services/convert?key=Sign in to view your Application Key&format=docx&url=https%3A%2F%2Fwww.tesla.com
It is also easy to create a Word document from a webpage using our Ruby API, just specify the URL you want to convert, as shown below. To start converting URL's to DOCX just follow these instructions to start using the a Ruby demo app.
require 'grabzit' grabzItClient = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")%>") grabzItClient.url_to_docx("https://www.tesla.com") grabzItClient.save_to("documents/result.docx")
If you would like to know more about how GrabzIt converts HTML into DOCX read this guide on supported CSS attributes.