nissl-lab / npoi

a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop.
Apache License 2.0
5.74k stars 1.43k forks source link

在NET5.0中使用ISheet.CopyTo,当参数keepFormulas=true时出错 #525

Closed ogi-sy closed 3 years ago

ogi-sy commented 3 years ago

NPOI版本:2.5.2 Message:Value cannot be null. (Parameter 'stream') Arg_ParamName_Name


at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen) at System.IO.StreamReader..ctor(Stream stream) at NPOI.SS.Formula.Function.FunctionMetadataReader.CreateRegistry() at NPOI.SS.Formula.Function.FunctionMetadataRegistry.GetInstance() at NPOI.SS.Formula.Function.FunctionMetadataRegistry.GetFunctionByName(String name) at NPOI.SS.Formula.FormulaParser.IsValidCellReference(String str) at NPOI.SS.Formula.FormulaParser.ParseSimpleRangePart() at NPOI.SS.Formula.FormulaParser.ParseRangeable() at NPOI.SS.Formula.FormulaParser.ParseRangeExpression() at NPOI.SS.Formula.FormulaParser.ParseSimpleFactor() at NPOI.SS.Formula.FormulaParser.PercentFactor() at NPOI.SS.Formula.FormulaParser.PowerFactor() at NPOI.SS.Formula.FormulaParser.Term() at NPOI.SS.Formula.FormulaParser.AdditiveExpression() at NPOI.SS.Formula.FormulaParser.ConcatExpression() at NPOI.SS.Formula.FormulaParser.ComparisonExpression() at NPOI.SS.Formula.FormulaParser.IntersectionExpression() at NPOI.SS.Formula.FormulaParser.UnionExpression() at NPOI.SS.Formula.FormulaParser.Parse() at NPOI.SS.Formula.FormulaParser.Parse(String formula, IFormulaParsingWorkbook workbook, FormulaType formulaType, Int32 sheetIndex, Int32 rowIndex) at NPOI.XSSF.UserModel.XSSFCell.SetFormula(String formula, FormulaType formulaType) at NPOI.XSSF.UserModel.XSSFCell.SetCellFormula(String formula) at NPOI.XSSF.UserModel.XSSFCell.set_CellFormula(String value) at NPOI.XSSF.UserModel.XSSFSheet.CopyCell(ICell oldCell, ICell newCell, IDictionary2 styleMap, Boolean keepFormulas) at NPOI.XSSF.UserModel.XSSFSheet.CopyRow(XSSFSheet srcSheet, XSSFSheet destSheet, XSSFRow srcRow, XSSFRow destRow, IDictionary2 styleMap, Boolean keepFormulas) at NPOI.XSSF.UserModel.XSSFSheet.CopyTo(IWorkbook dest, String name, Boolean copyStyle, Boolean keepFormulas) at GinBow.SourceFactory.TableToExcel.btnCopySheet_Click(Object sender, EventArgs e) in D:\Develop\Src\Cs\L2Soft\GinBow\GinBow.SourceFactory\TableToExcel.cs:line 45 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

b6g9 commented 3 years ago

Same problem, isn't it? https://github.com/nissl-lab/npoi/issues/535

tonyqus commented 3 years ago

Please rollback to 2.5.1. This is a known issue of 2.5.2.

tonyqus commented 3 years ago

duplicate with #517