When copy from excel, how to force paste only text?

Already set the NumberFormat

filterRange.NumberFormat = "@";


But when copy numbers from excel, the format is overrided.


2 Replies

CR crosslife October 18, 2024 10:35 AM UTC



SP Sreemon Premkumar Muthukrishnan Syncfusion Team October 21, 2024 03:45 PM UTC

Hi crosslife,


To maintain the format of a cell when pasting a value from another cell with a different format, you can set SfSpreadsheet.CopyPaste.DefaultPasteOption to PasteOptions.Value. This ensures that only the value is pasted, without copying the format. Please find the code snippet below.

Code snippet:

spreadsheet.CopyPaste.DefaultPasteOption = PasteOptions.Value;


For more information regarding the paste options, please refer this user guide documentation.


Regards,
Sreemon Premkumar M.


Loader.
Up arrow icon