操作Excel文档的属性,包括设置文档属性,获取属性以及删除已有属性。
接口方法1:setDocumentProperties()设置文档属性
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/documentproperties
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
properties | 否 | object | { "SelfUri": { "Relation": "Relation", "Href": "Href", "Title": "Title", "LinkType": "LinkType" }, "List": [ { "SelfUri": { "Relation": "Relation", "Href": "Href", "Title": "Title", "LinkType": "LinkType" }, "Name": "string", "Value": "string", "BuiltIn": true } ] } | 设置文档属性 |
password | 否 | string | 文档密码,没有则为null | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.*;
import spire.cloud.excel.sdk.api.PropertiesApi;
import spire.cloud.excel.sdk.model.*;
import java.util.ArrayList;
public class setDocumentProperties {
static String appId = "your id";
static String appKey = "your key";
static String baseUrl = "https://api.e-iceblue.cn";
static Configuration configuration = new Configuration(appId, appKey, baseUrl);
static PropertiesApi propertiesApi = new PropertiesApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "SetDocumentProperties.xlsx";
String password = null;
String folder = "input";
String storage = null;
DocumentProperties properties = new DocumentProperties();
DocumentProperty property = new DocumentProperty("Keywords", "Set document properties.", false);
DocumentProperty property2 = new DocumentProperty("Author", "eiceblue", false);
DocumentProperty property3 = new DocumentProperty("Company", "冰蓝", true);
DocumentProperty property4 = new DocumentProperty("Last saved by", "该 Email 地址已受到反垃圾邮件插件保护。要显示它需要在浏览器中启用 JavaScript。", true);
DocumentProperty property5 = new DocumentProperty("Status", "true", false);
DocumentProperty property6 = new DocumentProperty("Company", "e-iceblue", true);
DocumentProperty property7 = new DocumentProperty("作者", "冰蓝", false);
properties.setList(new ArrayList());
properties.getList().add(property);
properties.getList().add(property2);
properties.getList().add(property3);
properties.getList().add(property4);
properties.getList().add(property5);
properties.getList().add(property6);
properties.getList().add(property7);
DocumentProperties response = propertiesApi.setDocumentProperties(name, properties, password, folder, storage);
}
}
接口方法2:getDocumentProperties()获取文档属性
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel/{name}/documentproperties
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
password | 否 | string | 原文档密码,没有则为null | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.*;
import spire.cloud.excel.sdk.api.PropertiesApi;
import spire.cloud.excel.sdk.model.*;
public class getDocumentProperties {
static String appId = "your id";
static String appKey = "your key";
static String baseUrl = "https://api.e-iceblue.cn";
static Configuration configuration = new Configuration(appId, appKey, baseUrl);
static PropertiesApi propertiesApi = new PropertiesApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetDocumentProperties.xlsx";
String password = null;
String folder = "input";
String storage = null;
DocumentProperties response = propertiesApi.getDocumentProperties(name, password, folder, storage);
}
}
接口方法3:deleteDocumentProperties()删除文档中已有的属性
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel/{name}/documentproperties
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
password | 否 | string | 原文档密码,没有则为null | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.*;
import spire.cloud.excel.sdk.api.PropertiesApi;
import spire.cloud.excel.sdk.model.*;
public class deleteDocumentProperties {
static String appId = "your id";
static String appKey = "your key";
static String baseUrl = "https://api.e-iceblue.cn";
static Configuration configuration = new Configuration(appId, appKey, baseUrl);
static PropertiesApi propertiesApi = new PropertiesApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "DeleteDocumentProperties.xlsx";
String password = null;
String folder = "input";
String storage = null;
DocumentProperties response = propertiesApi.deleteDocumentProperties(name, password, folder, storage);
}
}
接口方法4: setDocumentProperty()设置文档属性
HTTP 请求方法:PUT
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/documentproperties/{propertyName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
propertyName | 是 | string | 设置属性名称 | |
property | 否 | object | { "SelfUri": { "Relation": "Relation", "Href": "Href", "Title": "Title", "LinkType": "LinkType" }, "Name": "string", "Value": "string", "BuiltIn": true } | 给属性赋值 |
password | 否 | string | 原文档密码,没有则为null | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.*;
import spire.cloud.excel.sdk.api.PropertiesApi;
import spire.cloud.excel.sdk.model.*;
public class setDocumentProperty {
static String appId = "your id";
static String appKey = "your key";
static String baseUrl = "https://api.e-iceblue.cn";
static Configuration configuration = new Configuration(appId, appKey, baseUrl);
static PropertiesApi propertiesApi = new PropertiesApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "SetDocumentProperty.xlsx";
String password = null;
String folder = "input";
String storage = null;
String propertyName = "Keywords";
DocumentProperty property = new DocumentProperty("Keywords", "SetDocumentProperty_xlsx", true);
DocumentProperty response = propertiesApi.setDocumentProperty(name, propertyName, property, password, folder, storage);
}
}
接口方法5: getDocumentProperty()获取文档属性
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/documentproperties/{propertyName}
请求参数:
Java代码示例:
import spire.cloud.excel.sdk.*;
import spire.cloud.excel.sdk.api.PropertiesApi;
import spire.cloud.excel.sdk.model.*;
public class getDocumentProperty {
static String appId = "your id";
static String appKey = "your key";
static String baseUrl = "https://api.e-iceblue.cn";
static Configuration configuration = new Configuration(appId, appKey, baseUrl);
static PropertiesApi propertiesApi = new PropertiesApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetDocumentProperty.xlsx";
String propertyName = "Title";
String password = null;
String folder = "input";
String storage = null;
DocumentProperty response = propertiesApi.getDocumentProperty(name, propertyName, password, folder, storage);
}
}
接口方法6:deleteDocumentProperty()删除文档属性
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/documentproperties/{propertyName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
propertyName | 是 | string | 指定属性名称 | |
password | 否 | string | 原文档密码,没有则为null | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.*;
import spire.cloud.excel.sdk.api.PropertiesApi;
import spire.cloud.excel.sdk.model.*;
public class deleteDocumentProperty {
static String appId = "your id";
static String appKey = "your key";
static String baseUrl = "https://api.e-iceblue.cn";
static Configuration configuration = new Configuration(appId, appKey, baseUrl);
static PropertiesApi propertiesApi = new PropertiesApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "DeleteDocumentProperty.xlsx";
String password = null;
String folder = "input";
String storage = null;
String propertyName = "Title";
DocumentProperties response = propertiesApi.deleteDocumentProperty(name, propertyName, password, folder, storage);
}
}