Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Issue while copying worksheets

$
0
0
I apologize. Indeed the worksheet does not exist.
I ran the sample code by cooper360 and the exception appears to take place in ClosedXml.Excel.XLRowsCollection.Add().
It also throws the exception when trying to copy to a brand new empty workbook.
It's interesting that it fails on the XLRowsCollection.Add() and not in the XLWorksheetsCollection.Add().

Here is the stack trace:
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary
2.Add(TKey key, TValue value)
at ClosedXML.Excel.XLRowsCollection.Add(Int32 key, XLRow value)
at ClosedXML.Excel.XLWorksheet.<>c__DisplayClass3d.<CopyTo>b__39(KeyValuePair2 kp)
at ClosedXML.Excel.EnumerableExtensions.ForEach[T](IEnumerable
1 source, Action`1 action)
at ClosedXML.Excel.XLWorksheet.CopyTo(XLWorkbook workbook, String newSheetName, Int32 position)
at ClosedXML.Excel.XLWorksheet.CopyTo(XLWorkbook workbook, String newSheetName)
at ClosedXML_Test.Form2.button1_Click(Object sender, EventArgs e) in C:\Users\rtanenbaum\Documents\Downloads\ClosedXML_TestCopyTo\Form2.cs:line 33

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>