且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 vb.net 中的现有 excel 文件中附加数据

更新时间:2023-02-03 16:15:23

如果您知道 GridView 中有多少列和行,那么您可以使用 Worksheet.Paste() 使用Range 覆盖适当大小的区域.因此,如果您的 GridView 有 5 列和 500 行,并且您希望您的选择从 2 行向下和 2 列开始,您可以这样做

If you know how many columns and rows are in your GridView then you can use Worksheet.Paste() using a Range that covers an appropriately sized area. So if your GridView has 5 columns and 500 rows and you want your selection to start 2 rows down and 2 columns in, you could do

aWorksheet.Paste(aWorksheet.Range(aWorksheet.Cells(2,2),aWorksheet.Cells(502,7)))