-1
我想從C#執行Excel'格式爲表格'選項。C# - 添加多個Excel格式表
這是成功的一個表,但是當我嘗試並添加多個表:
var range = _worksheet.get_Range("A1:C5");
_worksheet.ListObjects.AddEx(XlListObjectSourceType.xlSrcRange, range, misValue, Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes, misValue).Name = "MyTableStyle";
_worksheet.ListObjects.get_Item("MyTableStyle").TableStyle = "TableStyleLight9";
range = _worksheet.get_Range("A18:C23");
_worksheet.ListObjects.AddEx(XlListObjectSourceType.xlSrcRange, range, misValue, Microsoft.Office.Interop.Excel.XlYesNoGuess.xlYes, misValue).Name = "MyTableStyle";
_worksheet.ListObjects.get_Item("MyTableStyle").TableStyle = "TableStyleLight9";
我希望它可以在文檔的頂部創建一個表,另一個同樣大小的幾個之一行向下。無論是表應重疊,但我得到了收到COMException:爲什麼發生這種情況時,這些座標不應該產生重疊表:(C23 A18),任何想法
A table cannot overlap another table.
這時候,它會添加第二個表發生?