替换 Excel 工作表中的文本 — Aspose.Cells Cloud API
Contents
[
Hide
]
此 REST API 使用 Aspose.Cells 文本替换 API 替换 Excel 工作表中的文本。
安全与身份验证
Aspose.Cells Cloud API 采用安全机制,需使用 基于 JWT 令牌的身份验证。
REST API
POST https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/replaceText
请求参数
| 参数名 | 类型 | 位置 | 描述 |
|---|---|---|---|
| name | string | path | Excel 工作簿的名称。 |
| sheetName | string | path | 工作表的名称。 |
| oldValue | string | query | 待替换的文本。 |
| newValue | string | query | 替换用的新文本。 |
| folder | string | query | 文件所在的文件夹。 |
| storageName | string | query | 存储服务的名称。 |
响应
{
"Status":"OK",
"Code":200,
"Workbook": {
"FileName": "test.xlsx",
"Links": [
{
"Href": "/test.xlsx",
"Rel": "self",
"Title": null,
"Type": null
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 CSV",
"Type": "text/csv"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 HTML",
"Type": "text/html"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 ODS",
"Type": "application/vnd.oasis.opendocument.spreadsheet"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 PDF",
"Type": "application/pdf"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为表格分隔文本格式",
"Type": "text/plain"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 TIFF",
"Type": "image/tiff"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 Microsoft Excel 2003",
"Type": "application/vnd.ms-excel"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 Microsoft Excel 2007",
"Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
},
{
"Href": "/test.xlsx",
"Rel": "alternate",
"Title": "下载为 XPS",
"Type": "application/vnd.ms-xpsdocument"
}
],
"Worksheets": {
"link": {
"Href": "/worksheets",
"Rel": "self",
"Title": null,
"Type": null
}
},
"DefaultStyle": {
"link": {
"Href": "/defaultstyle",
"Rel": "self",
"Title": null,
"Type": null
}
},
"DocumentProperties": {
"link": {
"Href": "/documentproperties",
"Rel": "self",
"Title": null,
"Type": null
}
},
"Names": {
"link": {
"Href": "/names",
"Rel": "self",
"Title": null,
"Type": null
}
},
"Settings": {
"link": {
"Href": "/settings",
"Rel": "self",
"Title": null,
"Type": null
}
},
"IsWriteProtected": "False",
"IsProtected": "False",
"IsEncryption": "false",
"Password": null
}
}
HTTP 状态码
| 状态码 | 含义 | 描述 |
|---|---|---|
| 200 | OK(成功) | 替换操作成功;响应中包含操作详情。 |
| 400 | Bad Request(错误请求) | 参数缺失或无效(例如,不支持的文件类型)。 |
| 401 | Unauthorized(未授权) | JWT 令牌无效或缺失。 |
| 413 | Payload Too Large(请求体过大) | 上传文件超过大小限制。 |
| 500 | Internal Server Error(服务器内部错误) | 服务器发生意外错误。 |
如何使用 SDK 调用 PostWorksheetTextReplace API
PostWorksheetTextReplace API 规范
OpenAPI 规范 定义了此公开可访问的接口。
您可使用 cURL 命令行工具调用该服务:
使用 Aspose.Cells Cloud SDK
使用 SDK 是加速开发的最佳方式。SDK 负责处理底层细节,让您专注于项目核心任务。请查阅 GitHub 仓库,了解 Aspose.Cells Cloud SDK 的完整列表。
以下代码示例展示了如何使用多种 SDK 调用 Aspose.Cells Web 服务: