peter
peter

Reputation: 8652

issues while exporting data from excel by using linqtoexcel in c#

I am following this article http://www.codeproject.com/Articles/659643/Csharp-Query-Excel-and-CSV-Files-Using-LinqToExcel . But the problem now i am facing is ,my excel column name contains .,space etc characters. As per the mapping excel column name and property name should be same. If that is the case how can i insert special characters like . and space in property name. One more question is , is there any license issue regarding those dll's ,if i deploy it in somehwere?

UPDATE

Example of column name is LOCATIONS.CONFIG 3G 2100

Upvotes: 0

Views: 577

Answers (1)

Xi Sigma
Xi Sigma

Reputation: 2372

Use the ExcelColumn atrribute with your properties.

such as:

[ExcelColumn("Col.umn,Nam,e")] 
public string SomeProperty { get; set; }

Another way is using the AddMapping method:

ExcelQueryFactory qf = ...;
qf.TrimSpaces = TrimSpacesType.Both;
qf.AddMapping<SomeType>(o=>o.SomeProperty,"Col.umn,Nam,e")

Upvotes: 2

Related Questions