We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change in behaviour

When opening the attached workbook using the previous version of XlsIO (ExcelRW version 2.1.0.9), and displaying values in a grid, the values appeared exactly as they do in the Excel workbook. Now using version 4.1.0.50 (IRange.Text property), the grid displays formulae in column 1 (row 2 onwards) rather than cell values, and some of the date values have a different format that appears in the Excel workbook. Can you explain how I can read and display values so they appear the same in Excel ?

Workbook.zip

6 Replies

ST Stephen February 6, 2006 04:05 PM UTC

Behaviour hasn''t changed since previous version, but would still like to know how to display values as they appear in Excel, rather than formulae (as is being displayed in the 1st column).


RA Ramu Syncfusion Team February 7, 2006 04:19 PM UTC

Hi Stephen, you could read the formula computed value in the excel file using IRange.FormulaNumberValue property. Here is the sample that reads the exact data from excel and displays in grid.Please take a look at attached sample. Please let me know if you have any questions. ExcelToGrid Thanks for using Syncfusion Products. Thanks, Ramu.K


ST Stephen February 11, 2006 12:42 PM UTC

It''s not quite that simple because the formula may return a string value or a date value, so you''d have to use FormulaStringValue and FormulaDateTime as well. The ideal would be if you could add a property (FormattedValue, say) to IRange, which would return the value, as displayed in Excel. Better still, if there could be an overloaded version of the Open method that reads in information necessary to be able to read formatted values, but not information just affecting appearance (font, cell width etc.)


RA Ramu Syncfusion Team February 13, 2006 12:06 PM UTC

Hi Stephen, Here is another way of importing excel to grid. Gridconverter control is used to convert excel to grid and from grid to excel using ExcelToGrid() and GridToExcel(). Here is the sample program that converts excel to grid with exact data present in excel. Please take a look at the sample and let me know If you have any questions. ExceltoGridconverter Thanks for using Syncfusion Products. Thanks, Ramu.K


JK Joey Keeton replied to Stephen March 3, 2018 10:57 AM UTC

It''s not quite that simple because the formula may return a string value or a date value, so you''d have to use FormulaStringValue and FormulaDateTime as well. The ideal would be if you could add a property (FormattedValue, say) to IRange, which would return the value, as displayed in Excel. Better still, if there could be an overloaded version of the Open method that reads in information necessary to be able to read formatted values, but not information just affecting appearance (font, cell width etc.)

hi



AV Abirami Varadharajan Syncfusion Team March 5, 2018 11:25 AM UTC

Hi Joey, 
 
Thank you for contacting Syncfusion support. 
 
We request you to make use of ‘DisplayText’ property which returns the cell value as a string with number formats applied. (i.e., it returns the value as you see in cells of Microsoft Excel). 
 
It is recommended to invoke EnableSheetCalculations method of worksheet class to calculate formulas if found. Without this line, cells with formula will not return calculated value.  
 
Code Snippet: 
worksheet.EnableSheetCalculations();  
  
Kindly refer the below API reference to know more about DisplayText property.  
  
  
Please let us know if you have any concerns. 
 
Regards, 
Abirami. 


Loader.
Live Chat Icon For mobile
Up arrow icon