合并多个 Word 文档到一个文档。
接口方法 1:mergeDocument() 合并文档
HTTP 请求方法:PUT
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/mergeDocument
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
password | 否 | string | 原文档密码,没有则为null | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
files | 是 | array[object] | 存于List中将被合并只原文的的所有文档 | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
using Spire.Cloud.Word.Sdk.Model;
using System.Collections.Generic;
namespace MergeDocument
{
class Program
{
static string appId = "your id";
static string appKey = "your key";
static string baseUrl = "https://api.e-iceblue.cn";
static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl);
static MergeApi mergeApi = new MergeApi(wordConfiguration);
static void Main(string[] args)
{
string name = "mergeDocument1.docx";
List files = new List() {
new MergingFile("input/mergeDocument2.docx", null, null)
};
string folder = "input";
string storage = null;
string password = null;
string destFilePath = "output/mergeDocument_output.docx";
mergeApi.MergeDocument(name, files, destFilePath, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.MergeApi;
import spire.cloud.word.sdk.client.model.MergingFile;
import java.util.*;
public class MergeDocuments {
static String appId = "your id";
static String appKey = "your key";
static String baseUrl = "https://api.e-iceblue.cn";
static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl);
static MergeApi mergeApi = new MergeApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "mergeDocument1.docx";
List<MergingFile> files = new ArrayList<MergingFile>();
files.add(new MergingFile("input/mergeDocument2.docx",null,null));
String folder = "input";
String storage = null;
String password = null;
String destFilePath = "output/mergeDocument_output.docx";
mergeApi.mergeDocument(name, files, destFilePath, folder, storage, password);
}
}