filehelpers

error when using filehelpers on IIS; sometimes :S : [PolicyException: Required permissions cannot be acquired.]

故事扮演 提交于 2019-12-24 22:50:31
问题 FileHelpers.dll (2.0) are referenced within 2 class libraryies (Dto and Services) in my solution My webapp (asp.net mvc) is on IIS7 (Full Trust) Windows 7 PRO 64 and I sometimes get this exception when starting my app from VS2008: (to get rid of it I delete the FileHelpers.dll from bin, run, close browser, rebuild the solution and run again ) [PolicyException: Required permissions cannot be acquired.] System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset,

parse several field using file helper

坚强是说给别人听的谎言 提交于 2019-12-24 08:30:05
问题 Good day to all, i have a problem regarding CSV parse using File Helper. My CSV is look like this ,,,026642,0,00336,05,19,"WATERMELON *",19,"1 ",,,,,,,,0,,001.99.,0,,,,,0,,0,0,,,,,,,,,,,,,,,,,,51,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,026645,0,00338,05,19,"ONION ",19,"*1 ",,,,,,,,0,,002.99.,0,,,,,0,,0,0,,,,,,,,,,,,,,,,,,51,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ,,,026687,0,00380,05,19,"MUSHROOM ",19," (BLACK FUNGUS) ",,,,,,,,0,,021

Read column headers in CSV using fileHelpers library

时光毁灭记忆、已成空白 提交于 2019-12-24 02:04:02
问题 I have a CSV file where the headers indicate in which order the information is going to appear in the detail lines. An example would be: COLUMN1,COLUMN2,COLUMN3 VALUE1,VALUE2,VALUE3 but could also be COLUMN2,COLUMN3,COLUMN1 VALUE2,VALUE3,VALUE1 The class would look like this public class CSVImportLineItem { public string Column1 {get; set;} public string Column2 {get; set;} public string Column3 {get; set;} } Is there a way (using FileHelpers) to read the headers in and then determine the

How can one to dynamically parse a CSV file using C# and the Smart Format Detector in FileHelpers 3.1?

*爱你&永不变心* 提交于 2019-12-22 15:00:49
问题 As per in this FileHelpers 3.1 example, you can automatically detect a CSV file format using the FileHelpers.Detection.SmartFormatDetector class. But the example goes no further. How do you use this information to dynamically parse a CSV file? It must have something to do with the DelimitedFileEngine but I cannot see how. Update: I figured out a possible way but had to resort to using reflection (which does not feel right). Is there another/better way? Maybe using System.Dynamic? Anyway, here

FileHelpers: Optional fields in non-quoted CSV

江枫思渺然 提交于 2019-12-22 09:01:05
问题 I am using FileHelpers to import data from a CSV file. Problem is, some versions of the CSV file have more fields than others. As such, I have marked the fields that are sometimes missing as being optional, but this does not seem to work as instead of just ignoring when fields are missing (which it seems to do ok) it is also always chopping the last character off of the last field that is present. For example... a row containing "ABC,DEF,GHI" (without the quotes) imports as "ABC", "DEF" &

FieldConverter ConverterKind.Date “dd/MM/yyyy” exception

心不动则不痛 提交于 2019-12-22 06:46:42
问题 I try to read a csv file. my fifth record contans a date: 03/11/2008 This is a piece of my code: [FieldConverter(ConverterKind.Date, "dd/MM/yyyy")] public DateTime datum_5; My code crashs on this: Result[] results= (Result[])engine.ReadFile(@"..\Data\expo.txt"); And with this exception: Line: 1. Column: 41. Field: datum_5. Error Converting '03/11/2008' to type: 'DateTime'. Using the format: 'dd/MM/yyyy' When i do this: [FieldConverter(typeof(ConvertDate))] public DateTime datum_5; with this:

FileHelpers: How to skip first and last line reading fixed width text

房东的猫 提交于 2019-12-21 07:04:37
问题 Code below is used to read fixed width uploaded file content text file using FileHelpers in ASP .NET MVC2 First and last line lengths are smaller and ReadStream causes exception due to this. All other lines have proper fixed width. How to skipt first and last lines or other way to read data without exception ? [FixedLengthRecord()] class Bank { [FieldFixedLength(4)] public string AINETUNNUS; [FieldFixedLength(16)] public string TEKST1; [FieldFixedLength(3)] public string opliik;

Is there a way to do field order using the FileHelpers library?

扶醉桌前 提交于 2019-12-18 07:51:37
问题 I downloaded FileHelpers from nuget but I am not sure if this feature does not exist or if I don't have the right version or what. I been looking around and it seems that FileHelpers may have an attribute to specify the field order. I downloaded this one however when I was looking in nuget there seems to be another version 回答1: Firstly, the FieldOrder attribute does not exist in FileHelpers 2.0. In FileHelpers 2.9.9 (also available via NuGet), the attribute exists but if you specify it for

FileHelper escape delimiter

强颜欢笑 提交于 2019-12-18 06:17:47
问题 I am using FileHelper 2.0 for parsing my csv data. Is there any option that filehelper can properly handle escaped delimiter? That it can identify field as data and not as delimiter. Our csv format: escape comma (,) with \, Example data: name, lastname nico\,le,opeka Current code: [DelimitedRecord(",")] public class contactTemplate { public string firstName; public string lastName; } How can I get firstName = nico,le and lastName = opeka. FileHelpers splits by comma , and now it returns:

How to export to excel file with FileHelpers

元气小坏坏 提交于 2019-12-13 17:44:02
问题 I am using File Helpers and I am unsure how to take my data and export it to an excel file. I see a tutorial forextracting records but not creating a excel file. I tried to do this ExcelStorage provider = new ExcelStorage(typeof(Img)); provider.StartRow = 2; provider.StartColumn = 1; provider.FileName = "Customers.xls"; provider.HeaderRows = 6; provider.InsertRecords(imgs.ToArray()); // imgs was a list before System.IO.FileNotFoundException was unhandled by user code Message=Could not load