private void AppendToXlscell(ReportFile RF, int index, ReportFileColumns RFC) { ISheet sheet1 = RF.hssfworkbook.GetSheet("Sheet1"); int Rowindex = index; IRow newRow = sheet1.CreateRow(Rowindex); newRow.HeightInPoints = 20; ICellStyle cellstyle = RF.hssfworkbook.CreateCellStyle(); cellstyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; cellstyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; cellstyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; cellstyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; cellstyle.VerticalAlignment = VerticalAlignment.Center; // ICellStyle DatecellStype = RF.hssfworkbook.CreateCellStyle(); // IDataFormat format = RF.hssfworkbook.CreateDataFormat(); for (int i = 0; i < 13; i++) { ICell cell = newRow.CreateCell(i); cell.SetCellValue((string)RFC.GetType().GetFields()[i].GetValue(RFC)); cell.CellStyle = cellstyle; /* if (i == 10) * { * cell.SetCellValue((DateTime)RFC.GetType().GetFields()[i].GetValue(RFC)); * * DatecellStype.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; * DatecellStype.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; * DatecellStype.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; * DatecellStype.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; * DatecellStype.VerticalAlignment = VerticalAlignment.Center; * DatecellStype.DataFormat = format.GetFormat("m/d/yy"); * cell.CellStyle = DatecellStype; * // cell.CellStyle.WrapText = true; * } * else * {*/ } sheet1.ForceFormulaRecalculation = true; }
public ReportFileColumns AppendATMDataToColumnsFormat(int rowindex) { IRow Row = sourceWB.GetSheet("Sheet1").GetRow(rowindex); ReportFileColumns temRFcolumns = new ReportFileColumns(); temRFcolumns.Model = "HT" + getCellValue(Row, AStruct.Model); //Row.GetCell(1).StringCellValue; //temRFcolumns.Model = "HT-" + temRFcolumns.Model; temRFcolumns.ProductID = getCellValue(Row, AStruct.ProductID); //Row.GetCell(2).StringCellValue; string tempCellValue = Row.GetCell(AStruct.WorkStyle).StringCellValue; if (tempCellValue == "PM") { temRFcolumns.ErrorSrc = "PM"; temRFcolumns.DealSrc = "PM"; } else if (tempCellValue.Substring(0, 2) == "升级") { temRFcolumns.ErrorSrc = "升级"; temRFcolumns.DealSrc = "升级"; } else if (tempCellValue.IndexOf("协助对账") != -1) { temRFcolumns.ErrorSrc = tempCellValue.Substring(4); temRFcolumns.DealSrc = "协助对账"; } else { temRFcolumns.ErrorSrc = getCellValue(Row, AStruct.ErrorSrc); //Row.GetCell(16).StringCellValue; temRFcolumns.DealSrc = getCellValue(Row, AStruct.DealSrc); //Row.GetCell(17).StringCellValue; } string bank = getCellValue(Row, AStruct.bank); bank = parseBankName(bank); temRFcolumns.ClientName = bank + getCellValue(Row, AStruct.ClientName); //Row.GetCell(29).StringCellValue; temRFcolumns.Engineer = getCellValue(Row, AStruct.Engineer); //Row.GetCell(20).StringCellValue; temRFcolumns.MaintenanceDate = getCellValue(Row, AStruct.MaintenanceDate, true); //Row.GetCell(11).Stri temRFcolumns.PaiID = getCellValue(Row, AStruct.PaiID); //Row.GetCell(3).StringCellValue; temRFcolumns.ServiceID = getCellValue(Row, AStruct.ServiceID); //Row.GetCell(4).StringCellValue; return(temRFcolumns); }
public ReportFileColumns AppendSetupDataToColumnsFormat(int rowindex) { IRow Row = sourceWB.GetSheet("Sheet1").GetRow(rowindex); ReportFileColumns temRFcolumns = new ReportFileColumns(); temRFcolumns.Model = "HT" + getCellValue(Row, 2); //Row.GetCell(1).StringCellValue; //temRFcolumns.Model = "HT-" + temRFcolumns.Model; temRFcolumns.ProductID = getCellValue(Row, 1); //Row.GetCell(2).StringCellValue; temRFcolumns.ErrorSrc = "新装机"; temRFcolumns.DealSrc = "新装机"; string bank = getCellValue(Row, 24); bank = parseBankName(bank); temRFcolumns.ClientName = bank + getCellValue(Row, 26); //Row.GetCell(29).StringCellValue; temRFcolumns.Engineer = getCellValue(Row, 33); //Row.GetCell(20).StringCellValue; temRFcolumns.MaintenanceDate = getCellValue(Row, 4, true); //Row.GetCell(11).Stri temRFcolumns.PaiID = getCellValue(Row, 43); //Row.GetCell(3).StringCellValue; temRFcolumns.ServiceID = getCellValue(Row, 0); //Row.GetCell(4).StringCellValue; return(temRFcolumns); }
//{ textBox1.Text = "工号为空,请输入工号!"; } /* public void AppendToColumnsFormatForWebpage() * { * RFcolumns.PaiID = DFList.PaiID; * RFcolumns.ServiceID = DFList.ServiceID; * RFcolumns.ProductID = DFList.MID; * RFcolumns.MaintenanceDate = DFList.AvTime; * RFcolumns.ErrorSrc = DFList.ErrorScr; * RFcolumns.DealSrc = DFList.DealScr; * RFcolumns.Engineer = DFList.staffnum; * }*/ public ReportFileColumns AppendOtherDataToColumnsFormat(ISheet sheet, int rowindex) { IRow Row = sheet.GetRow(rowindex); ReportFileColumns temRFcolumns = new ReportFileColumns(); temRFcolumns.Model = getCellValue(Row, GGStruct.Model); //Row.GetCell(1).StringCellValue; //temRFcolumns.Model = "HT-" + temRFcolumns.Model; temRFcolumns.ProductID = getCellValue(Row, GGStruct.ProductID).Replace(temRFcolumns.Model + " ", ""); //Row.GetCell(2).StringCellValue; if (Row.GetCell(GGStruct.WorkStyle).StringCellValue == "PM") { temRFcolumns.ErrorSrc = "PM"; temRFcolumns.DealSrc = "PM"; } else if (Row.GetCell(GGStruct.WorkStyle).StringCellValue.Substring(0, 2) == "升级") { temRFcolumns.ErrorSrc = "升级"; temRFcolumns.DealSrc = "升级"; } else { temRFcolumns.ErrorSrc = getCellValue(Row, GGStruct.ErrorSrc); //Row.GetCell(16).StringCellValue; temRFcolumns.DealSrc = getCellValue(Row, GGStruct.DealSrc); //Row.GetCell(17).StringCellValue; } string bank = getCellValue(Row, GGStruct.bank); //bank = parseBankName(bank); temRFcolumns.ClientName = getCellValue(Row, GGStruct.ClientName); //Row.GetCell(29).StringCellValue; temRFcolumns.Engineer = getCellValue(Row, GGStruct.Engineer); //Row.GetCell(20).StringCellValue; //temRFcolumns.MaintenanceDate = getCellValue(Row, 24); //Row.GetCell(11).StringCellValue; string temDate = getCellValue(Row, GGStruct.MaintenanceDate); //Row.GetCell(11).StringCellValue; temRFcolumns.MaintenanceDate = temDate.Remove(temDate.IndexOf(' ')).Replace("-", "/"); temRFcolumns.PaiID = getCellValue(Row, GGStruct.PaiID); //Row.GetCell(3).StringCellValue; temRFcolumns.ServiceID = getCellValue(Row, GGStruct.ServiceID); //Row.GetCell(4).StringCellValue; return(temRFcolumns); }