【发布时间】:2020-04-29 02:54:34
【问题描述】:
我使用 Google 文档尝试使用 DeleteTableRowRequest 删除表中的某些行,但我遇到了指定 TableStartLocation 属性的异常。我的代码如下:
public static void DeleteRequestGDocs(List<Request> requestsList, int? index2Del)
{
Request request = new Request();
Location tableLocation = new Location();
tableLocation.SegmentId = string.Empty;
tableLocation.Index = 11;
TableCellLocation tableCellLocationDel = new TableCellLocation();
tableCellLocationDel.RowIndex = index2Del;
tableCellLocationDel.ColumnIndex = 0;
tableCellLocationDel.TableStartLocation = tableLocation;
DeleteTableRowRequest delRequest = new DeleteTableRowRequest();
delRequest.TableCellLocation = tableCellLocationDel;
request.DeleteTableRow = delRequest;
requestsList.Add(request);
}
请帮帮我
更新1:程序执行时删除。我遇到了错误“无效的请求 [0].deleteTableRow:无效的表起始位置。必须指定表的起始索引。”下面是代码
var bodyDelete = new BatchUpdateDocumentRequest();
bodyDelete.Requests = requestsDeleteList;
var batchDeleteRequest = docsService.Documents.BatchUpdate(bodyDelete, mergedFile.Id);
var resultDelete = await batchDeleteRequest.ExecuteAsync();
【问题讨论】:
-
异常说明了什么?
-
异常说“Invalid requests[0].deleteTableRow: Invalid table start location.必须指定表的开始索引。”
-
你好@MouseOnMars,请帮帮我!
标签: c# api documentation delete-row