Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

Commented Unassigned: Worksheet.Range is not an indexer (C#) [22314]

$
0
0
In the standard libraries, Worksheet.Range is implemented as an indexer, but in NetOffice it is a simple method. This strikes me as weird since .Cells[] and .Offset[] both are indexers, using [] instead of ().

Standard Excel Interop:
```
var formattingRange = pivotSheet.Range[firstCell, lastCell];
```

NetOffice:
```
var formattingRange = pivotSheet.Range(firstCell, lastCell);
```

I had to edit some 400 instances of this when I converted a project to NetOffice, so I think I'm not the only one who would appreciate support for the .Range[a, b] syntax.
Comments: This looks like an issue. The problem behind is in the c# syntax that didnt support properties with optional arguments. The normal interop assemblies doesnt support this also. The Primary Interop Assemblies(PIA) from Microsoft does this better. So Excel.Worksheet need a -real-simple Range property in NetOffice. (The indexer comes from the Excel.Range class in your scenario) This is easy to fix in a minute :) Thanks for pointing this out. Sebastian

Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>