从工作表中获取图表区域 - Aspose.Cells Cloud API

此 REST API 用于返回图表区域信息。

前置条件: 要调用此接口,您必须拥有有效的 JWT 访问令牌;目标工作簿需已上传至 Aspose Cloud 存储空间;且文件格式必须为 Aspose.Cells 所支持的格式。

背景说明: 图表区域定义了 Excel 图表的最外层边界框,包括标题、图例和绘图区域。获取其属性可让您以编程方式调整布局和样式。

GetChartArea API

GET https://api.aspose.cloud/v3.0/cells/{name}/worksheets/{sheetName}/charts/{chartIndex}/chartArea

安全与身份验证

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

请求参数

参数名称 类型 位置 描述
name string path 工作簿文件的名称。
sheetName string path 包含图表的工作表名称。
chartIndex integer path 图表的从零开始的索引。
folder string query 工作簿所在的文件夹。
storageName string query 存储服务的名称。

响应

{
  "ChartArea": {
    "Area": {
      "BackgroundColor": { "A": "0", "R": "0", "G": "0", "B": "0" },
      "FillFormat": { "Type": "Automatic" },
      "ForegroundColor": { "A": "0", "R": "0", "G": "0", "B": "0" },
      "Formatting": "Automatic",
      "InvertIfNegative": false,
      "Transparency": 0.0
    },
    "AutoScaleFont": false,
    "BackgroundMode": "Automatic",
    "Border": {
      "BeginArrowLength": "Medium",
      "BeginArrowWidth": "Medium",
      "BeginType": "None",
      "CapType": "Flat",
      "Color": { "A": "0", "R": "0", "G": "0", "B": "0" },
      "CompoundType": "Single",
      "DashType": "Solid",
      "EndArrowLength": "Medium",
      "EndArrowWidth": "Medium",
      "EndType": "None",
      "IsAuto": false,
      "IsAutomaticColor": false,
      "IsVisible": false,
      "JoinType": "Round",
      "Style": "Solid",
      "Transparency": 0.0,
      "Weight": "HairLine",
      "WeightPt": 0.0
    },
    "Font": {
      "Color": { "A": "255", "R": "0", "G": "0", "B": "0" },
      "DoubleSize": 10.0,
      "IsBold": false,
      "IsItalic": false,
      "IsStrikeout": false,
      "IsSubscript": false,
      "IsSuperscript": false,
      "Name": "Arial",
      "Size": 10,
      "Underline": "None"
    },
    "IsAutomaticSize": false,
    "IsInnerMode": false,
    "Shadow": false,
    "Width": 0,
    "Height": 0,
    "X": 0,
    "Y": 0,
    "link": {
      "Href": "https://api.aspose.cloud/v3.0/cells/Sample_Test_Book.xls/worksheets/Sheet5/charts/0/chartArea",
      "Rel": "self"
    }
  },
  "Code": "200",
  "Status": "OK"
}

HTTP 状态码

状态码 含义 描述
200 OK(成功) 筛选器应用成功;响应包含操作详情。
400 Bad Request(错误请求) 缺失或无效的参数(例如,不支持的文件类型)。
401 Unauthorized(未授权) 无效或缺失的 JWT 令牌。
413 Payload Too Large(负载过大) 上传的文件超出大小限制。
500 Internal Server Error(内部服务器错误) 意外的服务器错误。

如何结合 SDK 使用 GetChartArea API

GetChartArea API 规范

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

您可以使用 cURL 命令行工具轻松访问 Aspose.Cells Web 服务。以下示例展示了如何使用 cURL 调用 Cloud API。

使用 Aspose.Cells Cloud SDK

使用 SDK 是加快开发速度的最佳方式。SDK 负责处理底层细节,让您专注于项目任务。请查阅 GitHub 仓库,获取 Aspose.Cells Cloud SDK 的完整列表。

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

通用 HTTP 请求示例(例如,使用 fetch):

fetch('https://api.aspose.cloud/v3.0/cells/Sample_Test_Book.xls/worksheets/Sheet5/charts/0/chartArea', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer <jwt token>'
  }
})
  .then(response => response.json())
  .then(data => console.log(data));