替换 Excel 工作簿中的文本

此 REST API 用于替换 Excel 工作簿中的文本。

REST API

POST http://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/replaceText

安全与认证

Aspose.Cells Cloud API 是安全的,需要基于 JWT 令牌的认证

请求参数

参数名称 类型 位置 描述
name string path 工作簿文件的名称。
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 调用 PostReplace API

PostReplace API 规范

OpenAPI 规范定义了一个公开可访问的编程接口,允许您直接从 Web 浏览器执行 REST 交互。

您可使用 cURL 命令行工具轻松调用 Aspose.Cells Web 服务。下面的示例展示了如何使用 cURL 发起请求。

使用 Aspose.Cells Cloud SDK

使用 SDK 是集成此功能最快的方式。SDK 处理底层细节,让您专注于业务逻辑。完整的 Aspose.Cells Cloud SDK 列表请参见 GitHub 仓库

以下代码示例演示了如何使用多种 SDK 调用 Aspose.Cells Web 服务: