简体   繁体   English

Filehelpers ExcelStorage从资源中读取模板

[英]Filehelpers ExcelStorage read template from resources

Filehelpers ExcelStorage has a property public string TemplateFile { get; set; } Filehelpers ExcelStorage具有属性public string TemplateFile { get; set; } public string TemplateFile { get; set; }

For that reason I have to keep my template file in the program directory (bin). 因此,我必须将模板文件保存在程序目录(bin)中。 But if I want to use my template file as a embedded resource is there any way I can still use that as a template in ExcelStorage ? 但是,如果我想将模板文件用作嵌入式资源,还有什么方法可以在ExcelStorage中将其用作模板?

The TemplateFile property is for specifying the .xls file to use when writing data, not for the record class. TemplateFile属性用于指定写入数据时使用的.xls文件,而不是记录类。

However, you ought to be able to use Runtime Record Classes . 但是,您应该能够使用Runtime Record Classs Something like: 就像是:

// myTemplate is the extracted resource as a string
string mClass = myTemplate;
Type t = ClassBuilder.ClassFromString(mClass); 
var storage = new ExcelStorage(t);
//etc.

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM