开发者

Getting the Range of a named area in Excel via C#.net

开发者 https://www.devze.com 2023-02-05 05:27 出处:网络
I\'ve got the following problem. I\'ve got a Excel 2010 file with n-sheets. In one of these sheets I made some table. Like, entering something like this:

I've got the following problem. I've got a Excel 2010 file with n-sheets. In one of these sheets I made some table. Like, entering something like this:

Name  Date RandomValue
 Max 09.03         585
 Tim 11.05       1A442

Now, we've got this option in Excel to format a specific area to a table. So the header row get a little sor开发者_StackOverflowter for each column and maybe a sum-row at the bottom and stuff like that. Now, I want to get this area. Basically the task is, to add a row at the bottom (of course before the sum-row) of the table.

So for this I need the boundaries. If I click on the Name-Manager in Excel, it gives me an overview about the defined names in the sheet. And when I click on it, it selects the given area. So, there are those information for sure. The problem is just...to get these values. Any ideas?


I found a solution. The get_Range() function accept names aswell. So I can get the whole table area:

Range rng = myExcelWorksheet.get_Range("Tablename", misValue); 

I just get the last row, and the first and last cell. So its possible to add a new row. Thanks for the help anyway!

0

精彩评论

暂无评论...
验证码 换一张
取 消