IWorksheet sheet = workbook.Worksheets[0];
IMigrantRange migrantRange = sheet.MigrantRange;
int rowCount = sheet.UsedRange.LastRow;
int colCount = sheet.UsedRange.LastColumn;
for (int i = 1; i <= rowCount; i++)
{
for (int j = 1; j <= colCount; j++)
{
migrantRange.ResetRowColumn(i,j);
string value = migrantRange.DisplayText;
}
} |
//Set dynamic data to Value2 property
sheet.Range["A1"].Value2 = value; |
foreach (IRange cell in worksheet.UsedRange)
{
if(cell.HasString)
{
cell.NumberFormat = "@";
}
else if(cell.HasNumber)
{
cell.NumberFormat = "0.00";
}
else if(cell.HasDateTime)
{
ell.NumberFormat = "m/d/yyyy";
}
} |
IMigrantRange migrantRange = worksheet.MigrantRange;
int rowCount = 10;
int colIndex = 5;
for (int i = 1; i <= rowCount; i++)
{
migrantRange.ResetRowColumn(i, colIndex);
migrantRange.NumberFormat = "0.00";
} |
Hi Syncfusion Team,
I have a query. I read that Excel. owing to performance issues truncates leading and trailing zeroes if a particular cell is formatted as a number. So I wanted to ask you guys if Syncfusion offers any method to override this default Excel behavior of truncating trailing and leading zeroes.
I will illustrate this with an example.
I have a value like 914.000000. I am using logic to convert this value to a number format with the logic that has been discussed in this ticket. But the value being entered in the downloaded excel sheet is 914.00 or just 914. I understand that this is the default excel behavior of truncating trailing zeroes. So my question is, is there any way that I can retain the value 914.000000 and still have it formatted as a number?
Thanks in advance for your help.
Kind regards,
Ajay Shastry
Hi Sridhar,
Thank you for your help all along the way. I appreciate your quick and sensible responses.
Regards,
Ajay