问题描述
SOS如何用C#代码在Excel中插入一列waiting……
解决方案
解决方案二:
http://topic.csdn.net/t/20050919/17/4279898.html///<summary>///插行(在指定WorkSheet指定行上面插入指定数量行)///</summary>///<paramname="sheetIndex"></param>///<paramname="rowIndex"></param>///<paramname="count"></param>publicvoidInsertRows(intsheetIndex,introwIndex,intcount){if(sheetIndex>this.WorkSheetCount){this.KillExcelProcess();thrownewException("索引超出范围,WorkSheet索引不能大于WorkSheet数量!");}try{workSheet=(Excel.Worksheet)workBook.Worksheets[sheetIndex];range=(Excel.Range)workSheet.Rows[rowIndex,this.missing];for(inti=0;i<count;i++){range.Insert(Excel.XlDirection.xlDown);}}catch(Exceptione){this.KillExcelProcess();throwe;}}
时间: 2024-11-13 09:02:51