net写入Excel工作表

net写入Excel工作表

本文介绍了[不是问题]使用C#.net写入Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 早上好,先生, 我有一张excel表在桌面上。现在excel表完全空白。我想用C#.net给excel表写一些值...所以请提供代码或任何相关的指导。 谢谢Good morning Sir,I have one excel sheet which is on desktop. Now the excel sheet is completely blank. I want to write some value into the excel sheet using C#.net... So please provide me code or Any guidance related to that.Thank You推荐答案//path to filestring path = "C:\\Users\\[User_Name]\\Desktop\\[file_name].xls"; #region Used Excel Objects MsExcel.ApplicationClass excelApp = new Microsoft.Office.Interop.Excel.ApplicationClass(); MsExcel.Workbook excelWorkbook = excelApp.Workbooks.Open(path, 0, ture, 5, "", "", false, MsExcel.XlPlatform.xlWindows, "", true, false, 0, true, false, false); ; MsExcel.Sheets excelSheets = excelWorkbook.Worksheets; //create the object of sheet1 MsExcel.Worksheet xlws = (MsExcel.Worksheet)excelSheets.get_Item("sheet1"); MsExcel.Sheets anna = excelSheets; #endregion //write data to row 1 and column 1 i.e. "A" xlws.Cells[1, 1] = Convert.ToString(Value); 这篇关于[不是问题]使用C#.net写入Excel工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 21:13