Skip to content

Commit

Permalink
Last preparations for version 4.5.0.0-Beta. Fixed issue JanKallman#32.…
Browse files Browse the repository at this point in the history
… Added Multi-targeting project for .Net 3.5, Net 4.0 and .Net Core 2.0 and automatic nuget package build. Added new property for Compatibility.IsWorksheets1Based in ExcelPackage, so the Worksheets collection can be zero based as expected. This will be default in .Net Core. The property can be set from the app.config file or the appsettings.json in .Net Core.
  • Loading branch information
JanKallman committed Nov 10, 2017
1 parent 764842e commit e0eee21
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions EPPlusTest/WorkSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2900,6 +2900,7 @@ public void Comment()
pck.SaveAs(new FileInfo(_worksheetPath + "comment.xlsx"));

pck = new ExcelPackage(new FileInfo(_worksheetPath + "comment.xlsx"));
pck.Compatibility.IsWorksheets1Based = true;
var ws2 = pck.Workbook.Worksheets[1];
ws2.Cells[1, 2].AddComment("Testing", "test1");
pck.Save();
Expand All @@ -2910,12 +2911,14 @@ public void CommentShiftsWithRowInserts()
{
InitBase();
var pck = new ExcelPackage();
pck.Compatibility.IsWorksheets1Based = true;
var ws1 = pck.Workbook.Worksheets.Add("Comment1");
ws1.Cells[3, 3].AddComment("Testing comment 1", "test1");
ws1.Cells[4, 3].AddComment("Testing comment 2", "test2");
var fileInfo = new FileInfo(_worksheetPath + "comment.xlsx");
pck.SaveAs(fileInfo);
pck = new ExcelPackage(new FileInfo(_worksheetPath + "comment.xlsx"));
pck.Compatibility.IsWorksheets1Based = true;
ws1 = pck.Workbook.Worksheets[1];
// Ensure the comments were saved in the correct location.
Assert.AreEqual("Testing comment 1", ws1.Cells[3, 3].Comment.Text);
Expand All @@ -2930,6 +2933,7 @@ public void CommentShiftsWithRowInserts()
Assert.AreEqual("test2", ws1.Cells[8, 3].Comment.Author);
pck.Save();
pck = new ExcelPackage(new FileInfo(_worksheetPath + "comment.xlsx"));
pck.Compatibility.IsWorksheets1Based = true;
ws1 = pck.Workbook.Worksheets[1];
// Ensure the shifted index is preserved.
Assert.AreEqual("Testing comment 1", ws1.Cells[3, 3].Comment.Text);
Expand All @@ -2943,12 +2947,14 @@ public void CommentShiftsWithColumnInserts()
{
InitBase();
var pck = new ExcelPackage();
pck.Compatibility.IsWorksheets1Based = true;
var ws1 = pck.Workbook.Worksheets.Add("Comment1");
ws1.Cells[3, 3].AddComment("Testing comment 1", "test1");
ws1.Cells[3, 4].AddComment("Testing comment 2", "test2");
var fileInfo = new FileInfo(_worksheetPath + "comment.xlsx");
pck.SaveAs(fileInfo);
pck = new ExcelPackage(new FileInfo(_worksheetPath + "comment.xlsx"));
pck.Compatibility.IsWorksheets1Based = true;
ws1 = pck.Workbook.Worksheets[1];
// Ensure the comments were saved in the correct location.
Assert.AreEqual("Testing comment 1", ws1.Cells[3, 3].Comment.Text);
Expand All @@ -2963,6 +2969,7 @@ public void CommentShiftsWithColumnInserts()
Assert.AreEqual("test2", ws1.Cells[3, 8].Comment.Author);
pck.Save();
pck = new ExcelPackage(new FileInfo(_worksheetPath + "comment.xlsx"));
pck.Compatibility.IsWorksheets1Based = true;
ws1 = pck.Workbook.Worksheets[1];
// Ensure the shifted index is preserved.
Assert.AreEqual("Testing comment 1", ws1.Cells[3, 3].Comment.Text);
Expand Down

0 comments on commit e0eee21

Please sign in to comment.