操作 Word 文档中的表格,包括添加表格,删除表格,对表格进行格式化等操作。
接口方法 1:getTables() 获取表格
HTTP 请求方法:GET
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/tables
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
password | 否 | string | 原文档密码,没有则为null | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
nodePath | 否 | string | 指定包含表格的容器路径 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace GetTables
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "tableSample.docx";
string folder = "input";
string storage = null;
string password = null;
string nodePath = "Section/0/Body/0";
var response = tablesApi.GetTables(name, folder, storage, password, nodePath);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.*;
import java.math.BigDecimal;
import java.util.List;
public class getTables(){
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "Template.docx";
String folder = "input";
String storage = null;
String password = null;
String nodePath = "Section/0/Body/0";
List<ObjectInfo> response = tablesApi.getTables(name, folder, storage, password, nodePath);
}
}
接口方法 2:addTable() 添加表格
HTTP 请求方法:POST
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{nodePath}/tables
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
nodePath | 否 | string | 包含表格的路径 | |
indexOfTable | 否 | integer | 段落中表格索引 | |
password | 否 | string | 原文档密码,没有则为null | |
rowsCount | 是 | integer | 表格行数 | |
columnsCount | 是 | integer | 表格列数 | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace AddTable
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "tableSample.docx";
string nodePath = "Section/0/Body/0";
int indexOfTable = 0;
int rowsCount = 6;
int columnsCount = 6;
string folder = "input";
string storage = null;
string password = null;
string destFilePath = "output/AddTable_output.docx";
tablesApi.AddTable(name, nodePath, rowsCount, columnsCount, destFilePath, folder, storage, indexOfTable, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.*;
public class getTables(){
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "tableSample.docx";
String nodePath = "Section/0/Body/0";
int indexOfTable = 0;
Integer rowsCount = 6;
Integer columnsCount = 6;
String folder = "input";
String storage = null;
String password = null;
String destFilePath = "output/AddTable_output.docx" ;
tablesApi.addTable(name, nodePath, rowsCount, columnsCount, destFilePath, folder, storage, indexOfTable, password);
}
}
接口方法 3:deleteTable() 删除表格
HTTP 请求方法:DELETE
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{nodePath}/tables/{index}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
password | 否 | string | 原文档密码,没有则为null | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
nodePath | 否 | string | 包含表格的路径 | |
index | 是 | integer | 表格索引 | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace DeleteTable
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "deleteTable.docx";
string nodePath = "Section/0/Body/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
string destFilePath = "output/DeleteTable_output.docx";
tablesApi.DeleteTable(name, nodePath, index, destFilePath, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.*;
public class deleteTables(){
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "deleteTable.docx";
String nodePath = "Section/0/Body/0";
int index = 0;
String folder = "input";
String storage = null;
String password = null;
String destFilePath = "output/DeleteTable_output.docx" ;
tablesApi.deleteTable(name, nodePath, index, destFilePath, folder, storage, password);
}
}
接口方法 4:getTableFormat() 获取表格格式
HTTP 请求方法:GET
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{nodePath}/tables/{index}/format
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
nodePath | 否 | string | 指定包含表格的容器路径 | |
index | 是 | integer | 表格索引 | |
password | 否 | string | 原文档密码,没有则为null |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace GetTableFormat
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "getTableFormat.docx";
string nodePath = "Section/0/Body/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
var response = tablesApi.GetTableFormat(name, nodePath, index, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.*;
public class GetTableFormat {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "getTableFormat.docx";
String nodePath = "Section/0/Body/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
TableFormat response = tablesApi.getTableFormat(name, nodePath, index, folder, storage, password);
}
}
接口方法 5:updateTableFormat() 更新表格格式
HTTP 请求方法:PUT
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{nodePath}/tables/{index}/format
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
nodePath | 否 | string | 指定包含表格的容器路径 | |
index | 是 | integer | 表格索引 | |
password | 否 | string | 原文档密码,没有则为null | |
format | 是 | object | { "bidi": true, "cellSpacing": 0, "borders": { "topBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "bottomBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "leftBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "rightBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "horizontalBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "verticalBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 } }, "padding": { "top": 0, "bottom": 0, "left": 0, "right": 0 }, "horizontalAlignment": "Left", "autoResized": true } | 表格的格式 |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
using Spire.Cloud.Word.Sdk.Model;
namespace UpdateTableFormat
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "updateTableFormat.docx";
string nodePath = "Section/0/Body/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
TableFormat tableFormat = new TableFormat
{
Bidi = false,
Borders = new Borders
{
TopBorder = new Border
{
BorderType = Border.BorderTypeEnum.Dot,
Color = new Color(255, 25, 1),
LineWidth = 3
}
}
};
string destFilePath = "output/UpdateTableFormat_output.docx";
tablesApi.UpdateTableFormat(name, nodePath, index, tableFormat, destFilePath, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.*;
public class UpdateTableFormat {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "updateTableFormat.docx";
String nodePath = "Section/0/Body/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
TableFormat tableFormat = new TableFormat();
tableFormat.setBidi(true);
Border border = new Border();
border.setBorderType(Border.BorderTypeEnum.DOT);
Color color = new Color(255, 25, 2);
border.setColor(color);
border.setLineWidth(3f);
Borders TopBorder = new Borders();
TableFormat format= tableFormat;
TopBorder.setTopBorder(border);
tableFormat.setBorders(TopBorder);
String destFilePath = "output/UpdateTableFormat_output.docx";
tablesApi.updateTableFormat(name, nodePath, index, format, destFilePath, folder, storage, password);
}
}
接口方法 6:getTableFormat() 获取表格的行并返回 List
HTTP 请求方法:GET
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{nodePath}/tables/{index}/rows
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
nodePath | 否 | string | 指定包含表格的容器路径 | |
index | 是 | integer | 表格索引 | |
password | 否 | string | 原文档密码,没有则为null |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace GetTableRows
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "tableSample.docx";
string nodePath = "Section/0/Body/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
var response = tablesApi.GetTableRows(name, nodePath, index, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.*;
import java.util.List;
public class GetTableRows {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "tableSample.docx";
String nodePath = "Section/0/Body/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
List<ObjectInfo> response = tablesApi.getTableRows(name, nodePath, index, folder, storage, password);
}
}
接口方法 7:addTableRow() 添加行
HTTP 请求方法:POST
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tablePath}/rows
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tablePath | 是 | string | 表格的路径 | |
indexOfTableRow | 否 | integer | 表格中要插入行的位置 | |
cellsCount | 否 | integer | 行中单元格的数量 | |
cellsCount | 否 | integer | 行中单元格的数量 | |
password | 否 | string | 原文档密码,没有则为null | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace AddTableRow
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "addTableRow.docx";
string tablePath = "Section/0/Body/0/Table/0";
int indexOfTableRow = 0;
string folder = "input";
string storage = null;
int cellsCount = 3;
string password = null;
string destFilePath = "output/AddTableRow_output.docx";
tablesApi.AddTableRow(name, tablePath, destFilePath, folder, storage, indexOfTableRow, cellsCount, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
public class AddParagraph {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "addTableRow.docx";
String tablePath = "Section/0/Body/0/Table/0";
int indexOfTableRow = 0;
String folder = "input";
String storage = null;
Integer cellsCount = 3;
String password = null;
String destFilePath = "output/AddTableRow_output.docx";
tablesApi.addTableRow(name, tablePath, destFilePath,folder, storage, indexOfTableRow, cellsCount, password);
}
}
接口方法 8:deleteTableRow() 删除行
HTTP 请求方法:DELETE
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tablePath}/rows/{index}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tablePath | 是 | string | 表格的路径 | |
index | 是 | integer | 要删除的行的索引 | |
password | 否 | string | 原文档密码,没有则为null | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace DeleteTableRow
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "deleteTableRow.docx";
string tablePath = "Section/0/Body/0/Table/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
string destFilePath = "output/DeleteTableRow_output.docx";
tablesApi.DeleteTableRow(name, tablePath, index, destFilePath, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
public class DeleteTableRow {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "deleteTableRow.docx";
String tablePath = "Section/0/Body/0/Table/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
String destFilePath = "output/DeleteTableRow_output.docx";
tablesApi.deleteTableRow(name, tablePath, index, destFilePath, folder, storage, password);
}
}
接口方法 9:getTableRowFormat() 获取行的格式
HTTP 请求方法:GET
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tablePath}/rows/{index}/format
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tablePath | 是 | string | 表格的路径 | |
index | 是 | integer | 行的索引 | |
password | 否 | string | 原文档密码,没有则为null |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace GetTableRowFormat
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "getTableRowFormat.docx";
string tablePath = "Section/0/Body/0/Table/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
var response = tablesApi.GetTableRowFormat(name, tablePath, index, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.TableRowFormat;
public class GetTableTowFormat {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "getTableRowFormat.docx";
String tablePath = "Section/0/Body/0/Table/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
TableRowFormat response = tablesApi.getTableRowFormat(name, tablePath, index, folder, storage, password);
}
}
接口方法 10:updateTableRowFormat() 获取行的格式
HTTP 请求方法:PUT
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tablePath}/rows/{index}/format
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tablePath | 是 | string | 表格的路径 | |
index | 是 | integer | 行的索引 | |
format | 是 | object | { "height": 0, "heightType": "AtLeast", "breakAcrossPages": true, "header": true } | 行的格式 |
password | 否 | string | 原文档密码,没有则为null |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
using Spire.Cloud.Word.Sdk.Model;
namespace UpdateTableRowFormat
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "updateTableRowFormat.docx";
string tablePath = "Section/0/Body/0/Table/0";
int index = 0;
TableRowFormat format = new TableRowFormat
{
Height = 100,
HeightType = TableRowFormat.HeightTypeEnum.Exactly,
BreakAcrossPages = true,
Header = true
};
string folder = "input";
string storage = null;
string password = null;
string destFilePath = "output/UpdateTableRowFormat_output.docx";
tablesApi.UpdateTableRowFormat(name, tablePath, index, format, destFilePath, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.TableRowFormat;
public class UpdateTableRowFormat {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "updateTableRowFormat.docx";
String tablePath = "Section/0/Body/0/Table/0";
Integer index = 0;
TableRowFormat rowFormat = new TableRowFormat();
rowFormat.setHeight(100f);
rowFormat.setHeightType(TableRowFormat.HeightTypeEnum.EXACTLY);
rowFormat.setBreakAcrossPages(true);
rowFormat.setHeader(true);
TableRowFormat format = rowFormat;
String folder = "input";
String storage = null;
String password = null;
String destFilePath = "output/UpdateTableRowFormat_output.docx";
tablesApi.updateTableRowFormat(name, tablePath, index, format, destFilePath,folder, storage, password);
}
}
接口方法 11:getTableCells() 获取单元格
HTTP 请求方法:GET
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tablePath}/rows/{index}/cells
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tablePath | 是 | string | 表格的路径 | |
index | 是 | integer | 行的索引 | |
password | 否 | string | 原文档密码,没有则为null |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace GetTableCells
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "tableSample.docx";
string tablePath = "Section/0/Body/0/Table/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
var response = tablesApi.GetTableCells(name, tablePath, index, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.ObjectInfo;
import java.util.List;
public class GetTableCells {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "tableSample.docx";
String tablePath = "Section/0/Body/0/Table/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
List<ObjectInfo> response = tablesApi.getTableCells(name, tablePath, index, folder, storage, password);
}
}
接口方法 12:addTableCell() 添加单元格
HTTP 请求方法:POST
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tableRowPath}/cells
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tableRowPath | 是 | string | 表格中行的路径 | |
indexOfTableCell | 否 | integer | 行中要插入单元格的索引 | |
password | 否 | string | 原文档密码,没有则为null | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace AddTableCell
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "addTableCell.docx";
string tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
int indexOfTableCell = 0;
string folder = "input";
string storage = null;
string password = null;
string destFilePath = "output/AddTableCell_output.docx";
tablesApi.AddTableCell(name, tableRowPath, destFilePath, folder, storage, indexOfTableCell, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
public class AddTableCell {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "addTableCell.docx";
String tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
int indexOfTableCell = 0;
String folder = "input";
String storage = null;
String password = null;
String destFilePath = "output/AddTableCell_output.docx";
tablesApi.addTableCell(name, tableRowPath, destFilePath, folder, storage, indexOfTableCell, password);
}
}
接口方法 13:deleteTableCell() 删除单元格
HTTP 请求方法:DELETE
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tableRowPath}/cells/{index}
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tablePath | 是 | string | 表格的路径 | |
tableRowPath | 是 | string | 表格中行的路径 | |
indexOfTableCell | 否 | integer | 行中要插入单元格的索引 | |
password | 否 | string | 原文档密码,没有则为null | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace DeleteTableCell
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "deleteTableCell.docx";
string tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
string destFilePath = "output/DeleteTableCell_output.docx";
tablesApi.DeleteTableCell(name, tableRowPath, index, destFilePath, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
public class DeleteTableCell {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "deleteTableCell.docx";
String tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
String destFilePath = "output/DeleteTableCell_output.docx";
tablesApi.deleteTableCell(name, tableRowPath, index, destFilePath, folder, storage, password);
}
}
接口方法 14:getTableCellFormat() 获取单元格格式
HTTP 请求方法:GET
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tableRowPath}/cells/{index}/format
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tableRowPath | 是 | string | 表格中行的路径 | |
index | 否 | integer | 单元格索引 | |
password | 否 | string | 原文档密码,没有则为null |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace GetTableCellFormat
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "getTableCellProperties.docx";
string tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
var response = tablesApi.GetTableCellFormat(name, tableRowPath, index, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.TableCellFormat;
public class GetTableCellFormat {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "getTableCellProperties.docx";
String tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
TableCellFormat response = tablesApi.getTableCellFormat(name, tableRowPath, index, folder, storage, password);
}
}
接口方法 15:updateTableCellFormat() 更新单元格格式
HTTP 请求方法:PUT
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tableRowPath}/cells/{index}/format
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tableRowPath | 是 | string | 表格中行的路径 | |
index | 否 | integer | 单元格索引 | |
format | 是 | object | { "width": 0, "textWrap": true, "fitText": true, "verticalAlignment": "Bottom", "backgroundColor": { "red": 0, "green": 0, "blue": 0 }, "borders": { "topBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "bottomBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "leftBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "rightBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "horizontalBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 }, "verticalBorder": { "borderType": "None", "color": { "red": 0, "green": 0, "blue": 0 }, "shadow": true, "lineWidth": 0, "space": 0 } }, "padding": { "top": 0, "bottom": 0, "left": 0, "right": 0 } } | 单元格格式 |
password | 否 | string | 原文档密码,没有则为null | |
destFilePath | 是 | string | 结果文档的存贮路径,如果省略该参数,则默认存到根目录 |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
using Spire.Cloud.Word.Sdk.Model;
namespace UpdateTableCellFormat
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "updateTableCellFormat.docx";
string tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
int index = 0;
string folder = "input";
string storage = null;
TableCellFormat format = new TableCellFormat
{
Width = 1000,
BackgroundColor = new Color(100, 100, 100)
};
string password = null;
string destFilePath = "output/UpdateTableCellFormat_output.docx";
tablesApi.UpdateTableCellFormat(name, tableRowPath, index, format, destFilePath, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.Color;
import spire.cloud.word.sdk.client.model.TableCellFormat;
import java.math.BigDecimal;
public class UpdateTableCellFormat {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "updateTableCellFormat.docx";
String tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
Integer index = 0;
String folder = "input";
String storage = null;
TableCellFormat cellFormat = new TableCellFormat();
cellFormat.setWidth(new BigDecimal(100));
Color color = new Color(100, 100, 100);
cellFormat.setBackgroundColor(color);
TableCellFormat format = cellFormat;
String password = null;
String destFilePath = "output/UpdateTableCellFormat_output.docx";
tablesApi.updateTableCellFormat(name, tableRowPath, index, format, destFilePath, folder, storage, password);
}
}
接口方法 16:getTableCellChildObjects() 获取单元格子对象
HTTP 请求方法:GET
请求 URL:https://api.e-iceblue.cn/v1/word/document/{name}/{tableRowPath}/cells/{index}/childObjects
请求参数:
参数 | 是否必选 | 类型 | 可选值范围 | 说明 |
name | 是 | string | 原文档名称 | |
folder | 否 | string | 存放原文档的文件夹,没有则为null | |
storage | 否 | string | 文档存储空间,使用冰蓝云配置的2G空间存贮文档,可设置为null | |
tableRowPath | 是 | string | 表格中行的路径 | |
index | 否 | integer | 单元格索引 | |
password | 否 | string | 原文档密码,没有则为null |
代码示例:
- .NET
- Java
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
namespace GetTableCellChildObjects
{
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
static void Main(string[] args)
{
string name = "tableSample.docx";
string tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
int index = 0;
string folder = "input";
string storage = null;
string password = null;
var response = tablesApi.GetTableCellChildObjects(name, tableRowPath, index, folder, storage, password);
}
}
}
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.TablesApi;
import spire.cloud.word.sdk.client.model.*;
import java.util.List;
public class GetTableCellChildObjects {
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 TablesApi tablesApi = new TablesApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
String name = "tableSample.docx" ;
String tableRowPath = "Section/0/Body/0/Table/0/TableRow/0";
Integer index = 0;
String folder = "input";
String storage = null;
String password = null;
List<ObjectInfo> response = tablesApi.getTableCellChildObjects(name, tableRowPath, index, folder, storage, password);
}
}