I am reading this (Excel Tasks) to automate some Excel operations in VS2008 C#
http://msdn.microsoft.com/en-us/library/syyd7czh%28v=VS.80%29.aspx
我正在阅读本文(Excel任务),以自动化VS2008中的一些Excel操作
But I couldn't find how to delete a column (or multiple columns).
但是我找不到如何删除一个列(或多个列)。
eg. How to delete column C and shift the rest left?
如。如何删除C列并将其余的左移?
Thanks in advance.
提前谢谢。
2 个解决方案
#1
4
Here you find how to do it:
在这里你可以找到如何去做:
http://bytes.com/topic/c-sharp/answers/258110-how-do-you-delete-excel-column
http://bytes.com/topic/c-sharp/answers/258110-how-do-you-delete-excel-column
http://quicktestprofessional.wordpress.com/2008/02/14/delete-columns-from-xl-sheet/
http://quicktestprofessional.wordpress.com/2008/02/14/delete-columns-from-xl-sheet/
#2
17
Here is the solution to make it clearer (thanks to Leniel for the link)
这里有一个更清晰的解决方案(感谢Leniel的链接)
Excel.Range range = (Excel.Range)sheet.get_Range("C1", Missing.Value);
range.EntireColumn.Delete(Missing.Value);
System.Runtime.InteropServices.Marshal.ReleaseComObject(range);
#1
4
Here you find how to do it:
在这里你可以找到如何去做:
http://bytes.com/topic/c-sharp/answers/258110-how-do-you-delete-excel-column
http://bytes.com/topic/c-sharp/answers/258110-how-do-you-delete-excel-column
http://quicktestprofessional.wordpress.com/2008/02/14/delete-columns-from-xl-sheet/
http://quicktestprofessional.wordpress.com/2008/02/14/delete-columns-from-xl-sheet/
#2
17
Here is the solution to make it clearer (thanks to Leniel for the link)
这里有一个更清晰的解决方案(感谢Leniel的链接)
Excel.Range range = (Excel.Range)sheet.get_Range("C1", Missing.Value);
range.EntireColumn.Delete(Missing.Value);
System.Runtime.InteropServices.Marshal.ReleaseComObject(range);