Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Commented Unassigned: Exception after inserting columns [15010]

$
0
0
Applying this simple diff to the test project, on the beta and on the current HEAD (90cfd9a3a979) reading the column before and after inserting, causes this exception on trying to access the newly created column:
```
Test method EPPlusTest.WorkSheetTest.RunWorksheetTests threw exception:
System.Exception: ColumnMax can not span over existing column 1.
at OfficeOpenXml.ExcelColumn.set_ColumnMax(Int32 value) in ExcelColumn.cs: line 90
at OfficeOpenXml.ExcelWorksheet.CopyColumn(ExcelColumn c, Int32 col, Int32 maxCol) in ExcelWorksheet.cs: line 1499
at OfficeOpenXml.ExcelWorksheet.Column(Int32 col) in ExcelWorksheet.cs: line 1466
at EPPlusTest.WorkSheetTest.InsertDeleteTestColumns() in WorkSheet.cs: line 421
at EPPlusTest.WorkSheetTest.RunWorksheetTests() in WorkSheet.cs: line 26
```

```
diff --git a/EPPlusTest/WorkSheet.cs b/EPPlusTest/WorkSheet.cs
index 5fb4938..2eec6c8 100644
--- a/EPPlusTest/WorkSheet.cs
+++ b/EPPlusTest/WorkSheet.cs
@@ -411,8 +411,15 @@ public void InsertDeleteTestColumns()
Assert.AreEqual(((object[,])ws.Cells["A1:C5"].Value)[1, 1], 1);
ws.Cells["A1:B3"].Merge = true;
ws.Cells["D3"].Formula = "A2+C5";
+
+ // Read column one before inserting
+ var colOriginal = ws.Column(1);
+
ws.InsertColumn(1, 1);

+ // Access the new column 1
+ var colNew = ws.Column(1);
+
ws.Cells["K10:M15"].Value = 1;
ws.Cells["K11:L13"].Merge = true;
ws.DeleteColumn(12, 1);
```


I've hit this in a production project so any intermediate advice to tweak it would be greatly welcomed!
Comments: Seems like it might be a duplicate of https://epplus.codeplex.com/workitem/14977

Viewing all articles
Browse latest Browse all 2262

Trending Articles



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