WordDocument 接口描述

 

操作整个Word文档。

接口方法1:createDocument()创建文档

HTTP请求方法:POST

请求URL:https://api.e-iceblue.cn/v1/word/document/createDocument

请求参数:

参数 是否必选 类型 可选值范围 说明
name string 原文档名称
destFolder string 结果文档的存放路径,省略该参数,则默认存放到根目录
storage string 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null
format string docx, doc, docm, dot, dotm, dotx, wordml, rtf 文档格式

代码示例:

  • .NET
  • Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;

namespace CreateDocument
{
    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 WordDocumentApi wordDocumentApi = new WordDocumentApi(wordConfiguration);
        static void Main(string[] args)
        {
            string fileFormat = "docx";//doc, rtf, wordml, docm, dotx, dot, dotm
            string name = "createDocument_output";
            string destFolder = "output";
            string storage = null;
            wordDocumentApi.CreateDocument(fileFormat, name, destFolder, storage);
        }
    }
}

	
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.WordDocumentApi;

public class CreateDocument {

    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 WordDocumentApi wordDocumentApi = new WordDocumentApi(wordConfiguration);
    public static void main(String[] args) throws ApiException {

        String fileFormat = "docx";//doc, rtf, wordml, docm, dotx, dot, dotm
        String name = "createDocument_output";
        String destFolder = "output";
        String storage = null;
        wordDocumentApi.createDocument(fileFormat, name, destFolder, storage);
    }
}

接口方法2:getDocumentChildObjects()获取文档子对象

HTTP请求方法:GET

请求URL:https://api.e-iceblue.cn/v1/word/document/{name}/childObjects

请求参数:

参数 是否必选 类型 可选值范围 说明
name string 原文档名称
folder string 存放原文档的文件夹,没有则为null
storage string 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null
password string 原文档密码,没有则为null

代码示例:

  • .NET
  • Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;

namespace GetDocumentChildObjects
{
    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 WordDocumentApi wordDocumentApi = new WordDocumentApi(wordConfiguration);
        static void Main(string[] args)
        {
            var name = "template.docx";
            string folder = "input";
            string storage = null;
            string password = null;
            var response = wordDocumentApi.GetDocumentChildObjects(name, folder, storage, password);
        }
    }
}

	
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.WordDocumentApi;
import spire.cloud.word.sdk.client.model.ObjectInfo;

import java.util.List;

public class GetDocumentChildObjects {

    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 WordDocumentApi wordDocumentApi = new WordDocumentApi(wordConfiguration);

    public static void main(String[] args) throws ApiException {

        String name = "template.docx";
        String folder = "input";
        String storage = null;
        String password = null;
        List<ObjectInfo> response = wordDocumentApi.getDocumentChildObjects(name, folder, storage, password);
    }
}