【发布时间】:2016-08-08 15:08:03
【问题描述】:
我正在编写 C# 代码以将数据导入 Smartsheet。我想留下一个虚拟行作为第一行,并在其下方添加所有后续行。我在文档中找不到执行此操作的语法。 AddRows 方法似乎没有任何方法可以确定这一点。这是我的代码:
Cell[] cellsA = new Cell[]
{
new Cell.AddCellBuilder(sheet.Columns[1].Id, taskData[i][1]).Build() //summary
,new Cell.AddCellBuilder(sheet.Columns[2].Id, taskData[i][2]).SetStrict(false).Build() //StartDate
,new Cell.AddCellBuilder(sheet.Columns[3].Id, taskData[i][3]).SetStrict(false).Build() //DueDate
,new Cell.AddCellBuilder(sheet.Columns[5].Id, taskData[i][4]).Build() //Estimated Hrs.
,new Cell.AddCellBuilder(sheet.Columns[6].Id, taskData[i][5]).Build() //Completion
,new Cell.AddCellBuilder(sheet.Columns[7].Id, taskData[i][6]).Build() //OWner
,new Cell.AddCellBuilder(sheet.Columns[8].Id, taskData[i][7]).Build() //Priority
,new Cell.AddCellBuilder(sheet.Columns[9].Id, taskData[i][8]).Build() //Status
,new Cell.AddCellBuilder(sheet.Columns[10].Id, taskData[i][9]).Build() //Category
,new Cell.AddCellBuilder(sheet.Columns[11].Id, screenURL + taskData[i][0]).Build()
};
// Specify contents of first row.
Row rowA = new Row.AddRowBuilder(true, null, null, null, null).SetCells(cellsA).Build();
// Add rows to sheet.
smartsheet.SheetResources.RowResources.AddRows(SheetID, new Row[] { rowA });
【问题讨论】: