简体   繁体   中英

How can we change the Datatype of the Excel cell to CellValues.String from c#

how can we change the DataType = CellValues.String, of each excel column from c#.

for (int index = 0; index < NoOfRecords; index++)
 {
   for (int j = 0; j < colCount; j++)
    {                            
      mWSheet1.Cells[(rowCount) + index, j + 1] =Convert.ToString(ResultsData.Rows[index][j].ToString());
    }
}

put a string format("'"+) in frond of each collection

for (int index = 0; index < NoOfRecords; index++)
 {
   for (int j = 0; j < colCount; j++)
    {                            
      mWSheet1.Cells[(rowCount) + index, j + 1] ="'"+Convert.ToString(ResultsData.Rows[index][j].ToString());
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM