更新时间:2023-02-13 17:37:33
如果您还没有尝试过,那么可以尝试
If you have'nt tried this yet, then you can try this
在 VS
中添加对项目的引用: Microsoft.Office.Interop.Excel
Add reference to your project in VS
: Microsoft.Office.Interop.Excel
using Excel = Microsoft.Office.Interop.Excel;
class Program
{
static void Main(string[] args)
{
var excelapp = new Excel.Application();
excelapp.Workbooks.Add();
string path = "Your Excel Path";
Excel.Workbook workbook = excelapp.Workbooks.Open(path);
Excel.Worksheet workSheet = workbook.Worksheets.get_Item(1);
Excel.Range source = workSheet.Range["A9:L9"].Insert(Excel.XlInsertShiftDirection.xlShiftDown);
Excel.Range dest = workSheet.Range["F10"];
source.Copy(dest);
}
}