操作Excel工作表。包括添加/删除,移动,复制,重命名,获取,保护/取消保护工作表;添加/删除,更新,获取工作表中的批注;搜索,替换工作表中的文本;添加/删除背景图片;自适应行高/列宽;冻结/取消冻结行和列;计算工作表中的公式值等。
接口方法1:getWorkSheets()获取工作表
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.*;
public class getWorkSheets {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetWorkSheets.xlsx";
String folder = "input";
String storage = null;
Worksheets response = WorksheetsApi.getWorkSheets(name, folder, storage);
}
}
接口方法2:getWorkSheetWithFormat() 以指定格式获取工作表
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/convert/{format}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
format | 是 | string | 输出格式 | |
verticalResolution | 否 | integer($int32) | 图片垂直分辨率 | |
horizontalResolution | 否 | integer($int32) | 图片水平分辨率 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class getWorkSheetWithFormat {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetWorkSheetWithFormat.xlsx";
String sheetName = "Sheet2";
String format = "html";//Supported formats:html, pdf, png, jpeg, bmp, emf, tiff
Integer verticalResolution = null;
Integer horizontalResolution = null;
String folder = "input";
String storage = null;
WorksheetsApi.getWorkSheetWithFormat(name, sheetName, format, verticalResolution, horizontalResolution, folder, storage);
}
}
接口方法3:changeVisibilityWorksheet()设置工作表是否可见
HTTP 请求方法:PUT
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/visible
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
isVisible | 是 | boolean | 设置指定工作表是否可见 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class changeVisibilityWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "ChangeVisibilityWorksheet.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
boolean isVisible = true;
WorksheetsApi.changeVisibilityWorksheet(name, sheetName, isVisible, folder, storage);
}
}
接口方法4:insertNewWorksheet()添加新的工作表
HTTP 请求方法:PUT
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/insert
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
newsheetname | 是 | string | 设置新工作表名称 | |
index | 是 | integer($int32) | 指定添加新工作表的索引 | |
sheettype | 是 | string | 设置工作表的类型 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class insertNewWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "InsertNewWorksheet.xlsx";
String folder = "input";
String storage = null;
String sheetType = "NormalWorksheet";//Available value: NormalWorksheet, ChartSheet
int index = 2;
String newSheetName = "SheetInsert";
WorksheetsApi.insertNewWorksheet(name, newSheetName, index, sheetType, folder, storage);
}
}
接口方法5:moveWorksheet()移动工作表
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/position
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
moving | 是 | object | { "Position": "Position", "DestinationWorksheet": "DestinationWorksheet" } | 设置目标工作表名称及位置 |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.WorksheetMovingRequest;
public class moveWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "MoveWorksheet_After.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
WorksheetMovingRequest moving = new WorksheetMovingRequest();
moving.setDestinationWorksheet("sheet4");
moving.setPosition("after");
WorksheetsApi.moveWorksheet(name, sheetName, moving, folder, storage);
}
}
接口方法6:protectWorksheet()保护工作表
HTTP 请求方法:PUT
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/protection
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
protectParameter | 是 | object | { "AllowFormattingCell": "AllowFormattingCell", "AllowSelectingUnlockedCell": "AllowSelectingUnlockedCell", "AllowInsertingHyperlink": "AllowInsertingHyperlink", "ProtectionType": "ProtectionType", "AllowInsertingRow": "AllowInsertingRow", "AllowEditArea": [ "AllowEditArea", "AllowEditArea" ], "AllowFormattingRow": "AllowFormattingRow", "AllowUsingPivotTable": "AllowUsingPivotTable", "AllowSorting": "AllowSorting", "AllowDeletingRow": "AllowDeletingRow", "AllowInsertingColumn": "AllowInsertingColumn", "AllowSelectingLockedCell": "AllowSelectingLockedCell", "AllowDeletingColumn": "AllowDeletingColumn", "AllowFormattingColumn": "AllowFormattingColumn", "AllowFiltering": "AllowFiltering", "Password": "Password" } | 进行保护类型及相关设置 |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.ProtectSheetParameter;
public class protectWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "ProtectWorksheet.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet3";
ProtectSheetParameter protectParameter = new ProtectSheetParameter();
protectParameter.setPassword("123");
protectParameter.setProtectionType("scenarios");
protectParameter.setAllowSelectingLockedCell("true");
protectParameter.setAllowDeletingColumn("true");
protectParameter.setAllowFormattingRow("true");
WorksheetsApi.protectWorksheet(name, sheetName, protectParameter, folder, storage);
}
}
接口方法7:unprotectWorksheet()取消保护工作表
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/position
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
protectParameter | 是 | object | { "AllowFormattingCell": "AllowFormattingCell", "AllowSelectingUnlockedCell": "AllowSelectingUnlockedCell", "AllowInsertingHyperlink": "AllowInsertingHyperlink", "ProtectionType": "ProtectionType", "AllowInsertingRow": "AllowInsertingRow", "AllowEditArea": [ "AllowEditArea", "AllowEditArea" ], "AllowFormattingRow": "AllowFormattingRow", "AllowUsingPivotTable": "AllowUsingPivotTable", "AllowSorting": "AllowSorting", "AllowDeletingRow": "AllowDeletingRow", "AllowInsertingColumn": "AllowInsertingColumn", "AllowSelectingLockedCell": "AllowSelectingLockedCell", "AllowDeletingColumn": "AllowDeletingColumn", "AllowFormattingColumn": "AllowFormattingColumn", "AllowFiltering": "AllowFiltering", "Password": "Password" } | 仅设置密码保护,取消其他保护方式 |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.ProtectSheetParameter;
public class unprotectWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "UnprotectWorksheet.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
ProtectSheetParameter protectParameter = new ProtectSheetParameter();
protectParameter.setPassword("123");
WorksheetsApi.unprotectWorksheet(name, sheetName, protectParameter, folder, storage);
}
}
接口方法8:getTextItems()获取工作表的文本信息
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/textItems
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class getTextItems {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetTextItems.xlsx";
String sheetName = "Sheet2";
String folder = "input";
String storage = null;
WorksheetsApi.getTextItems(name, sheetName, folder, storage);
}
}
接口方法9:getComments()获取工作表的批注信息
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/comments
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class getComments {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetComments.xlsx";
String sheetName = "Sheet2";
String folder = "input";
String storage = null;
WorksheetsApi.getComments(name, sheetName, folder, storage);
}
}
接口方法10:deleteComments()删除工作表中所有的批注
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/comments
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class deleteComments {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "DeleteComments.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet2";
WorksheetsApi.deleteComments(name, sheetName, folder, storage);
}
}
接口方法11:getComment()获取工作表中指定单元格的批注
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/comments/{cellName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
cellName | 是 | string | 指定单元格名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class getComment {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetComment.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet3";
String cellName = "E17";
WorksheetsApi.getComment(name, sheetName, cellName, folder, storage);
}
}
接口方法12:updateComment()更新工作表中指定单元格的批注
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/comments/{cellName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
cellName | 是 | string | 指定单元格名称 | |
comment | 是 | object | { "SelfUri": { "Relation": "Relation", "Href": "Href", "Title": "Title", "LinkType": "LinkType" }, "CellName": "string", "Author": "string", "HtmlNote": "string", "Note": "string", "AutoSize": true, "IsVisible": true, "Width": 0, "Height": 0, "TextHorizontalAlignment": "string", "TextOrientationType": "string", "TextVerticalAlignment": "string" } | 设置批注内容 |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.Comment;
public class updateComment {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "UpdateComment.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet3";
String cellName = "C6";
Comment comment = new Comment();
comment.setAuthor("jerry");
comment.setNote("Comment");
comment.setWidth(160);
comment.setHeight(30);
comment.setIsVisible(true);
comment.setTextHorizontalAlignment("center");
WorksheetsApi.updateComment(name, sheetName, cellName, comment, folder, storage);
}
}
接口方法13:addComment()给工作表中指定单元格添加批注
HTTP 请求方法:PUT
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/comments/{cellName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
cellName | 是 | string | 指定单元格名称 | |
comment | 是 | object | { "SelfUri": { "Relation": "Relation", "Href": "Href", "Title": "Title", "LinkType": "LinkType" }, "CellName": "string", "Author": "string", "HtmlNote": "string", "Note": "string", "AutoSize": true, "IsVisible": true, "Width": 0, "Height": 0, "TextHorizontalAlignment": "string", "TextOrientationType": "string", "TextVerticalAlignment": "string" } | 设置批注内容 |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.Comment;
public class addComment {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "AddComment.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet3";
String cellName = "C2:D4";
Comment comment = new Comment();
comment.setAuthor("jerry");
comment.setNote("hello");
comment.setAutoSize(true);
comment.setTextOrientationType("CounterClockwise");
comment.setTextVerticalAlignment("Bottom");
comment.setIsVisible(true);
WorksheetsApi.addComment(name, sheetName, cellName, comment, folder, storage);
}
}
接口方法14:deleteComment()删除指定单元格中的批注
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/comments/{cellName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
cellName | 是 | string | 指定单元格名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class deleteComment {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "DeleteComment.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet2";
String cellName = "B5";
WorksheetsApi.deleteComment(name, sheetName, cellName, folder, storage);
}
}
接口方法15:getMergedCells()获取所有合并单元格的信息
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/mergedCells
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class getMergedCells {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetMergedCells.xlsx";
String sheetName = "Sheet5";
String folder = "input";
String storage = null;
WorksheetsApi.getMergedCells(name, sheetName, folder, storage);
}
}
接口方法16:getMergedCell()通过索引获取指定合并单元格的信息
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/mergedCells/{mergedCellIndex}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
mergedCellIndex | 是 | integer($int32) | 指定合并单元格的索引 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class getMergedCell {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetMergedCell.xlsx";
String sheetName = "Sheet5";
int mergedCellIndex = 0;
String folder = "input";
String storage = null;
WorksheetsApi.getMergedCell(name, sheetName, mergedCellIndex, folder, storage);
}
}
接口方法17:calculateFormula() 计算工作表中的公式值
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/formulaResult
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
formula | 是 | string | 设置公式 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class calculateFormula {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetCalculateFormula.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet4";
String formula = "=SUM(D8:D9)";
WorksheetsApi.calculateFormula(name, sheetName, formula, folder, storage);
}
}
接口方法18:searchText()在工作表中查找文本
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/findText
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
text | 是 | string | 指定搜索的文本内容 | |
matchCase | 否 | boolean | 判断是否有相符的文本,true或false | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class searchText {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "SearchText.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet4";
String text = "America";
boolean matchCase = false;
WorksheetsApi.searchText(name, sheetName, text, matchCase, folder, storage);
}
}
接口方法19:replaceText()替换工作表中的文本
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/replaceText
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
oldValue | 是 | string | 工作表中已有的文本 | |
newValue | 是 | string | 新文本 | |
matchCase | 否 | boolean | 判断是否有相符的文本,true或false | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class replaceText {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "ReplaceText.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet4";
String oldValue = "North America";
String newValue = "replace";
boolean matchCase = true;
WorksheetsApi.replaceText(name, sheetName, oldValue,newValue,matchCase,
folder,storage);
}
}
接口方法20:sortRange() 对指定单元格范围中的数据进行排序
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/sort
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
cellArea | 是 | string | 指定单元格范围 | |
dataSorter | 是 | object | { "HasHeaders": true, "KeyList": [ { "CustomList": "CustomList", "SortOrder": "SortOrder", "Key": 0 }, { "CustomList": "CustomList", "SortOrder": "SortOrder", "Key": 0 } ], "SortLeftToRight": true, "CaseSensitive": true } | 排序设置 |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.DataSorter;
import spire.cloud.excel.sdk.model.SortKey;
import java.util.ArrayList;
public class sortRange {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "SortRange.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet4";
String cellArea = "A1:G10";
DataSorter dataSorter = new DataSorter();
dataSorter.caseSensitive(true);
dataSorter.hasHeaders(true);
dataSorter.sortLeftToRight(false);
ArrayList<SortKey> KeyList = new ArrayList<SortKey>();
KeyList.add(new SortKey(0, "Ascending", "Values"));
KeyList.add(new SortKey(1, "Descending", "Values"));
dataSorter.setKeyList(KeyList);
WorksheetsApi.sortRange(name, sheetName, cellArea, dataSorter, folder, storage);
}
}
接口方法21:autofitRow()设置Excel自适应行高
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/autofitrow
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
rowIndex | 是 | integer($int32) | 指定行的索引 | |
firstColumn | 是 | integer($int32) | 起始列 | |
lastColumn | 是 | integer($int32) | 末列 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class autofitRow {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "AutofitRow.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
int rowIndex = 1;//Data range: 1~1048576
int firstColumn = 1;
int lastColumn = 1;
WorksheetsApi.autofitRow(name, sheetName, rowIndex, firstColumn, lastColumn, folder, storage);
}
}
接口方法22:autofitRows()设置Excel自适应行高
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/autofitrows
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
startRow | 是 | integer($int32) | 起始行 | |
endRow | 是 | integer($int32) | 末行 | |
onlyAuto | 否 | boolean | 判断是否仅为自适当,默认为false | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class autofitRows {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "AutofitRows.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
int startRow = 5;
int endRow = 10;
boolean onlyAuto = true;//Default value is false. Other values are "false" and "null"
WorksheetsApi.autofitRows(name, sheetName, startRow, endRow, onlyAuto, folder, storage);
}
}
接口方法23:autofitColumns()设置Excel自适应列宽
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/autofitcolumns
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
firstColumn | 是 | integer($int32) | 起始列 | |
lastColumn | 是 | integer($int32) | 末列 | |
autoFitterOptions | 是 | object | { "AutoFitMergedCellsType": "AutoFitMergedCellsType", "OnlyAuto": true, "IgnoreHidden": true, "AutoFitMergedCells": true } | 自适应设置 |
firstRow | 否 | integer($int32) | 起始行 | |
lastRow | 否 | integer($int32) | 末行 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.AutoFitterOptions;
public class autofitColumns {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "AutofitColumns.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
int firstColumn = 1;
int lastColumn = 5;
AutoFitterOptions autoFitterOptions = new AutoFitterOptions(null, true, true, true);
int firstRow = 3;
int lastRow = 10;
WorksheetsApi.autofitColumns(name, sheetName, firstColumn, lastColumn, autoFitterOptions, firstRow, lastRow, folder, storage);
}
}
接口方法24:setBackground()设置Excel工作表的背景图片
HTTP 请求方法:PUT
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/background
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
picPath | 是 | string | 指定图片路径 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class setBackground {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "SetBackground.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
String picPath = "input/SpireXls.png";
WorksheetsApi.setBackground(name,sheetName,picPath,folder,storage);
}
}
接口方法25:deleteBackground()删除Excel工作表中的背景图片
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/background
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class deleteBackground {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "DeleteBackground.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet1";
WorksheetsApi.deleteBackground(name, sheetName, folder, storage);
}
}
接口方法26:setFreezePanes()冻结Excel中的行和列
HTTP 请求方法:PUT
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/freezepanes
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
freezedRows | 是 | integer($int32) | 指定冻结的行 | |
freezedColumns | 是 | integer($int32) | 指定冻结的列 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class setFreezePanes {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "SetFreezePanes.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet2";
int freezedRows = 3;
int freezedColumns = 3;
WorksheetsApi.setFreezePanes(name, sheetName, freezedRows, freezedColumns, folder, storage);
}
}
接口方法27:deleteFreezePanes()取消冻结Excel中的行和列
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/freezepanes
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class deleteFreezePanes {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "DeleteFreezePanes.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet5";
WorksheetsApi.deleteFreezePanes(name, sheetName, folder, storage);
}
}
接口方法28:copyWorksheet()复制工作表
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/copy
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 目标Excel工作簿名称 | |
sheetName | 是 | string | 目标工作表名称 | |
sourceSheet | 是 | string | 源工作表名称 | |
sourceWorkbook | 否 | string | 源Excel工作簿名称 | |
sourceFolder | 否 | string | 存放源文档的文件夹,没有则为null | |
folder | 否 | string | 存放目标文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class copyWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String Destination_name = "CopyWorksheet_destination.xlsx";
String sourceSheet = "Sheet1";
String sourceFolder = "input";
String sourceWorkbook = "CopyWorksheet_original.xlsx";
String folder = "output";
String storage = null;
String sheetName = "Sheet4";
WorksheetsApi.copyWorksheet(Destination_name, sheetName, sourceSheet, sourceWorkbook, sourceFolder, folder, storage);
}
}
接口方法29:renameWorksheet()重命名工作表的名称
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/rename
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表名称 | |
newname | 是 | string | 为工作表设置新名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class renameWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "RenameWorksheet.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet2";
String newName = "newSheetName";
WorksheetsApi.renameWorksheet(name, sheetName, newName, folder, storage);
}
}
接口方法30:getWorkSheets()获取工作表
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/ranges
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.Worksheets;
public class getWorkSheets {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetWorkSheets.xlsx";
String folder = "input";
String storage = null;
Worksheets response = WorksheetsApi.getWorkSheets(name, folder, storage);
}
}
接口方法31:getNamedRangeValue()获取指定工作表的值
HTTP 请求方法:GET
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/ranges/{namerange}/value
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
namerange | 是 | string | 指定工作表名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class getNamedRangeValue {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "GetNamedRangeValue.xlsx";
String nameRange = "Sheet1";
String folder = "input";
String storage = null;
WorksheetsApi.getNamedRangeValue(name, nameRange, folder, storage);
}
}
接口方法32:updateWorksheetZoom()更新工作表的缩放值
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}/zoom
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表的名称 | |
value | 是 | integer($int32) | 设置缩放值 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class updateWorksheetZoom {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "UpdateWorksheetZoom.xlsx";
String sheetName = "Sheet2";
int value = 150;
String folder = "Worksheets/Zoom";
String storage = null;
WorksheetsApi.updateWorksheetZoom(name, sheetName, value, folder, storage);
}
}
接口方法33:updateWorksheetProperty()更新工作表的属性
HTTP 请求方法:POST
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表的名称 | |
sheet | 是 | object | { "Pictures": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "TransitionEntry": true, "FirstVisibleColumn": 0, "OleObjects": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "IsRowColumnHeadersVisible": true, "Charts": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "Index": 1, "IsSelected": true, "MergedCells": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "DisplayZeros": true, "Name": "Name", "TabColor": { "A": 0, "R": 6, "B": 5, "G": 1 }, "Validations": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "FirstVisibleRow": 6, "IsGridlinesVisible": true, "IsRulerVisible": true, "TransitionEvaluation": true, "Zoom": 5, "IsPageBreakPreview": true, "IsOutlineShown": true, "IsProtected": true, "Comments": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "Hyperlinks": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "Cells": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "DisplayRightToLeft": true, "Type": "Type", "AutoShapes": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "VisibilityType": "VisibilityType", "ConditionalFormattings": { "link": { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } }, "Links": [ { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" }, { "Type": "Type", "Rel": "Rel", "Href": "Href", "Title": "Title" } ], "IsVisible": true, "ViewType": "ViewType" } | 设置工作表的属性 |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
import spire.cloud.excel.sdk.model.Color;
import spire.cloud.excel.sdk.model.Worksheet;
public class updateWorksheetProperty {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "UpdateWorksheetProperty.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet2";
Worksheet sheet = new Worksheet();
sheet.zoom(50);
sheet.index(3);
sheet.isGridlinesVisible(false);//Default value is "true".
sheet.tabColor( new Color(255, 255, 0, 0));
sheet.isProtected(true);
sheet.isSelected(true);
WorksheetsApi.updateWorksheetProperty(name, sheetName, sheet, folder, storage);
}
}
接口方法34:deleteWorksheet()删除指定的工作表
HTTP 请求方法:DELETE
请求URL:https://api.e-iceblue.cn/v1/excel /{name}/worksheets/{sheetName}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 文档名称 | |
sheetName | 是 | string | 指定工作表的名称 | |
folder | 否 | string | 存放文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null |
Java代码示例:
import spire.cloud.excel.sdk.ApiException;
import spire.cloud.excel.sdk.Configuration;
import spire.cloud.excel.sdk.api.WorksheetsApi;
public class deleteWorksheet {
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 WorksheetsApi WorksheetsApi = new WorksheetsApi(configuration);
public static void main(String[] args) throws ApiException {
String name = "DeleteWorksheet.xlsx";
String folder = "input";
String storage = null;
String sheetName = "Sheet2";
WorksheetsApi.deleteWorksheet(name, sheetName, folder, storage);
}
}