简体   繁体   English

在C#中使用linqtoexcel从excel导出数据时出现问题

[英]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 . 我正在关注本文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. 但是我现在面临的问题是,我的Excel列名称包含。,空格等字符。 As per the mapping excel column name and property name should be same. 根据映射excel列名称和属性名称应相同。 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? 另一个问题是,如果我将dll部署到这些dll中,是否存在任何许可证问题?

UPDATE UPDATE

Example of column name is LOCATIONS.CONFIG 3G 2100 列名称的示例是LOCATIONS.CONFIG 3G 2100

Use the ExcelColumn atrribute with your properties. 对属性使用ExcelColumn属性。

such as: 如:

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

Another way is using the AddMapping method: 另一种方法是使用AddMapping方法:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导入Excel数据(使用LinqToExcel)仅在工作表打开的情况下有效C#MVC - Importing Excel Data(using LinqToExcel) Only works If worksheet is open C# MVC c#将数据从datagridview导出到excel - c# exporting data from datagridview into excel 在Excel C#中导出GridView数据时出现问题 - Trouble while Exporting GridView Data in Excel C# 将数据表导出到excel C#时如何添加标头 - how to add header while exporting data table to excel C# 在C#中将gridview数据导出到Excel时遇到问题 - Facing issue while Exporting gridview data to Excel in C# 导出到excel数据时出错:&#39;&#39;,十六进制值0x07,使用C#是无效字符 - error while exporting to excel data : ' ', hexadecimal value 0x07, is an invalid character using c# 从C#导出时Excel图表未绑定 - Excel Chart not binding while exporting from c# 使用C#将Treeview数据导出到Excel工作表 - Exporting Treeview data to excel sheet using C# 从C#导出数据到Excel版本错误 - Exporting data from C# to Excel version error 动态设置列宽,同时使用水晶报表(ExportFormatType.ExcelRecord)将数据仅导出到C#中的excel - Set column width dynamically while exporting DATA ONLY to excel in c# using crystal report (ExportFormatType.ExcelRecord)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM