首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

NPOI导出Excel2007

public void Export_ProjectList(DataTable dt, HttpRequestBase Request) { string strModelFile = “”; strModelFile = Request.PhysicalApplicationPath + “ProjectList.xls”;//模板地址 XSSFWorkbook workbook = null; FileStream file = new FileStream(strModelFile, FileMode.Open, FileAccess.Read); workbook = new XSSFWorkbook(file);//如果导出2003 则是HSSFWorkbook HSSFSheet sheet = (HSSFSheet)workbook.GetSheet(“ProjectList”);//可以是ISheet Sheet=null; if (sheet == null) { return; } ICellStyle cellStyle = workbook.CreateCellStyle(); cellStyle.BorderBottom = BorderStyle.Thin; cellStyle.BorderLeft = BorderStyle.Thin; cellStyle.BorderRight = BorderStyle.Thin; cellStyle.BorderTop = BorderStyle.Thin; cellStyle.WrapText = true; cellStyle.Alignment = HorizontalAlignment.Center; cellStyle.VerticalAlignment = VerticalAlignment.Center;

02
领券