How to use GetExtendedFormat?

I am experimenting with retrieving various types of data from XLS-Sheets, currently Date. Do I understand correctly that a Date will be reported as numeric field-type and would need to be recognized by its format?

Let's assume I have valType = worksheet.GetCellType(r,c,0, then how do I apply GetExtendedFormat? I haven't found any samples using GEF, would appreciate if you could show one. (Unless there's a better way to detect dates, of course.)

1 Reply

AV Abirami Varadharajan Syncfusion Team February 15, 2018 05:05 PM UTC

Hi Michael, 

Thank you for contacting Syncfusion support. 

Please refer below code to detect the date type of the range. 

Code Example: 
            bool isDate = false;     
            WorksheetImpl.TRangeValueType  cellType = (worksheet as WorksheetImpl).GetCellType(1, 1, false); 
            if (cellType.Equals(WorksheetImpl.TRangeValueType.Number) || cellType.Equals(WorksheetImpl.TRangeValueType.Formula)) 
                if (((worksheet.Range[1, 1] as RangeImpl).InnerNumberFormat as FormatImpl).GetFormatType(0).Equals(ExcelFormatType.DateTime)) 
                    isDate = true; 

Kindly refer the UG documentation to know more about XlsIO.  
 
Regards, 
Abirami. 


Loader.
Up arrow icon