【问题标题】:Error converting raw HTML input into a .doc file with cloudconvert使用 cloudconvert 将原始 HTML 输入转换为 .doc 文件时出错
【发布时间】:2019-07-29 21:47:55
【问题描述】:

我有想要转换成 doc 文件的 html 文本。我尝试使用 CloudConvert API 控制台 (https://cloudconvert.com/api/convert/html-to-doc) 来生成请求。在代码片段 > 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 格式?

【问题讨论】:

    标签: html docx doc converters cloudconvert


    【解决方案1】:

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

    【讨论】:

    • 谢谢,这行得通。当我只想上传原始文本时,要求“输入文件名”是违反直觉的......
    猜你喜欢
    • 2018-01-14
    • 2022-01-17
    • 1970-01-01
    • 2014-08-10
    • 2011-05-25
    • 1970-01-01
    • 1970-01-01
    • 2014-01-26
    • 1970-01-01
    相关资源
    最近更新 更多