0

I'm using Gembox.Spreadsheet to load my CSV file and convert it to excel. but the problem is that I have some columns values that store numbers as string because it's zero loaded (zero here is very important either left padded or right) but when it's been loaded these column values convert then into numbers and remove the loading zeros I did use CsvLoadOptions but no way.

Edited:

ex:(Duration here hours.minutes)

EmployeeName;EmployeeNo;EmployeeCode;Duration //CSV first line columns header "Name";100;"000412";"115.50" //CSV values

so here when parsing the EmployeeCode=>412 and the Duration=>115.5

Walid Haidari
  • 125
  • 2
  • 10
  • It would be awesome to see the code [mcve] – mjwills Nov 30 '17 at 12:08
  • you're welcome [mjwills](https://stackoverflow.com/users/34092/mjwills) – Walid Haidari Nov 30 '17 at 13:09
  • 1
    That edit is not a code example. – Abbas Nov 30 '17 at 13:11
  • but my question doens't need any code example? I wonder why forcing that while the idea is so clear! – Walid Haidari Nov 30 '17 at 13:49
  • It is clear to **you**. Not so clear to **us**. – mjwills Nov 30 '17 at 20:15
  • I think you might misunderstand the problem. when I said it's parsed and remove the loading zeros. it's done internally by the Gembox.Spreadsheet mechanism to load the CSV file. why would I write code that include load a file path of CSV.. ExcelFile.Load("tempfile.csv")! - @mjwills – Walid Haidari Nov 30 '17 at 20:29
  • Currently the only way is to disable the parsing for all values, so both those quoted values and that 100 value would not be parsed. To do this you would need to use something like the following: "ExcelFile.Load("tempfile.csv", new CsvLoadOptions(CsvType.SemicolonDelimited) { ParseNumbers = false })" – Mario Z Dec 01 '17 at 06:14
  • Actually I’d done that already, but the problem is that the created excel will be read by another (software) which unfortunately can’t read the other numeric columns without being parsed. @MarioZ – Walid Haidari Dec 01 '17 at 14:12

0 Answers0