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

Created Unassigned: Not working correctly under PLINQ [15592]

$
0
0
I have implemented importer that use PLINQ to improve import.

var result = fileIds.AsParallel()
.Select(a => a.Guid)
.Select(GetUserFile)
//cannot use PLINQ anymore, because their are some
//static properties/fields that will be overwritten by each thread
.ToList()
.Select(ExtractData)
.SelectMany(a => a)
.Where(HasEntry)
.ToList();
Just want to mention this. The project is not maintaining anymore.

Created Unassigned: "_" replaced by " " from Header column [15593]

$
0
0
Hello,

We are using EPPlus for export excel, while we are doing this. We observed one issue.

we have column with underscore. when it create ExcelWorksheet it replace _ with space.
e.g.

public class table{
public guid RulesEngineRule_Id;
}
when we export it, we see _ is replace by space.

![Image](https://cloud.githubusercontent.com/assets/11921979/21923403/e6fb7c40-d999-11e6-94e1-c546e0f86d36.PNG)

Please check.

Edited Unassigned: "_" replaced by " " from Header column [15593]

$
0
0
Hello,

We are using EPPlus for export excel, while we are doing this. We observed one issue.

we have columns with underscore. when it create ExcelWorksheet it replace _ with space.
e.g.

public class table{
public guid RulesEngineRule_Id;
}

when we export it, we see _ is replace by space.

![Image](https://cloud.githubusercontent.com/assets/11921979/21923403/e6fb7c40-d999-11e6-94e1-c546e0f86d36.PNG)

Please check.

Created Unassigned: using Drawings.Remove("Picturename"); messes up worksheet object after all drawings are removed [15594]

$
0
0
I have a template sheet "template".template has 3 pictures.
I remove all drawings,then clone template as new sheet but deleting template fails.
Code:
string template_path="some path..of xlsx file"
System.IO.FileInfo fileinfo = new System.IO.FileInfo(template_path);
using(ExcelPackage package=new ExcelPackage(fileinfo)){
ExcelWorkbook workbook = package.Workbook;
ExcelWorksheet sheet = workbook.Worksheets["template"];
sheet.Cells["AB2"].Value=100;
sheet.Drawings.Remove("Picture1");
sheet.Drawings.Remove("Picture2");
sheet.Drawings.Remove("Picture3");
workbook.Worksheets["template"].Calculate();
workbook.Worksheets.Add("result",sheet);//clone sheet
workbook.Worksheets.MoveBefore("result","template");//move result before template
try{
package.Workbook.Worksheets.Delete(workbook.Worksheets["template"]);//delete template
}
catch(Exception e){Console.WriteLine(e.Message);}//throws message: "the given key was not present in the dictionary"
//..do something else with template file
//
System.IO.FileInfo fileinfo2 = new System.IO.FileInfo("asdasdas\folder\done.xlsx");
package.SaveAs(fileinfo2);
}//end using

//###
As a workaround I put another dummy white square picture as "Picture4" and the code works. It seems something goes wrong when all Drawings in the worksheet is deleted.


Created Unassigned: xlToRight [15595]

$
0
0
How can I use xlToRight with epplus?

Commented Unassigned: Inserting rows or columns does not update cross-sheet references. [15452]

$
0
0
When rows or columns are inserted, only references on the sheet being modified are updated. References from other sheets should also be updated when rows or columns are inserted. I have attached a simple test case:
```
[TestMethod]
public void CrossSheetInsertRowsUpdatesReferencesCorrectly()
{
using (var package = new ExcelPackage())
{
var sheet1 = package.Workbook.Worksheets.Add("Sheet1");
var sheet2 = package.Workbook.Worksheets.Add("Sheet2");
sheet1.Cells[2, 2].Formula = "Sheet2!C3";
sheet2.Cells[3, 3].Value = "Hello, world!";
package.Workbook.Calculate();
Assert.AreEqual("Hello, world!", sheet1.Cells[2, 2].Value);
sheet2.InsertRow(3, 10);
package.Workbook.Calculate();
Assert.AreEqual("Hello, world!", sheet2.Cells[13, 3].Value);
Assert.AreEqual("'Sheet2'!C13", sheet1.Cells[2, 2].Formula, true);
Assert.AreEqual("Hello, world!", sheet1.Cells[2, 2].Value);
}
}
```
I am working on a fix at the branch [here](https://epplus.codeplex.com/SourceControl/network/forks/emdelaney/UpdateCrossSheetReferencesOnInsert).
Comments: Good day, I'm having the same issue. I want to know how did you resolve it. Regards, Bibujakera

Commented Unassigned: Renaming a sheet does not update cross-sheet references (sample code + steps to reproduce) [15333]

$
0
0
Renaming a worksheet does not appear to update cell references to the renamed sheet.

In the code below (a modified version of the "Sample 1" EPPlus sample code), the reference in cell ```C4``` to ``` Inventory!C2 ``` does not get updated to ``` 'Sheet 1'!C2 ``` when the ```Inventory``` sheet is renamed to ```Sheet 1```, resulting in an undesired ``` #REF! ``` error.

Steps to reproduce:
1. Download the latest version of EPPlus.
1. Replace the RunSample1 method in SampleApp\Sample1.cs with the following RunSample1 method:
```
/// <summary>
/// Modified version of "Sample 1" that demonstrates an error
/// with cross-sheet references and sheet renaming.
/// </summary>
public static string RunSample1(DirectoryInfo outputDir)
{
FileInfo newFile = new FileInfo(outputDir.FullName + @"\sheetRenameBugReproduction.xlsx");
if (newFile.Exists)
{
newFile.Delete(); // ensures we create a new workbook
newFile = new FileInfo(outputDir.FullName + @"\sheetRenameBugReproduction.xlsx");
}
using (ExcelPackage package = new ExcelPackage(newFile))
{
OfficeOpenXml.ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Inventory");
// Add some text to cell C1.
worksheet.Cells[2, 3].Value = "Hello World!";
// Cell references without a sheet specified still work as expected.
worksheet.Cells[3, 3].Formula = "C2";
// BUG: Cells that reference a specific sheet have a value of #REF! after
// the referenced sheet is renamed.
worksheet.Cells[4, 3].Formula = "Inventory!C2";
// Cell references that are manually updated to the correct sheet work correctly.
worksheet.Cells[5, 3].Formula = @"'Sheet 1'!C2";
// Rename sheet "Inventory" to "Sheet 1".
worksheet.Name = "Sheet 1";

// Add some descriptive text to the workbook
worksheet.Cells[2, 4].Value = "Raw Text";
worksheet.Cells[3, 4].Value = "Local Reference, Sheet Unspecified";
worksheet.Cells[4, 4].Value = "Local Reference, Sheet Specified Before Rename";
worksheet.Cells[5, 4].Value = "Local Reference, Sheet Specified After Rename";
package.Save();
}
return newFile.FullName;
}
```
1. Configure the EPPlusSamples project to save files to a valid directory by updating the ```outputDir``` variable in the ``` Main ``` method of Sample_Main.cs to an existing directory.
1. Build and run the EPPlusSamples project.
1. Open the ```sheetRenameBugReproduction.xlsx``` file that is generated.
1. Observe that cell C4 possesses a ```#REF!``` value.
* Cell C4 should possess a value of "Hello World!".
Comments: Good day, Is there a solution for this issue yet? Regards, Bibujakera

Commented Unassigned: Renaming a sheet does not update cross-sheet references (sample code + steps to reproduce) [15333]

$
0
0
Renaming a worksheet does not appear to update cell references to the renamed sheet.

In the code below (a modified version of the "Sample 1" EPPlus sample code), the reference in cell ```C4``` to ``` Inventory!C2 ``` does not get updated to ``` 'Sheet 1'!C2 ``` when the ```Inventory``` sheet is renamed to ```Sheet 1```, resulting in an undesired ``` #REF! ``` error.

Steps to reproduce:
1. Download the latest version of EPPlus.
1. Replace the RunSample1 method in SampleApp\Sample1.cs with the following RunSample1 method:
```
/// <summary>
/// Modified version of "Sample 1" that demonstrates an error
/// with cross-sheet references and sheet renaming.
/// </summary>
public static string RunSample1(DirectoryInfo outputDir)
{
FileInfo newFile = new FileInfo(outputDir.FullName + @"\sheetRenameBugReproduction.xlsx");
if (newFile.Exists)
{
newFile.Delete(); // ensures we create a new workbook
newFile = new FileInfo(outputDir.FullName + @"\sheetRenameBugReproduction.xlsx");
}
using (ExcelPackage package = new ExcelPackage(newFile))
{
OfficeOpenXml.ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Inventory");
// Add some text to cell C1.
worksheet.Cells[2, 3].Value = "Hello World!";
// Cell references without a sheet specified still work as expected.
worksheet.Cells[3, 3].Formula = "C2";
// BUG: Cells that reference a specific sheet have a value of #REF! after
// the referenced sheet is renamed.
worksheet.Cells[4, 3].Formula = "Inventory!C2";
// Cell references that are manually updated to the correct sheet work correctly.
worksheet.Cells[5, 3].Formula = @"'Sheet 1'!C2";
// Rename sheet "Inventory" to "Sheet 1".
worksheet.Name = "Sheet 1";

// Add some descriptive text to the workbook
worksheet.Cells[2, 4].Value = "Raw Text";
worksheet.Cells[3, 4].Value = "Local Reference, Sheet Unspecified";
worksheet.Cells[4, 4].Value = "Local Reference, Sheet Specified Before Rename";
worksheet.Cells[5, 4].Value = "Local Reference, Sheet Specified After Rename";
package.Save();
}
return newFile.FullName;
}
```
1. Configure the EPPlusSamples project to save files to a valid directory by updating the ```outputDir``` variable in the ``` Main ``` method of Sample_Main.cs to an existing directory.
1. Build and run the EPPlusSamples project.
1. Open the ```sheetRenameBugReproduction.xlsx``` file that is generated.
1. Observe that cell C4 possesses a ```#REF!``` value.
* Cell C4 should possess a value of "Hello World!".
Comments: Good day, Is there a solution for this issue yet?

Created Unassigned: Some source code leaks into cell`s value during calculations [15596]

$
0
0
Hi, I'm trying to process the CSV file by loading it's data into the EpplusPackage's worksheet and calculating it. In a few result files I get the strange source code in the values of the cell`s like such one: "OfficeOpenXml.FormulaParsing.EpplusExcelDataProvider+RangeInfo/Sneaker"
instead of
"Damen/Sneaker"
when using the formula
"IF(INDIRECT("Sheet2!A"&ROW()-ROW(C$2)+2)="","",INDIRECT("Sheet2!AC"&ROW()-ROW(C$2)+2)&"/"&INDIRECT("Sheet2!S"&ROW()-ROW(C$2)+2))"
or this one
"OfficeOpenXml.FormulaParsing.EpplusExcelDataProvider+RangeInfo/Clothing & Accessories -> Clothing Accessories -> Bags"
instead of
"Female/Clothing & Accessories -> Clothing Accessories -> Bags"
for formula
"=INDIRECT("Sheet2!BT"&ROW()-ROW(C$2)+2)&"/"&LEFT(INDIRECT("Sheet2!F"&ROW()-ROW(C$2)+2),FIND("^",SUBSTITUTE(INDIRECT("Sheet2!F"&ROW()-ROW(C$2)+2)&">>>",">","^",3))-1)"
Do you need any additional info for finding the reason of this bug?
P.S. Thank you for your work. :)

Created Unassigned: EPPlus IIS Application Pool Identity: NetworkService [15597]

$
0
0
** Security Issue **

When the IIS Application Pool Identity is set to NetworkService, EPPlus 4.1 throws System.IO.IsolatedStorageException: Unable to create mutex. (Exception from HRESULT: 0x80131464).

Unfortunately, running EPPlus under the Application Pool Identity of LocalSystem is not acceptable in a production environment because these days it is a bad security practice.

Please make this a priority. The following throws the error.

```
byte[] file = null;
FileStream fs = null;
MemoryStream ms = null;
ExcelPackage pck = null;
ExcelWorksheet ws = null;

try
{
using (ms = new MemoryStream())
{
using (fs = new FileStream("<your_file_path>", FileMode.Open, FileAccess.Read))
{
using (pck = new ExcelPackage(ms, fs))
{
ws = pck.Workbook.Worksheets[1];

for (int r = 0; r < Records.Rows.Count; r++)
{
for (int c = 0; c < Records.Columns.Count; c++)
{
string v = Convert.ToString(Records.Rows[r][c]);

ws.Cells[(r + 2), (c + 1)].Value = v;
}
}

file = pck.GetAsByteArray();
}
}
}
}
catch (Exception ex)
{
throw GetAllErrorMessages(ex);
}
finally
{
ms = null;
fs = null;
pck = null;
ws = null;
}

```

Edited Unassigned: EPPlus IIS Application Pool Identity: NetworkService [15597]

$
0
0
** Security Issue **

When the IIS Application Pool Identity is set to NetworkService, EPPlus 4.1 throws System.IO.IsolatedStorageException: Unable to create mutex. (Exception from HRESULT: 0x80131464).

Unfortunately, running EPPlus under the Application Pool Identity of LocalSystem is not acceptable in a production environment because these days it is a bad security practice.

Please make this a priority. The following throws the error.

```
byte[] file = null;
FileStream fs = null;
MemoryStream ms = null;
ExcelPackage pck = null;
ExcelWorksheet ws = null;

//Records is a System.Data.DataTable filled with data.

try
{
using (ms = new MemoryStream())
{
using (fs = new FileStream("<your_file_path>", FileMode.Open, FileAccess.Read))
{
using (pck = new ExcelPackage(ms, fs))
{
ws = pck.Workbook.Worksheets[1];

for (int r = 0; r < Records.Rows.Count; r++)
{
for (int c = 0; c < Records.Columns.Count; c++)
{
string v = Convert.ToString(Records.Rows[r][c]);

ws.Cells[(r + 2), (c + 1)].Value = v;
}
}

file = pck.GetAsByteArray();
}
}
}
}
catch (Exception ex)
{
throw GetAllErrorMessages(ex);
}
finally
{
ms = null;
fs = null;
pck = null;
ws = null;
}

```

Created Unassigned: Merged cells are not read from worksheet [15598]

$
0
0
I have a file where the merged cells were not being recognized in two of the worksheets.

It looks like EPPlus makes some assumptions about the order of the elements in order to quickly read through the worksheet XML. In this case, it assumes that a "colBreaks" element will not occur before the "mergeCells" element. However, if a custom view exists in the sheet, the "customSheetViews" element is added before the "mergeCells" element; since a "customSheetView" element can (will?) contain a "colBreaks" element, EPPlus prematurely exits the read loop and assumes that there are no merged cells in the sheet.

This file was last saved from Excel 2013, although the file was originally created in an earlier version of Excel.

Created Unassigned: Save as XLSB and XLS Format [15599]

$
0
0
Please add the option to save in XLSB and old XLS format.

Created Unassigned: Hide view ruler [15600]

$
0
0
Hi,

I'm able to hide the headers / gridlines (ws.View.ShowHeaders = false;), but I can't find a way to hide the ruler.
Is there a function that supports that?

Thanks !

Created Unassigned: System.Collections.Generic.KeyNotFoundException [15601]

$
0
0
We have found the issue "System.Collections.Generic.KeyNotFoundException" issue's solution.
This exception were thrown when someone try to upload blank value when email(hyperlink) is expected.

In EXCELWORKSHEET.CS Page Line = 1173

// original
if (xr.LocalName == "hyperlink")

// Modification
if (xr.LocalName == "hyperlink" && !string.IsNullOrEmpty(xr.Value))

the zip file is uploaded here with this issue.

Created Unassigned: Error saving when pivot table uses named range that has workbook scope [15602]

$
0
0
When I save a spreadsheet that has a pivot table that uses a named range that has workbook scope I get an error in ExcelWorksheet.savePivotTables().

```
var ws = Workbook.Worksheets[pt.CacheDefinition.SourceRange.WorkSheet];
```

pt.CacheDefinition.SourceRange.WorkSheet is null.

Pivot tables save fine if the named range has a worksheet scope. A work around is having to use multiple named ranges. The only issue is that Excel cannot cope with two named ranges that have exactly the same range.

Commented Unassigned: Save as XLSB and XLS Format [15599]

$
0
0
Please add the option to save in XLSB and old XLS format.
Comments: The .XLSX format has been the standard now for over 10 years, and this would be a MASSIVE undertaking that would only benefit a tiny number of people. If you need support for old binary formats, your best bet would be NPOI (https://npoi.codeplex.com/), or possibly ExcelLibrary (https://code.google.com/archive/p/excellibrary/). I've used NPOI before, it doesn't support as many features, but works well enough.

Created Unassigned: References damaged after save [15603]

$
0
0
Attached xlsx file is very simple. in Sheet1 there are two values (cell A2 = 1, cell A3 = 1). In Sheet2 there is a sum of referenced values ("=SUM(Sheet1!A2:Sheet1:A3"). After update via EPPlus, I have to read this xlsx using standard ADO.NET (OleDbConnection). after updating A2 and/or A3 in Sheet1, I get always "1" in Sheet2 sum. which is wrong. If I open this workbook in Excel, value of sum is correct, but - even if I don't change anything - Excel still insist on resaving this file (probably because knowing sum is outdated/invalid, it updated correct sum on load).

Is there any way to force full calculations (including formulas containing references to another worksheet) before save?

Regards,
Wojtek

Created Unassigned: Excel corrupts after open and save a xlsx document with a pivot table [15604]

$
0
0
When I open an existing .xlsx document with a pivot table and then save it, it courrupts.

It gives me error saying the file is corrupt. After repairing the file, Excel lists the following issues:
Removed Part: /xl/pivotTables/pivotTable1.xml part. (PivotTable view)
Removed Feature: PivotTable report from /xl/pivotCache/pivotCacheDefinition1.xml part (PivotTable cache)
Removed Records: Workbook properties from /xl/workbook.xml part (Workbook)

Here is the code. As you can see is just open and save it.

```
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.IO
Imports OfficeOpenXml
Imports System.Data.SqlClient
Imports OfficeOpenXml.Table.PivotTable
Imports System.Xml


Module Module1

Sub Main()

Try
Dim path As String = "C:\example.xlsx"

Dim package As ExcelPackage = New ExcelPackage(New FileInfo(path))



package.Save()
package.Dispose()


Catch ex As Exception


Console.WriteLine(ex.Message)
Console.Read()

End Try

End Sub


End Module
```

Even without doing a change to the document this happens to me.


Commented Unassigned: Excel corrupts after open and save a xlsx document with a pivot table [15604]

$
0
0
When I open an existing .xlsx document with a pivot table and then save it, it courrupts.

It gives me error saying the file is corrupt. After repairing the file, Excel lists the following issues:
Removed Part: /xl/pivotTables/pivotTable1.xml part. (PivotTable view)
Removed Feature: PivotTable report from /xl/pivotCache/pivotCacheDefinition1.xml part (PivotTable cache)
Removed Records: Workbook properties from /xl/workbook.xml part (Workbook)

Here is the code. As you can see is just open and save it.

```
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.IO
Imports OfficeOpenXml
Imports System.Data.SqlClient
Imports OfficeOpenXml.Table.PivotTable
Imports System.Xml


Module Module1

Sub Main()

Try
Dim path As String = "C:\example.xlsx"

Dim package As ExcelPackage = New ExcelPackage(New FileInfo(path))



package.Save()
package.Dispose()


Catch ex As Exception


Console.WriteLine(ex.Message)
Console.Read()

End Try

End Sub


End Module
```

Even without doing a change to the document this happens to me.


Comments: Hi there I have the same problem - any update on this? there's any workaround? Thanks Ricardo
Viewing all 2262 articles
Browse latest View live


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