CreateDocWithFileFromDatas

Method : Post

Interface Function

step 1: Creating a word/excel/pdf file according to the input argument "Datas" and the document template which code is "TemplateCode".

step 2: Creating a document which belongs to the form "FormAlias" with the initial values from "Doc".

step 3: Binding the file created in step 1 to the doc created in step 2.

note: this API is generally used when the template is a word file with a table, or excel file..

Request Parameter
Parameter Required Type Remarks
TemplateCode Yes String Word/Excel file template code
FormAlias Yes String Form alias, the identity of the form
FileFieldName Yes String The name of the "FileUpload" control field that will be bound by the created file in step 1
TransferPdf No String true:the generated file format is PDF;
false:the generated file format is same with the corresponding template's file format
FileName No String Generated file name, if it's null, it will be assigned by the value of the file name of the corresponding template.
Doc No Dictionary The data that should be saved in the created doc.
Datas Yes Dictionary[] The data that should be filled into the document template
UserCode Yes String The creator staff code (Required, or you will be unable to edit this document)
UserName Yes String The creator name
Return Data Type(Data)

StatusCode: 200 if success, others if fail.

Info: the value will not be empty if error occurs, it shows the error message.

Data (string): the created document id.

public class ResultMsg
{
  public int StatusCode { get; set; }
  public string Info { get; set; }
  public object Data { get; set; }
}
Input Sample
{
    "UserCode" : "##66522552323222",
    "UserName" : "Eason",
    "TemplateCode": "ABC",
    "FormAlias": "Eason",
    "FileFieldName": "File",
    "TransferPdf": true,
    "FileName": "report information",
    "Doc": {
        "FieldName_A" : "value-A",
        "FieldName_B" : "value-B",
        "FieldName_C" : "[{\"Type\":1,\"Count\":1,\"Status\":false}]",
    },
    "Datas": [{
        "A" : "A",
        "B" : 2,
        "C" : true,
    },{
        "A" : "A",
        "B" : 2,
        "C" : true,
    },{
        "A" : "A",
        "B" : 2,
        "C" : true,
    }]
}
Return Sample
{
  "StatusCode": 200,
  "Info": "",
  "Data": "cf49a2bc-ee10-455c-9ac2-facf7dcd2a00"
}
© Digital Maker Product Team all right reserved,powered by Gitbook该文件修订时间: 2023-02-02 10:40:12

results matching ""

    No results matching ""