0
這工作正常,直到我將它添加到一個循環中。我認爲這是因爲我添加了兩次樣式。Excel.Style:樣式類的添加方法失敗
我想添加樣式到工作表的第一行。
if (LastRowInsertionIndex==1)
{
xlWorkSheet.Activate();
xlWorkSheet.Cells[1, 1] = "CaseNumber";
xlWorkSheet.Cells[1, 2] = "Names";
xlWorkSheet.Cells[1, 3] = "Bar Number";
xlWorkSheet.Cells[1, 4] = "Email";
xlWorkSheet.Cells[1, 5] = "Title";
Excel.Style style = WorkBook.Styles.Add("NewStyle");
//style.Font.Name = "Verdana";
style.Font.Size = 14;
style.Font.Bold = true;
xlWorkSheet.Cells[1, 1].Style = style;
}
Excel.Style style = WorkBook.Styles.Add("NewStyle");
導致錯誤;
Add method of Styles class failed
而我必須在第一列中選擇每個單元格1。有沒有辦法選擇所有行。