回复 2楼Lgyee217的帖子
入力的时候是否符合后台设置的格式?
通过以下代码没有重现问题,请您尝试:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- FarPoint.Web.Spread.DateTimeCellType dt = new FarPoint.Web.Spread.DateTimeCellType();
- System.Globalization.DateTimeFormatInfo dtf = new System.Globalization.DateTimeFormatInfo();
- dtf.ShortDatePattern = "yyyy/mm/dd";
- dt.DateTimeFormat = dtf;
- dt.MaximumValue = new DateTime(2020, 12, 31);
- dt.MinimumValue = new DateTime(1950, 1, 1);
- FpSpread1.ActiveSheetView.Columns[0].CellType = dt;
- FpSpread1.ActiveSheetView.Cells[0, 0].Value = DateTime.Now;
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- this.FpSpread1.SaveExcelToResponse("test.xlsx", FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat);
- }
复制代码 |