I have an app that imports from csv files. It is sometimes useful to display the raw content of the file eg if there are errors importing the file. Is there a way to achieve this? I'd like to be able to display the colorised csv file in a window opened from within the app.
I just tried running this from a command prompt:
"C:\Program Files\Microsoft Visual Studio\18\Professional\Common7\IDE\devenv.exe" "c:\temp\mytestfile.csv"
It opened fine in Visual Studio along with that file using the csv extension.
Is that what you wanted?
Thanks for the suggestion James, which could probably be made to work within an app - run the command line you gave and somehow capture the output to present in an app window. But having had a peek at the code, it would probably be easier to refactor the extension code into a library method and call it from the app. I'm currently using the VB csv file parser as I'm not aware of a c# .net equivalent, but Mads' code does all this and more anyway. Something along the lines of
```
CSVDocument ParseCSVFile(string filePath)
string GenerateHTML (CSVDocument csvDoc , CSVOptions options)
```
where `CSVOptions ` controls the formatting.
I'll give this a go within my app soon.