Question

Im trying to use the Linq to Excel library, and i get stucked into this problem.

I have an excel with a worksheet name, and i need to define the range of the colums that i need to get.

The problem is: how to use these two classes at the same time on query?

excel.Worksheet<Company>("NAME OF WORKSHEET")

and

excel.WorksheetRange<Company>("B37", "M37")

Example:

 var print = from c in excel.WorksheetRange<Company>("B37", "M37")
             select c;

(but i cant do this, because i need to set the worksheet name first)

Thanks!

Était-ce utile?

La solution

You can pass the worksheet name as the 3rd argument in the WorksheetRange<>() method.

var print = from c in excel.WorksheetRange<Company>("B37", "M37", "NAME OF WORKSHEET")
            select c;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top