6

I'm trying to make a markdown table in Microsoft Excel, I copied multiple rows then went to paste the text into a post, and I get this result:

screenshot of the image uploader dialog

Whereas I'd have expected the table to have been pasted as below in notepad++:

same table pasted into notepad++ rendered as text

|0|1|2|3|4|5|6|7|8|9
|0|4|2|2|3|2|1|3|err|1
|err|0|err|err|err|err|err|err|err|err
|err|4|0|1|3|2|err|3|err|err
|err|3|1|0|2|1|err|2|err|err
|err|2|err|err|0|err|err|2|err|err
|err|4|2|1|2|0|err|3|err|err
|1|4|2|2|3|1|0|4|err|1
|err|1|err|err|err|err|err|0|err|err
|1|5|2|2|3|2|1|4|0|1
|1|4|2|1|2|1|1|3|err|0

Could this be fixed? Converting tables to images is the opposite of what I normally want to do in an edit (image to markdown table!). There's a related bug where isn't not clear what you want paste: Copying text from OneNote and pasting creates an image instead of text but as you should never be pasting an image of a table in, we should actually fix this one!

If the devs can see a `text/HTML' data type on the clipboard event, and then interrogate the html returned you can detect where it's come from:

> arguments[0].clipboardData.getData('text/HTML')
`<html xmlns:v="urn:schemas-microsoft-com:vml"\r\nxmlns:o="urn:schemas-microsoft-com:office:office"\r\nxmlns:x="urn:schemas-microsoft-com:office:excel"\r\nxmlns="http://www.w3.org/TR/REC-html40">\r\n\r\n<head>\r\n<meta http-equiv=Content-Type content="text/html; charset=utf-8">\r\n<meta name=ProgId content=Excel.Sheet>\r\n<meta name=Generator content="Microsoft Excel 15">

Which reveals xmlns:x="urn:schemas-microsoft-com:office:excel" i.e. it's from Excel!

Which presumably means you could change behaviour based on where the content is pasted from, and paste plain text? Pasting table data as a markdown table would be above and beyond this bug fix, and should not be considered a duplicate.

6
  • 2
    Declined in 2019/2020: Can't paste data to question, get prompted for Image?. Commented Feb 16, 2022 at 14:48
  • 3
    While this should be fixed, if it's possible for it to be fixed by changing the page, the simple work-around is to: 1) Open a text-only editor. 2) Paste the content into the text-only editor. 3) Select all the text again and copy it. 4) Then, paste that text-only into the browser's text area for the post editor. This sort of problem is as old as Windows, and in particular Microsoft Office, being able to deal with copy-and-pasting non-text formats. Commented Feb 16, 2022 at 14:54
  • 2
    Does this answer your question? Can't paste data to question, get prompted for Image? and meta.stackoverflow.com/a/381980/3648282 - The answer Stack Overflow is providing is use that key combination to paste. Ctrl+Shift+V Commented Feb 16, 2022 at 15:07
  • 2
    @Makyen a lot of bugs have workarounds, but that doesn't mean they shouldn't be fixed ( this is a dupe of the post Rob found though ) Commented Feb 16, 2022 at 15:10
  • 2
    I posted an answer to the dupe with a snippet showing how the bug could be fixed? meta.stackexchange.com/a/376323/175002 Commented Feb 16, 2022 at 15:50
  • 1
    As a point of interest, there's a great table converter / editor for our markdown tables here: tableconvert.com Commented Feb 17, 2022 at 0:27

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.