Convert Documents with Text



Purpose 

To convert a document's existing file format (say docx) to any other file format (say html or txt) with text parameter.

Support file formats -> docx, odt, rtf, txt, html, pdf

HTTP Request URL

https://{zohoapis_domain}/writer/api/v1/documents/convert

Body Parameters

ParameterData TypeDescription
Mandatory Parameters
formatStringSpecify the format in which the converted document needs to be downloaded.
Supported file formats: docx, odt, rtf, txt, html and pdf
textStringProvide the required text that needs to be converted.
filenameStringSpecify a name to the converted document.
Note: PDF to Docx conversion is not supported in Writer yet.

Curl Snippet

Copiedcurl --location --request POST "https://www.zohoapis.com/writer/api/v1/documents/convert" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form "text=Sample content for conversion" \
  --form "format=docx" \
  --form "filename=Sample File"

Deluge Snippet

Copiedhtml_text = '<body><p>Hello</p><p>How are you? <b>My friend!</b><br></p><div style="width: 50px"><img src="https://www.epromsa.com/img/epromsa-logo-1435568219.jpg" width="168" height="50" /></div><br>Regards from <b>TicServei</b></body>';
html_file = html_text.toFile("Converted_doc");
partList = list();
partList.add({"paramName":"content","content":html_file});	
partList.add({"paramName":"format","content":"pdf","stringPart":"true"});      //output format
partList.add({"paramName":"filename","content":"Converted_doc","stringPart":"true"});   
My_PDF = invokeurl
[
	url :"https://writer.zoho.com/api/v1/documents/convert"
	type :POST
	files:partList
	connection:"<connection_name>"
]; 

Sample Response

Converted document will be downloaded.