你好 因為某些原因對時間欄位進行處理 代碼如下
for (int i = 0; i < dv.Table.Rows.Count; i++)
{
for (int j = 0; j < dv.Table.Columns.Count; j++)
{
//if (dv.Table.Columns[j].ColumnName.ToString() != "riceEffectiveDate" || dv.Table.Columns[j].ColumnName.ToString() != "EFFECTIVEDATE")
//{
fpsDailyMain_Sheet1.Cells[i, j].Value = dv.Table.Rows[j].ToString();
//}
}
}
以上代碼是所有欄位都為字符型
隨后我又對時間類型的欄位進行處理
//短日期類型:生效日&失效日
public static FarPoint.Win.Spread.CellType.DateTimeCellType shortdatetype
{
get
{
FarPoint.Win.Spread.CellType.DateTimeCellType _shortdate = new FarPoint.Win.Spread.CellType.DateTimeCellType();
_shortdate.DateTimeFormat = FarPoint.Win.Spread.CellType.DateTimeFormat.ShortDate;
return _shortdate;
}
}
fpsDailyMain_Sheet1.Columns[PublicMethod.GetIndexByLable(fpsDailyMain_Sheet1, "riceEffectiveDate")].CellType = FarpointMethod.shortdatetype;
后邊對該欄位排序就按照string類型的排序,不按date類型排序 |
|