有没有人有.Net Excel IO组件基准?

我需要从.Net访问Excel工作簿。 我知道所有关于这样做的不同方式(我把它们写在博客文章中 ),我知道使用本地.Net组件将是最快的。 但问题是,哪些组件胜出? 有人以他们为基准吗? 我一直在使用Syncfusion XlsIO,但是对于某些关键操作(例如删除包含数千个命名范围的工作簿中的行),速度非常慢。

我没有做任何适当的基准,但我尝试了其他几个组件,发现SpreadsheetGear比我之前使用的XlsIO快得多。 我在这篇文章中写了一些我的发现

不能帮助你原来的问题,但你知道你可以使用OleDbConnection访问Excel文件,因此将其视为数据库? 然后,您可以将工作表读取到DataTable中,对应用程序中的数据执行所需的所有更改,然后使用OleDbConnection将其全部保存回文件中。

是的,但是我不打算把它们都出于礼节给Syncfusion(他们要求你不要发布基准),因为我不是一个经验丰富的testing人员,所以我的testing可能有些缺陷,但主要是因为你真正的基准testing谁赢得了多less,以及多less的巨大差异。

我拿了他们的“性能”示例之一,并在EPPlus中添加了相同的例程来比较它们。 XLSIO大约快15%,插入方式简单,取决于行/列比(我试了几次),内存使用看起来非常相似。 当我添加一个例程,所有的行被添加后,每10行删除,然后插入一个新的行2行 – 在这种情况下,XLSIO显着较慢。

一个通用的基准对你来说是非常无用的。 您需要在您使用的特定场景中互相尝试。

我一直在使用EPPlus几年,performance一直很好,我不记得大声嚷嚷。

更值得您考虑的是function,支持(根据我的经验,Syncfusion已经很好),文档,访问源代码(如果重要的话) – 重要的是 – API对您有多大的意义,语法可以是很不一样。 例如。 命名样式

XLSIO

headerStyle.BeginUpdate(); workbook.SetPaletteColor(8, System.Drawing.Color.FromArgb(255, 174, 33)); headerStyle.Color = System.Drawing.Color.FromArgb(255, 174, 33); headerStyle.Font.Bold = true; headerStyle.Borders[ExcelBordersIndex.EdgeLeft] .LineStyle = ExcelLineStyle.Thin; headerStyle.Borders[ExcelBordersIndex.EdgeRight] .LineStyle = ExcelLineStyle.Thin; headerStyle.Borders[ExcelBordersIndex.EdgeTop] .LineStyle = ExcelLineStyle.Thin; headerStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin; headerStyle.EndUpdate(); 

EPPlus

 ExcelNamedStyleXml headerStyle = xlPackage.Workbook.Styles.CreateNamedStyle("HeaderStyle"); headerStyle.Style.Fill.PatternType = ExcelFillStyle.Solid; // <== needed or BackgroundColor throws an exception headerStyle.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(255, 174, 33)); headerStyle.Style.Font.Bold = true; headerStyle.Style.Border.Left.Style = ExcelBorderStyle.Thin; headerStyle.Style.Border.Right.Style = ExcelBorderStyle.Thin; headerStyle.Style.Border.Top.Style = ExcelBorderStyle.Thin; headerStyle.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;