我有html文本我想转换成doc文件。我尝试使用CloudConvert API控制台(https://cloudconvert.com/api/convert/html-to-doc)来生成请求。在Code Snippets> HTML表单中,这给了我以下表单:
<form action="https://api.cloudconvert.com/convert" method="POST" enctype="multipart/form-data">
<input type="hidden" name="apikey" value="MyAPIKey">
<input type="hidden" name="inputformat" value="html">
<input type="hidden" name="outputformat" value="doc">
<input type="hidden" name="input" value="raw">
<input type="hidden" name="file" value="<p>test</p>">
<input type="hidden" name="filename" value="test.doc">
<input type="hidden" name="wait" value="true">
<input type="hidden" name="download" value="true">
<input type="submit" value="Convert!">
</form>
但是这不起作用,我不断得到同样的错误:
{"error":"The filename parameter should be the name of the input file, not of the output file!","code":400}
该错误具有误导性,因为此处没有输入“文件”;并且输出文件的名称是必需的 - 如果我保留文件名参数,它也会抱怨。
我在这里做错了什么,或者有没有可以将HTML转换为.doc或.docx格式的替代服务?
将filename
设置为test.html
(如错误消息所示,它应该是输入文件的名称)。