当前位置: 首页 > news >正文

商务网站建设实训报告1600字wordpress同步新浪微博

商务网站建设实训报告1600字,wordpress同步新浪微博,建企业网站用什么源码,网站制作的重要流程图文章目录 1、加入NPOI 程序集#xff0c;使用nuget添加程序集2、引用NPOI程序集3、设置表格样式4、excel加载图片5、导出excel 1、加入NPOI 程序集#xff0c;使用nuget添加程序集 2、引用NPOI程序集 private IWorkbook ExportExcel(PrintQuotationOrderViewModel model){//… 文章目录 1、加入NPOI 程序集使用nuget添加程序集2、引用NPOI程序集3、设置表格样式4、excel加载图片5、导出excel 1、加入NPOI 程序集使用nuget添加程序集 2、引用NPOI程序集 private IWorkbook ExportExcel(PrintQuotationOrderViewModel model){//if (model null) return string.Empty;string tempDirPath Server.MapPath(/Templates/Excel/);if (!Directory.Exists(tempDirPath)){Directory.CreateDirectory(tempDirPath);}IWorkbook workbook;string excelTempPath tempDirPath quotaExcelTemp-new.xls;//加载excel模板using (FileStream fs new FileStream(excelTempPath, FileMode.Open, FileAccess.Read)){//XSSFWorkbook 适用XLSX格式HSSFWorkbook 适用XLS格式workbook new HSSFWorkbook(fs);}ISheet sheet workbook.GetSheetAt(0);sheet.GetRow(7).GetCell(1).SetCellValue(model.QuotationOrder.QuotedOn.ToString(yyyy-MM-dd));sheet.GetRow(7).GetCell(6).SetCellValue(model.QuotationOrder.Number);sheet.GetRow(7).GetCell(9).SetCellValue(model.QuotationOrder.CustomerPurchaseNumber);//甲方sheet.GetRow(8).GetCell(1).SetCellValue(model.QuotationOrder.Buyer.Company.Name);sheet.GetRow(9).GetCell(1).SetCellValue(model.QuotationOrder.Buyer.Name);sheet.GetRow(10).GetCell(1).SetCellValue(model.QuotationOrder.Buyer.Email);sheet.GetRow(11).GetCell(1).SetCellValue(model.QuotationOrder.Receiver.Mobile);sheet.GetRow(12).GetCell(1).SetCellValue(model.QuotationOrder.Receiver.Address);//乙方sheet.GetRow(8).GetCell(8).SetCellValue(XXXXX有限公司);ICellStyle cstyle workbook.CreateCellStyle();cstyle.Alignment HorizontalAlignment.Left;sheet.GetRow(8).GetCell(8).CellStyle cstyle;sheet.GetRow(9).GetCell(8).SetCellValue(model.QuotationOrder.SalesmanName);sheet.GetRow(9).GetCell(8).CellStyle cstyle;sheet.GetRow(10).GetCell(8).SetCellValue(model.QuotationOrder.Salesman.Mobile);sheet.GetRow(10).GetCell(8).CellStyle cstyle;sheet.GetRow(11).GetCell(8).SetCellValue(model.QuotationOrder.Salesman.Email);sheet.GetRow(11).GetCell(8).CellStyle cstyle;int count model.QuotationItems.Count;for (int i 0; i count; i){//设置列头的单元格样式HSSFCellStyle cellStyle workbook.CreateCellStyle() as HSSFCellStyle;IRow row sheet.CopyRow(1, 15 i);ICell cell row.CreateCell(0);cell.SetCellValue((i 1));ICellStyle style1 SetCellStyle((HSSFWorkbook)workbook, HorizontalAlignment.Left);cell.CellStyle style1;cell row.CreateCell(1);cell.SetCellValue(model.QuotationItems[i].Product.Name);cell.CellStyle style1;cell row.CreateCell(2);cell.CellStyle style1;//合并单元格CellRangeAddress region new CellRangeAddress(15 i, 15 i, 1, 2);sheet.AddMergedRegion(region);cell row.CreateCell(3);cell.CellStyle style1;cell.SetCellValue(model.QuotationItems[i].CustomCode);cell row.CreateCell(4);cell.CellStyle style1;cell.SetCellValue(model.QuotationItems[i].Product.Code);cell row.CreateCell(5);cell.CellStyle style1;cell.SetCellValue(PCS);cell row.CreateCell(6);cell.CellStyle style1;cell.SetCellValue(model.QuotationItems[i].Quantity);cell row.CreateCell(7);cell.CellStyle style1;cell.SetCellValue(model.QuotationItems[i].Quotation.DispatchDays 0 ? ((int)model.QuotationItems[i].Quotation.DispatchDays).ToString() : );cell row.CreateCell(8);cell.CellStyle style1;cell.SetCellValue(model.QuotationItems[i].Quotation.UnitPriceWithTax 0 ? ((decimal)model.QuotationItems[i].Quotation.UnitPriceWithTax).ToString(f2) : );cell row.CreateCell(9);cell.CellStyle style1;cell.SetCellValue(model.QuotationItems[i].Quotation.SubtotalWithTax.ToString(f2));cell row.CreateCell(10);cell.CellStyle style1;cell.SetCellValue(model.QuotationItems[i].Remark);}sheet.GetRow(15 count).GetCell(1).SetCellValue(model.QuotationOrder.Shipping.Amount.ToString(f2));sheet.GetRow(15 count).GetCell(4).SetCellValue(model.QuotationOrder.TotalWithTax.ToString(f2));sheet.GetRow(15 count).GetCell(7).SetCellValue(model.QuotationOrder.TotalWithTaxInChinese);sheet.GetRow(20 count).GetCell(2).SetCellValue(model.Payment);return workbook;}3、设置表格样式 /// summary/// 给Excel添加边框/// /summaryprivate ICellStyle SetCellStyle(HSSFWorkbook hssfworkbook, HorizontalAlignment ha){ICellStyle cellstyle hssfworkbook.CreateCellStyle();cellstyle.Alignment ha;//有边框cellstyle.BorderBottom BorderStyle.Thin;cellstyle.BorderLeft BorderStyle.Thin;cellstyle.BorderRight BorderStyle.Thin;cellstyle.BorderTop BorderStyle.Thin;return cellstyle;}4、excel加载图片 HSSFPatriarch patriarch (HSSFPatriarch)sheet.DrawingPatriarch;HSSFClientAnchor anchor new HSSFClientAnchor(10, 10, 0, 60, 7, 26 count, 11, 38 count);HSSFPicture picture (HSSFPicture)patriarch.CreatePicture(anchor, LoadImage(tempDirPath 1.png, (HSSFWorkbook)workbook));LoadImage 方法 private int LoadImage(string path, HSSFWorkbook wb){FileStream file new FileStream(path, FileMode.Open, FileAccess.Read);byte[] buffer new byte[file.Length];file.Read(buffer, 0, (int)file.Length);return wb.AddPicture(buffer, PictureType.PNG);}5、导出excel var stream new MemoryStream(); var work ExportExcel(printQuotationOrderViewModel);work.Write(stream);//mvc代码return File(stream.GetBuffer(), application/vnd.ms-excel, quotedOrderModel.Number .xls);
http://www.pierceye.com/news/105137/

