示例#1
0
        private void AppendToXlscell(ReportFile RF)
        {
            ISheet       sheet1       = RF.hssfworkbook.GetSheet("Sheet1");
            int          RowCount     = sheet1.LastRowNum + 1;
            HSSFWorkbook hssfworkbook = new HSSFWorkbook();
            ICellStyle   cellstyle    = 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;
            IRow newRow = sheet1.CreateRow(RowCount);

            for (int i = 0; i < 13; i++)
            {
                ICell cell = newRow.CreateCell(i);
                cell.SetCellValue((string)RFcolumns.GetType().GetFields()[i].GetValue(RFcolumns));
                cell.CellStyle = cellstyle;
                if (i == 5 | i == 6)
                {
                    cell.CellStyle.WrapText = true;
                }
            }
            sheet1.ForceFormulaRecalculation = true;
            RF.WriteToFile();
        }
示例#2
0
        private string Exportfile()
        {
            if (list.Count == 0)
            {
                return("");
            }
            string EName     = list[0].Engineer;
            string currentNa = reportfile.updatefileName(Station, EName);

            reportfile.updatefilePath(savePath);
            return(reportfile.WriteToFile());
        }