Skip to content

Commit

Permalink
Update readme to include usage of the ExcelColumn attribute to map co…
Browse files Browse the repository at this point in the history
…lumns.
  • Loading branch information
Jason Senich committed Jan 26, 2014
1 parent ec5bafb commit 8a664bd
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ Column names from the worksheet can be mapped to specific property names on the
where c.State == "IN" && c.Employees > 500
select c;

Column names can alternately be mapped using the **ExcelColumn** attribute on properties of the class.

public class Company
{
[ExcelColumn("Company Title")] //maps the "Name" property to the "Company Title" column
public string Name { get; set; }

[ExcelColumn("Providence")] //maps the "State" property to the "Providence" column
public string State { get; set; }

[ExcelColumn("Employee Count")] //maps the "Employees" property to the "Employee Count" column
public string Employees { get; set; }
}

## Using the LinqToExcel.Row class
Query results can be returned as LinqToExcel.Row objects which allows you to access a cell's value by using the column name in the string index. Just use the **Worksheet()** method without a generic argument.

Expand Down

0 comments on commit 8a664bd

Please sign in to comment.