本文介绍了Excel与C#的互操作性 - 如何向右侧填充列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用C#中的excel创建一个互操作性应用程序。目的是将信息放在文本框中,并将此信息加载到Excel工作表中。我可以填写excel表格中的第一列...但我想要的是按下我已命名为干净的按钮并自动清理文本框的内容,然后将输入的新信息转到下一个Excel表格栏等等。 以下是我所拥有的代码示例: private void button9_Click( object sender,EventArgs e) { var excelApplication = new MyExcel.Application(); excelApplication.Visible = false ; MyExcel.Workbook excelWorkBook = excelApplication.Workbooks.Open(textBox189.Text); MyExcel.Worksheet excelWorkSheet = excelWorkBook.ActiveSheet; excelWorkSheet.Cells [ 25 , 2 ] = textBox6.Text; excelWorkSheet.Cells [ 27 , 2 ] = textBox11.Text; excelWorkSheet.Cells [ 29 , 2 ] = textBox10.Text; excelWorkSheet.Cells [ 31 , 2 ] = textBox9.Text; excelWorkSheet.Cells [ 35 , 2 ] = textBox8.Text; excelWorkSheet.Cells [ 39 , 2 ] = textBox7.Text; excelWorkBook.Save(); } 有人帮助我吗? 谢谢。 解决方案 什么填充栏? 填充颜色????你的问题是什么? ?? I am making an Interoperability application with excel in C #. The aim is to put information in the textboxes and load this information to an excel sheet. I can fill the first column in the excel sheet... but what i want is to press a button that i have named "clean" and automatically clean the contents of the textboxes and then the new information that will be entered goes to the next Excel sheet column and so on.Here is an example of the code I have:private void button9_Click(object sender, EventArgs e) { var excelApplication = new MyExcel.Application(); excelApplication.Visible = false; MyExcel.Workbook excelWorkBook = excelApplication.Workbooks.Open(textBox189.Text); MyExcel.Worksheet excelWorkSheet = excelWorkBook.ActiveSheet; excelWorkSheet.Cells[25, 2] = textBox6.Text; excelWorkSheet.Cells[27, 2] = textBox11.Text; excelWorkSheet.Cells[29, 2] = textBox10.Text; excelWorkSheet.Cells[31, 2] = textBox9.Text; excelWorkSheet.Cells[35, 2] = textBox8.Text; excelWorkSheet.Cells[39, 2] = textBox7.Text; excelWorkBook.Save(); }Someone help me?Thanks. 解决方案 What to fill columns??Fill Color???? What is your issue. ?? 这篇关于Excel与C#的互操作性 - 如何向右侧填充列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-23 10:59