相关文章:

  • 网站建设 宜宾湖州网站建设培训教程
  • 网站建设脚本什么叫营销型网站
  • 沧州网站建设专业的公司4000-262-seo优化与品牌官网定制
  • 网页游戏推广网站怎么做如何创建平台类网站
  • 十堰英文网站建设学校教育网站模板
  • 学校网页网站模板免费下载微信的微网站
  • 网站开发的解决方案小型行业网站建设维护成本
  • 浏阳市网站建设百度中心人工电话号码
  • 高端外贸网站制作智慧团建网站没有验证码
  • 做网站需要买服务器么网站建设营销外包公司排名
  • 网站建设中要多使用图片258网站建设
  • 做多语言网站教程开网页慢是什么原因
  • 汽车商城网站模板seo公司网站推广
  • 网站备案查询工信部官网网站建设费用推荐网络专业
  • 网站开发费用是研发费用国内做seo最好公司
  • 什么是网站建设公司企业网站后台管理
  • 做网站阿里巴巴好还是百度好柠檬网络科技网站建设
  • 做个网站要多少钱网站建设工作 方案
  • 一个主体如何添加网站室内设计公司的名字
  • 中国建设学会网站洛阳市住房和城乡建设局网站
  • 北京网站优化方式做物流的网站都有什么风险
  • 零基础学做网站页怎么部署wordpress
  • 网站如何做死链接提交筑站网络推广
  • 小说网站开发php网站后台如何修改文字
  • 网站制作是那个带有客户案例的网站
  • 中国纪检监察报数字报湛江关键词优化平台
  • 网站品牌词如何优化东莞公司网站建设营销型网站建设
  • 鞍山网站建设营销想把自己做的网站放到网上
  • 松原公司做网站青岛工程建设管理信息网官方网站
  • 一个空间2个网站网站 手机 app