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

能打开网站的浏览器莱芜网站推广

能打开网站的浏览器,莱芜网站推广,网站建设公司的方案模板,企业建设门户网站的目的WeihanLi.Npoi 1.21.0 ReleasedIntroWeihanLi.Npoi 是一个基于 netstandard2.0 的一个 NPOI 扩展库#xff0c;主要用于导入导出 Excel 以及 CSV#xff0c;支持通过 Fluent API 的方式来支持非常灵活的导入导出配置#xff0c;详细使用可以参考文档介绍以及项目示例 https:… WeihanLi.Npoi 1.21.0 ReleasedIntroWeihanLi.Npoi 是一个基于 netstandard2.0 的一个 NPOI 扩展库主要用于导入导出 Excel 以及 CSV支持通过 Fluent API 的方式来支持非常灵活的导入导出配置详细使用可以参考文档介绍以及项目示例 https://github.com/WeihanLi/WeihanLi.NpoiNew Features本次引入的新功能是针对 DataTable 的优化如果导入的 Excel 出现了重复列原来会直接抛出一个 System.Data.DuplicateNameException主要是因为原来是直接用 excel 列名称作为 DataColumn 的 Name而一个 DataTable 中是不允许有名字重复 Column 的就像数据库同一个表中不允许出现重复列名一样。可以参考 Issue https://github.com/WeihanLi/WeihanLi.Npoi/issues/125而导入 excel 时很多时候可能并不根据列名称去读取对应的值有时候会直接使用列索引来读取列的值这个场景下即使 excel 列名冲突了也关系不大我们只需要按照索引读取就可以了所以就考虑了支持冲突的读取因为想再导出的时候 excel 还和之前导入的时候保持一致所以也增加了导出的时候对 DataTable 的处理实现效果可以参考单元测试// Csv [Fact] public void DuplicateColumnTest() {var csvText  $A,B,C,A,B,C{Environment.NewLine}1,2,3,4,5,6;var dataTable  CsvHelper.ToDataTable(csvText.GetBytes());Assert.Equal(6, dataTable.Columns.Count);Assert.Equal(1, dataTable.Rows.Count);var newCsvText  CsvHelper.GetCsvText(dataTable);Assert.StartsWith(A,B,C,A,B,C, newCsvText);var newDataTable  CsvHelper.ToDataTable(newCsvText.GetBytes());Assert.Equal(dataTable.Columns.Count, newDataTable.Columns.Count);Assert.Equal(dataTable.Rows.Count, newDataTable.Rows.Count); } // Excel [Theory] [ExcelFormatData] public void DuplicateColumnTest(ExcelFormat excelFormat) {var workbook  ExcelHelper.PrepareWorkbook(excelFormat);var sheet  workbook.CreateSheet();var headerRow  sheet.CreateRow(0);headerRow.CreateCell(0).SetCellValue(A);headerRow.CreateCell(1).SetCellValue(B);headerRow.CreateCell(2).SetCellValue(C);headerRow.CreateCell(3).SetCellValue(A);headerRow.CreateCell(4).SetCellValue(B);headerRow.CreateCell(5).SetCellValue(C);var dataRow  sheet.CreateRow(1);dataRow.CreateCell(0).SetCellValue(1);dataRow.CreateCell(1).SetCellValue(2);dataRow.CreateCell(2).SetCellValue(3);dataRow.CreateCell(3).SetCellValue(4);dataRow.CreateCell(4).SetCellValue(5);dataRow.CreateCell(5).SetCellValue(6);var dataTable  sheet.ToDataTable();Assert.Equal(headerRow.Cells.Count, dataTable.Columns.Count);Assert.Equal(1, dataTable.Rows.Count);var newWorkbook  ExcelHelper.LoadExcel(dataTable.ToExcelBytes());var newSheet  newWorkbook.GetSheetAt(0);Assert.Equal(sheet.PhysicalNumberOfRows, newSheet.PhysicalNumberOfRows);for (var i  0; i  sheet.PhysicalNumberOfRows; i){Assert.Equal(sheet.GetRow(i).Cells.Count, newSheet.GetRow(i).Cells.Count);for (var j  0; j  headerRow.Cells.Count; j){Assert.Equal(sheet.GetRow(i).GetCell(j).GetCellValuestring(),newSheet.GetRow(i).GetCell(j).GetCellValuestring());}} }实现方式上一定程度参考了 issue 给出的建议导入时重复列会添加一个 duplicate 标识和一个唯一 id 使得名称不会重复从而不会引发异常导出时如果是重复列会把 duplicate 标识和唯一 id 去掉从而还原真实的列名称更多细节可以查看 Github 上的 PR https://github.com/WeihanLi/WeihanLi.Npoi/pull/126Bug Fixes修复了 sheet name 配置可能会不生效的 BUG本次更新修复了在导出成文件的时候 sheet name 的配置没有生效的一个 BUG详细可以参考 issue: https://github.com/WeihanLi/WeihanLi.Npoi/issues/127开始并没有重现这个 BUG因为只有在导出为文件的时候才会有问题如果是 bytes 或者 stream 是不会有这个问题的现在已经增加了下面的测试用例来覆盖这个情况[Theory] [ExcelFormatData] public void SheetNameTest_ToExcelFile(ExcelFormat excelFormat) {IReadOnlyListNotice list  Enumerable.Range(0, 10).Select(i  new Notice(){Id  i  1,Content  $content_{i},Title  $title_{i},PublishedAt  DateTime.UtcNow.AddDays(-i),Publisher  $publisher_{i}}).ToArray();var settings  FluentSettings.ForNotice();lock (settings){settings.HasSheetSetting(s {s.SheetName  Test;});var filePath  ${Path.GetTempFileName()}.{excelFormat.ToString().ToLower()};list.ToExcelFile(filePath);var excel  ExcelHelper.LoadExcel(filePath);Assert.Equal(Test, excel.GetSheetAt(0).SheetName);settings.HasSheetSetting(s {s.SheetName  NoticeList;});}}[Theory] [ExcelFormatData] public void SheetNameTest_ToExcelBytes(ExcelFormat excelFormat) {IReadOnlyListNotice list  Enumerable.Range(0, 10).Select(i  new Notice(){Id  i  1,Content  $content_{i},Title  $title_{i},PublishedAt  DateTime.UtcNow.AddDays(-i),Publisher  $publisher_{i}}).ToArray();var settings  FluentSettings.ForNotice();lock (settings){settings.HasSheetSetting(s {s.SheetName  Test;});var excelBytes  list.ToExcelBytes(excelFormat);var excel  ExcelHelper.LoadExcel(excelBytes, excelFormat);Assert.Equal(Test, excel.GetSheetAt(0).SheetName);settings.HasSheetSetting(s {s.SheetName  NoticeList;});} }修复导出到文件 excel 文件格式不对的 BUG根据文件路径创建 excel workbook 的时候原来是有 BUG 的可能会导致文件格式不对原来没有先换取文件扩展名新版本中修复了这个 bug会先获取文件扩展名再判断文件格式- !excelPath.EqualsIgnoreCase(.xls)!Path.GetExtension(excelPath).EqualsIgnoreCase(.xls)More这个新版本中还有个针对 CsvHelper 的小优化主要是获取导出的 CSV 字符串时 includeHeader 参数变成了一个可选参数对于调用方来说可以调用会变得更简单一些默认值是 true默认会包含 headerpublic static string GetCsvText(this DataTable? dataTable, bool includeHeader  true); public static string GetCsvTextTEntity(this IEnumerableTEntity entities, bool includeHeader  true); 更多细节可以参考 PR 变更 https://github.com/WeihanLi/WeihanLi.Npoi/pull/130Referenceshttps://github.com/WeihanLi/WeihanLi.Npoihttps://github.com/WeihanLi/WeihanLi.Npoi/pull/130https://www.nuget.org/packages/WeihanLi.Npoi/1.21.0https://github.com/WeihanLi/WeihanLi.Npoi/tree/1.21.0
http://www.huolong8.cn/news/185595/

