Replied 8 September 2017, 2:34 pm EST
<BLOCKQUOTE><div><img src="/wp-content/uploads/CS_images/icon-quote.gif"> paul1960:
<span style="font-family:'Verdana','sans-serif';color:black;font-size:9pt;">Spread imports all the Excel cell formats to the General cell type and assigns the formats as closely as possible by setting the NumberFormat, DateTimeFormat, and FormatString properties. The numberformat you set for your general celltype shouldn't come into it as Spread should reset the Numberformat to match what it is importing. I created a xlsx sheet with your 2 cells one using (100.0) and the other -100.0 for negative 100.0. I then created a new project, pulled a spread onto it and added a line to the Form1_Load event to open my spreadsheet and it opened it displaying my two cells in the format I had set them. I tried it in both version 5 and version 4, is there anything else I need to do to see your issue?</span>
Actually, the above applies to importing XLS/XLSX into Spread, not for pasting data from Excel. Spread does not support Excel's clipboard format, and data pasted from Excel is pasted like it would be into Notepad -- as a tab-delimited string. Spread pastes this by parsing the string into individual strings to set into the cells as if a user typed the values. The cell type for each cell parses the string for the cell into the value, and NumberCellType expects the string to conform to the format settings for the cell type (i.e. NegativeFormat).
GeneralCellType is the closest to Excel's behavior, and GeneralFormatter will parse the string using IParseFormatSupport to create a format string and format provider. If you want to support pasting values from Excel into Spread, that is the best cell type to use for the target cells. Then if you want to process the cell range afterward to change the cell types to restrict input by the user, you can get the FormatString and DateTimeFormat or NumberFormat from the style model using GetParseFormat.