0

我有要转换为 doc 文件的 html 文本。我尝试使用 CloudConvert API 控制台 ( https://cloudconvert.com/api/convert/html-to-doc ) 生成请求。在 Code Snippets > HTML form 中,这给了我以下形式:

<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 格式?

4

1 回答 1

1

设置filenametest.html(如错误消息所述,它应该是输入文件的名称)。

于 2019-03-07T22:41:11.387 回答