相关文章:

  • 好的h5网站模板什么源码做有趣的网站
  • 做文案应该关注的网站推荐进度跟踪网站开发
  • 网络营销推广步骤网站页面优化包括
  • 做视频网站需要多少钱计算机网页设计与制作教程
  • 一站式服务广告语wordpress totalpoll
  • 庆阳市西峰区做网站合肥网站建
  • 建设机械网站咨询手机淘宝客网站怎么做的
  • 网站 建立目录出错包装回收网站建设
  • 个人外贸网站制作网站建设专家北京注安
  • 网站备案流程欧亚专线单号查询
  • 做微信请帖网站什么是网络营销?网络营销与电子商务有什么区别?
  • 电商网站开发工程师蚌埠做网站有哪些公司
  • 电影网站html源码wordpress页面加上html
  • 兰州网站建设慕枫品牌建设规划制定及实施情况
  • 追星做网站海南注册公司流程和费用
  • 点读软件网站建设怎么建设手机端网站
  • 网站制作前需要进行规划设计wordpress多媒体上传
  • 云南网站定制开发手机网站用什么软件开发
  • 南京哪公司建设网站如何降低网站相似度
  • 淘宝网站开发选什么类目热e国产-网站正在建设中-手机版
  • 平台网站建设外包费用ui设计方向网站建设目标
  • 腾宁科技做网站399元全包网站域名攻击
  • 网站优化公司seo案例兰州易天网站建设公司有哪些?
  • 学做面包到什么网站重庆建设工程信息网官网首页
  • 做外汇都要看什么网站福州企业网站
  • 广告网站留电话整人view主题WordPress
  • 海城seo网站排名优化推广网件路由器无线桥接
  • 怎样才能做一个优质的外贸网站wordpress登录后台空白
  • 南京有制作网站的吗怎么开发自己的网站
  • 网站建设的需求方案wordpress注册页面404