【问题标题】:html-to-xlsx jsreport recipe with initial xlsx template file - HTTP API request带有初始 xlsx 模板文件的 html-to-xlsx jsreport 配方 - HTTP API 请求
【发布时间】:2020-03-21 21:46:36
【问题描述】:

我尝试使用 JsReport HTTP API https://jsreport.net/learn/api 和初始附加的 xlsx 模板生成 xlsx-to-html 配方报告。

文档缺少如何构建请求正文以传递额外的 xlsx 文件,如 bleow 示例:

我尝试在模板对象中添加以下对象:

template: {
   ...
   engine: "handlebars",
   recipe: "html-to-xlsx",
   xlsxTemplate: {
      content: "base64_string_of_template_xlsx_file_........."
   }
   ...
}

但没有成功。

应该如何构造这个请求的 JSON 体?

【问题讨论】:

标签: html api http xlsx jsreport


【解决方案1】:

我设法找到了被 JsReport 正确使用的正确 json:

{
   "Template": {
      "Content": "template def string..",
      "Recipe": "html-to-xlsx"
      "Engine": "handlebars",
      "BaseXlsxTemplate": {
         "Content": "base-template-string-encoded-as-base64",
      },
      "HtmlToXlsx": {
         "InsertToXlsxTemplate": true, 
         "WaitForJS" = false,
         "HtmlEngine" = "chrome"
      }
   },
   "Data": "Json data...",
   "Options": {...}
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-17
    • 2019-01-26
    • 1970-01-01
    • 2013-02-26
    • 1970-01-01
    相关资源
    最近更新 更多