ruilisi / fortune-sheet

A drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
https://ruilisi.github.io/fortune-sheet-docs/
MIT License
2.54k stars 227 forks source link

Pasting value like 01 from excel to fortune sheet becomes 1 and format is reset to number if set to text on initialization #547

Closed Mussawerx closed 5 months ago

Mussawerx commented 6 months ago

Describe the bug Pasting value like 01 or '01 from excel to fortune sheet becomes 1 and format is reset to number if set to text on initialization

To Reproduce Steps to reproduce the behavior:

  1. Create a sheet like this: image

  2. Copy the contents within the range

  3. Paste them to Forune Sheet: image

  4. See error

Expected behavior When pasting the format should remain the same even if I am trying to set the cell format on initialization to text on pasting the format is reset to general and cell type to number which causes the error of 01 becoming 1 while pasting. The paste should not touch the original format at least.

Screenshots I have pasted the screenshots above for better understanding

Additional context Kindly fix it urgently as its a major requirement and hurdle in our development

shaiqxemustafa commented 6 months ago

+1

sanchit3008 commented 5 months ago

There is nothing to "fix" here per se, because this behaviour is consistent across tools like Google sheets. Following is a screen recording showcasing the same behaviour when copying from Numbers to Google Sheets -

https://github.com/ruilisi/fortune-sheet/assets/22197708/4b0ade95-a7a0-4eec-bf5b-8383c862e700

In case you need to handle this in a custom manner you might want to look at onOp and setCellValue

Mussawerx commented 5 months ago

In the behavior show cased in video it should behave the way it is being depicted, but if apostrophe( ' ) is used before number like this: '01, it must keep the format when pasting in the sheet and should keep the format while pasting