Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Text File Imports

$
0
0
Yes, only you know what to expect when reading a text file ... what are the delimiters, how many columns, what type of values are in each column, so it is quite a lot to expect software to parse a plain text file and get it right. Excel tries and gets it wrong a significant number of times. Too often eliminating leading zeros for example.

However, I will say that if you parse each row into a well-constructed object. You can pass a list of those objects to the InsertTable method and you have the whole Excel sheet created with one method call. Headings and all.
Such simplicity can't be beat.

example:
sheet.Cell(1, 1).InsertTable(listOfRowObjects)

See this discussion:
https://closedxml.codeplex.com/discussions/251095

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>