Closed jessehouwing closed 5 years ago
Excel pastes the document as HTML it looks like, so that's why you are seeing the HTML tags. I have to take a look and see if the data also comes across as text which presumably would be the CSV data.
I wasn't aware that there's a difference for the CSV delimiter for different locales. Looks like CultureInfo.TextInfo.ListSeparator:
Will take a look.
I hate the list separator. Nobody knows about it and it makes no sense whatsoever.
On Sun, 30 Sep 2018, 22:45 Rick Strahl, notifications@github.com wrote:
Excel pastes the document as HTML it looks like, so that's why you are seeing the HTML tags. I have to take a look and see if the data also comes across as text which presumably would be the CSV data.
I wasn't aware that there's a difference for the CSV delimiter for different locales. Looks like CultureInfo.TextInfo.ListSeparator:
[image: image] https://user-images.githubusercontent.com/1374013/46262499-f094e700-c49d-11e8-9ea1-46a489b397fb.png
Will take a look.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RickStrahl/MarkdownMonster/issues/447#issuecomment-425750682, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-uS1ffiKPzbgTSVcuRGxXbHpwMIVsEks5ugS14gaJpZM4XA9Te .
Yeah right. So the question is how should we specify the separator. The parser I'm using supports providing the separator and apparently it defaults to ,
which I think is sensitive.
I think using the native language default (ie. the ListSeparator) is going to screw lots of people up too because most CSV files in the wild use commas. I can add a configuration setting in the MM settings, but that's going to be hard to discover.
I'd love it if you could make the copy/paste of tabular data from excel work. Try the advanced "import csv" dialog in excel to see how bad the csv 'standard' actually is ;).
On Sun, 30 Sep 2018, 22:53 Rick Strahl, notifications@github.com wrote:
Yeah right. So the question is how should we specify the separator. The parser I'm using supports providing the separator and apparently it defaults to , which I think is sensitive.
I think using the native language default (ie. the ListSeparator) is going to screw lots of people up too because most CSV files in the wild use commas. I can add a configuration setting in the MM settings, but that's going to be hard to discover.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RickStrahl/MarkdownMonster/issues/447#issuecomment-425751244, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-uS-d4HMghQjKKLIADh1x6Y-6EKfUTks5ugS9OgaJpZM4XA9Te .
So the Paste Table behavior is meant to paste existing HTML or Markdown tables into the editor.
I have to experiment and see if I can manage to get CSV worked into that. The problem is that the code currently checks for HTML first and Excel exports both HTML and the CSV. But Html and table checking happens first so the HTML overrides the text handling.
I think your idea of having a completely separate dialog for the import is probably the right choice - dialog would let you choose where the CSV comes from (clipboard, csv file) and also allow you to select the separator.
FWIW, the table editor currently won't do very with large tables (ie. hundreds of rows) of data due to the way it's implemented. It's on the list for re-writing but I'm a bit strapped for time at the moment so this won't happen right away.
I first tried copy/pasting a table from the browser, but it left a lot of messy style tags and other useless attributes in the paste. Not readable at all.
I then thought, let's round trip through excel's paste plain text into cells, that didn't work, got different unreadable html ;D.
So html to excel to csv to vs code search & replace fixed me :).
Excel does some clever guessing about the separator character and also has a bit of quote and newline behavior detection. All in all csv is probably the least documented specification out there :D.
On Sun, 30 Sep 2018, 23:02 Rick Strahl, notifications@github.com wrote:
So the Paste Table behavior is meant to paste existing HTML or Markdown tables into the editor.
I have to experiment and see if I can manage to get CSV worked into that. The problem is that the code currently checks for HTML first and Excel exports both HTML and the CSV. But Html and table checking happens first so the HTML overrides the text handling.
I think your idea of having a completely separate dialog for the import is probably the right choice - dialog would let you choose where the CSV comes from (clipboard, csv file) and also allow you to select the separator.
FWIW, the table editor currently won't do very with large tables (ie. hundreds of rows) of data due to the way it's implemented. It's on the list for re-writing but I'm a bit strapped for time at the moment so this won't happen right away.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RickStrahl/MarkdownMonster/issues/447#issuecomment-425751820, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-uS_wZb-p7rRaVJBQti8Ep-aufyMeqks5ugTFpgaJpZM4XA9Te .
So I gave this a first shot...
This dialog pops up when you click on Load from CSV. File prompts for file name and works pretty much as before. You can explicitly set the delimiter.
For clipboard, the code reads the clipboard and tries to figure out the delimiter (basically it looks for specific delimiters in every line (tab, comma and the list separator) and sets the separator it finds. Excel exports with tabs so this is why this is kind of important because there's no easy way to see what actually gets exported.
I'll pop this up in a minute in the latest preview release (v1.13.2 or later)
I tried to use Excel to "paste" a table into my markdown file.
The "Paste from Clipboard" pastes a long list of HTML tags in each cell. The "Import from CSV" gives an error for the CSV files generated regardless of the codepage used to save the file.
Paste HTML as markdown gives me:
And import CVS shows:
With my default locale (nl-NL) Excel generates ';' separated CSV files. The default separator is stored in the I18n and g10n settings in Windows.
After Search and Replacing the ";" with ","I was able to import the file.