急!!!c#字符串写入xls表中的一个单元格

2025-04-05 08:09:28
推荐回答(1个)
回答1:

添加引用com,Microsoft Excel 11.0 Object Library 1.5 C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE

Excel.Application app = new Excel.Application();
app.Workbooks.Open("D:\\Demo1.xls");
Excel.Worksheet ws = app.Worksheets[1];
Excel.Range er = ws.get_Range(ws.Cells[14, 11], ws.Cells[14, 11]);
er.Value2 = "内容";