Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paste format when pasting from Excel file #367

Open
lucasbozzo opened this issue Nov 11, 2024 · 3 comments
Open

Paste format when pasting from Excel file #367

lucasbozzo opened this issue Nov 11, 2024 · 3 comments

Comments

@lucasbozzo
Copy link

When pasting values from an Excel file, the Grid is using the HTML format, instead of Plain Text. This is troublesome as Excel can have many visual formats and the Grid is not using the raw value.
Take as an example a value "12345.67" in Excel. Depending on the cell width, Excel will show the value trimmed, rounded or even replaced with "####".
image

These are the values used if HTML format is first, which are not correct:
image

However, Plain Text contains the correct raw values:
image

Proposal:
Change the evaluation to consider clipboard format text/plain first and text/html second.

Second proposal:
Control the order of evaluation with a prop. Some prop called clipboardFormatPriority, with an array of values text/html,text/plain, text.

@lucasbozzo
Copy link
Author

@nick-keller I have created the PR #368 for your consideration 👍

@nick-keller
Copy link
Owner

Thx for contributing @lucasbozzo
The issue I have with this is that doing it the other way also has edge cases. Notably for managing whitespaces and line return that just don't work with plain text... Are there any other solution? If you can copy / paste it from Excel to another Excel file, there must be a way to get that data correctly.

@lucasbozzo
Copy link
Author

@nick-keller that is a fair question. Agree. I will have a deeper look at this. A very high level search lead me to Sheetjs. Their approach is to use all of the formats, which I think is interesting:
https://docs.sheetjs.com/docs/demos/local/clipboard/#browser-reading-paste
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants