当前位置: 首页 > 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://wiki.neutronadmin.com/news/185595/

相关文章:

  • 做网站好的网站建设公司排名网站静态和伪静态意思
  • 做影视网站有什么风险大学生网站建设与网页设计报告
  • 高端网站开发程资讯网站的好处
  • 如何建设内部网站顺德做网站
  • 哈尔滨营销型网站制作什么网站可以找手工活做
  • wordpress建站全教程无锡网站制作价格
  • 武进建设局网站为何老是打不开网站做锚点
  • 石家庄 外贸网站建设公司排名网络营销包括哪些策略
  • 房产中介 网站模板石家庄专业网站设计电话
  • 精品课程网站建设开题报告重庆最有效的网站推广
  • 韩都衣舍网站建设方案网站开发的初始密码
  • 模板网站的缺点建网站需要有啥能力
  • 一个网站是如何知道是谁来访问青岛网站推广外包
  • 江门网页建站模板汉口江岸区城市建设局网站
  • 网站用户投稿怎么做各类网站网站建设的目标是什么意思
  • 网站手机版后台wordpress 后台 慢
  • 做面膜的网站烟台网页公司联系方式
  • 网站建设app开发学习智慧工业园区建设方案
  • 网站开发文档word网页设计的特点有哪些
  • 做网站的怎么学建设电商网站需要什么硬件
  • 欢迎进入河南国安建设集团有限公司网站编辑图片的软件
  • 杭州企业网站设计网站pv uv统计
  • 深圳正规做网站的公司一级a做爰片 A视频网站
  • 网站建站建设费用如何做一元购物网站
  • 宁波做网站排名的公司有哪些企业注册公司流程
  • 景安做网站教程天津制作网站公司推荐
  • 高端上海网站设计公司北京优化服务
  • 搭建网站团队计划怀化网站优化哪个好
  • 网站被黑怎么恢复安徽工程建设网
  • 专业网站设计的公司价格网页设计与制作课程代码