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

Created Unassigned: 'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll [15615]

$
0
0
I am using EPPlus in VS to read in roughly 300+ excel files, each around 5-15MB. The output will be written to a single excel file.

Sometimes i get the error "'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll" when reading in/opening one of the excel files.

Sometimes i get the error when the code opens the output excel file.

Has anyone encountered this error:
"'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll"

and is there a quick fix?

Thank you.

Edited Unassigned: 'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll [15615]

$
0
0
I am using EPPlus in VS to read in roughly 300+ excel files, each around 5-15MB. The output will be written to a single excel file.

Sometimes i get the error "'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll" when reading in/opening one of the excel files.

Sometimes i get the error when the code opens the output excel file.

Has anyone encountered this error:
"'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll"

and is there a quick fix?

Thank you.

Edit: I currently get around this problem by creating a new excel file, and copying the contents of the excel data (from the excel file that causes the error) into the newly created file. I then delete the excel file that has the error and rename the newly created excel file to follow that of the original excel file.
But this approach is not ideal and i was hoping someone has a better solution.

Commented Unassigned: 'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll [15615]

$
0
0
I am using EPPlus in VS to read in roughly 300+ excel files, each around 5-15MB. The output will be written to a single excel file.

Sometimes i get the error "'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll" when reading in/opening one of the excel files.

Sometimes i get the error when the code opens the output excel file.

Has anyone encountered this error:
"'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll"

and is there a quick fix?

Thank you.

Edit: I currently get around this problem by creating a new excel file, and copying the contents of the excel data (from the excel file that causes the error) into the newly created file. I then delete the excel file that has the error and rename the newly created excel file to follow that of the original excel file.
But this approach is not ideal and i was hoping someone has a better solution.
Comments: Just to

Edited Unassigned: 'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll [15615]

$
0
0
I am using EPPlus in VS to read in roughly 300+ excel files, each around 5-15MB. The output will be written to a single excel file.

Sometimes i get the error "'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll" when reading in/opening one of the excel files.

Sometimes i get the error when the code opens the output excel file.
E.g. using (ExcelPackage package = new ExcelPackage(masterFile))

Has anyone encountered this error:
"'OfficeOpenXml.Packaging.Ionic.Zip.BadReadException' in EPPlus.dll"

and is there a quick fix?

Thank you.

Edit: I currently get around this problem by creating a new excel file, and copying the contents of the excel data (from the excel file that causes the error) into the newly created file. I then delete the excel file that has the error and rename the newly created excel file to follow that of the original excel file.
But this approach is not ideal and i was hoping someone has a better solution.

Created Unassigned: AutoFitColumns ignores content width of wrapped text [15616]

$
0
0
I am trying to programmatically insert values separated by newlines, then autofit the cell width to the longest value. In Excel 2007, this can be done by:

Type in: 1234567890(Alt-Enter)123456(Alt-Enter)7890
Set wrap-text to false
Format->AutoFit Column Width
Set wrap-text to true
Format->AutoFit Column Width

But with the code:

ws.Cells[1, 1].Value = "1234567890\n123456\n7890";
ws.Cells[1, 1].Style.WrapText = false;
ws.Cells[1, 1].AutoFitColumns();
ws.Cells[1, 1].Style.WrapText = true;
ws.Cells[1, 1].AutoFitColumns();

The last AutoFitColumns() shrinks the cell down to it's minimum width, no matter how long each string inside it is, wrapping strings incorrectly,. Without the call, the cell is as wide as it was with every string on the same line, which is what I'm stuck with at the moment.

Created Unassigned: Set value of certain cells causes the cell to blank [15617]

$
0
0
I have a excel spreadsheet template created in excel.
One of my cells has text in it like this "blah blah blah[blah_replacement] blah".
I'm able to see the text using EPP in my code correctly using the Text Property and the Value Property of the cell object.
I then use csharp to replace the blah_replacement string with a number. e.g. - "blah blah blah[95.0] blah".
Note there are no actual quotes in the cell that is just to represent the string.
Then i set this value back into the .Value property of my cell and the cell is blank.

If I go back to version 3.1.3 it works as before. I have no Tables in the work sheet its all pure cell values.
Please fix and list this as an issue that I can recognize as fixed, so I can update the library we use.
Thanks!

Edited Unassigned: Set value of certain cells causes the cell to blank [15617]

$
0
0
I have a excel spreadsheet template created in excel.
One of my cells has text in it like this "blah blah blah[blah_replacement] blah".
I'm able to see the text using EPP in my code correctly using the Text Property and the Value Property of the cell object.
I then use csharp to replace the blah_replacement string with a number. e.g. - "blah blah blah[95.0] blah".
Note there are no actual quotes in the cell that is just to represent the string.
Also Note it doesn't happen with all cells.
Then i set this value back into the .Value property of my cell and the cell is blank.

If I go back to version 3.1.3 it works as before. I have no Tables in the work sheet its all pure cell values.
Please fix and list this as an issue that I can recognize as fixed, so I can update the library we use.

Thanks!

Created Unassigned: Considering migrating away from CodePlex [15618]

$
0
0
CodePlex is about to be shut down.
Are you considering to migrate your projet to another platform (like GitHub) ?

Created Unassigned: Set cell value with named cell/range instead of coordinates [15619]

$
0
0
I would like to be able to set cell values with named cells/ranges instead of coordinates:

ws.Range("profits").Value = 66;

Also see
https://stackoverflow.com/questions/43910827/how-to-set-value-of-excel-cell-by-name-instead-of-using-coordinates-with-excelpa

Commented Unassigned: Set cell value with named cell/range instead of coordinates [15619]

$
0
0
I would like to be able to set cell values with named cells/ranges instead of coordinates:

ws.Range("profits").Value = 66;

Also see
https://stackoverflow.com/questions/43910827/how-to-set-value-of-excel-cell-by-name-instead-of-using-coordinates-with-excelpa
Comments: Found the solution: var profits = pck.Workbook.Names["profits"]; profits.Value = 66;

Edited Unassigned: [Solved]:Set cell value with named cell/range instead of coordinates [15619]

$
0
0
I would like to be able to set cell values with named cells/ranges instead of coordinates:

ws.Range("profits").Value = 66;

Also see
https://stackoverflow.com/questions/43910827/how-to-set-value-of-excel-cell-by-name-instead-of-using-coordinates-with-excelpa

Created Unassigned: Password protected documents [15620]

$
0
0
Hey guys!

First of all - great library!

Recently I had to create a password protected spreadsheet and right now I am just passing the password to the save method like this

package.Save("password");

which works as intended and when I am using MS Excel I enter my password and everything works fine.

My problem is that I can't open the password protected document from google drive.
I perform the following steps:
1. Generate the document using EPPlus - test.xlsx
2. Upload it to google drive.
3. Open the document.
4. Enter my password.
5. Google drive prompts an error message: There was a problem previewing this document.

After reading a bit on the subject I saw that google drive didn't used to support password protected files untill recently but now it seems like they do.

I tried to generate a new password protected file from MS Excel and when I upload it to google drive it opens successfuly after entering my password.

Is there a workaround or I should wait for a new version of the library?

Created Unassigned: InsertRow with Copy not worked with merged cells [15621]

$
0
0

There is row pattern B2:F2

Cell B2 = "Text"
Cell C2 = "Text"
Cell D2:E2 is merged = "Text"
Cell F2 = "Text"

If this is done without "method IinsertRow", it works correctly and the row template is copied as necessary (including merged cells )

```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\input.xlsx")))
{
// correct work
var ws = pkg.Workbook.Worksheets[1];
var pattern = ws.Cells["B2:F2"];
pattern.Copy(ws.Cells["B3:F3"]);
pattern.Copy(ws.Cells["B4:F4"]);
pattern.Copy(ws.Cells["B5:F5"]);
pkg.SaveAs(new FileInfo(@"c:\output.xlsx"));
}
```

```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\tmplcopy.xlsx")))
{
// not correct work
var ws = pkg.Workbook.Worksheets[1];
// add three rows
ws.InsertRow(2, 3);
// go to pattern row after insert
var pattern1 = ws.Cells["B5:F5"];
// all is good here
pattern1.Copy(ws.Cells["B2:F2"]);
pattern1.Copy(ws.Cells["B3:F3"]); // Exception: Can't delete merged cells. A range is partly merged with the deleted range. D5:E5
pkg.SaveAs(new FileInfo(@"c:\tmplcopy1.xlsx"));
}
```

Edited Unassigned: InsertRow with Copy not worked with merged cells [15621]

$
0
0

There is row pattern B2:F2

Cell B2 = "Text"
Cell C2 = "Text"
Cell D2:E2 is merged = "Text"
Cell F2 = "Text"

If this is done without "method IinsertRow", it works correctly and the row template is copied as necessary (including merged cells )

```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\input.xlsx")))
{
// correct work
var ws = pkg.Workbook.Worksheets[1];
var pattern = ws.Cells["B2:F2"];
pattern.Copy(ws.Cells["B3:F3"]);
pattern.Copy(ws.Cells["B4:F4"]);
pattern.Copy(ws.Cells["B5:F5"]);
pkg.SaveAs(new FileInfo(@"c:\output.xlsx"));
}
```

```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\tmplcopy.xlsx")))
{
// not correct work
var ws = pkg.Workbook.Worksheets[1];
// add three rows
ws.InsertRow(2, 3);
// go to pattern row after insert
var pattern1 = ws.Cells["B5:F5"];
// all is good here
pattern1.Copy(ws.Cells["B2:F2"]);
pattern1.Copy(ws.Cells["B3:F3"]); // Exception: Can't delete merged cells. A range is partly merged with the deleted range. D5:E5
pkg.SaveAs(new FileInfo(@"c:\tmplcopy1.xlsx"));
}
```

In this case (below), merged cells correct copied only in row= 2.
Why?


```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\input.xlsx")))
{
var ws = pkg.Workbook.Worksheets[1];
var startRow = 2;
var rowCount = 5;
ws.InsertRow(startRow, rowCount);
var copyRow = startRow+rowCount;
for (int i = 0; i < rowCount; i++)
{
var row = startRow + i;
ws.Cells[copyRow, 2, copyRow, ws.Dimension.End.Column].Copy(ws.Cells[row, 2, row, ws.Dimension.End.Column]);
ws.Row(row).StyleID = ws.Row(copyRow).StyleID;
}
pkg.SaveAs(new FileInfo(@"c:\output.xlsx"));
}
```

Commented Unassigned: InsertRow with Copy not worked with merged cells [15621]

$
0
0

There is row pattern B2:F2

Cell B2 = "Text"
Cell C2 = "Text"
Cell D2:E2 is merged = "Text"
Cell F2 = "Text"

If this is done without "method IinsertRow", it works correctly and the row template is copied as necessary (including merged cells )

```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\input.xlsx")))
{
// correct work
var ws = pkg.Workbook.Worksheets[1];
var pattern = ws.Cells["B2:F2"];
pattern.Copy(ws.Cells["B3:F3"]);
pattern.Copy(ws.Cells["B4:F4"]);
pattern.Copy(ws.Cells["B5:F5"]);
pkg.SaveAs(new FileInfo(@"c:\output.xlsx"));
}
```

```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\tmplcopy.xlsx")))
{
// not correct work
var ws = pkg.Workbook.Worksheets[1];
// add three rows
ws.InsertRow(2, 3);
// go to pattern row after insert
var pattern1 = ws.Cells["B5:F5"];
// all is good here
pattern1.Copy(ws.Cells["B2:F2"]);
pattern1.Copy(ws.Cells["B3:F3"]); // Exception: Can't delete merged cells. A range is partly merged with the deleted range. D5:E5
pkg.SaveAs(new FileInfo(@"c:\tmplcopy1.xlsx"));
}
```

In this case (below), merged cells correct copied only in row= 2.
Why?


```
using (ExcelPackage pkg = new ExcelPackage(new FileInfo(@"c:\input.xlsx")))
{
var ws = pkg.Workbook.Worksheets[1];
var startRow = 2;
var rowCount = 5;
ws.InsertRow(startRow, rowCount);
var copyRow = startRow+rowCount;
for (int i = 0; i < rowCount; i++)
{
var row = startRow + i;
ws.Cells[copyRow, 2, copyRow, ws.Dimension.End.Column].Copy(ws.Cells[row, 2, row, ws.Dimension.End.Column]);
ws.Row(row).StyleID = ws.Row(copyRow).StyleID;
}
pkg.SaveAs(new FileInfo(@"c:\output.xlsx"));
}
```

Comments: I'm sorry, in the last build this problem is not observed!

Created Unassigned: Applying formula to selected range of non-contiguous cells [15622]

$
0
0
I'm able to use the following code to apply a formula to a range of selected cells.

```
Worksheet.Select(new ExcelAddress("T2:T10"));
Worksheet.SelectedRange.Formula = "=if(A2=\"\",\"empty\",\"not empty\")";
```
This works great because it changes the formula so that for cell T2 the cell that is checked is A2, and for cell T3 the cell that is checked is A3, etc.

However, when I have a non-contiguous block of cells, the application of the formula fails, and only the first cell in the selected range receives the formula. The following code results in just cell T2 receiving the formula.

```
Worksheet.Select(new ExcelAddress("T2,T5,T8,T10"));
Worksheet.SelectedRange.Formula = "=if(A2=\"\",\"empty\",\"not empty\")";
```

The same is true when I use the Cells property.

```
// awesome
Worksheet.Cells["T2:T10"].Formula = "=if(A2=\"\",\"empty\",\"not empty\")";
// not so awesome
Worksheet.Cells["T2,T5,T8,T10"].Formula = "=if(A2=\"\",\"empty\",\"not empty\")";
```

Does this sound like a bug (known or unknown)?

I'm thinking that I'll need to apply the formula to the whole column, and then go back and blank out the cells for the ones that shouldn't receive it. But, it would be great if I didn't have to.

Thanks.

Created Unassigned: Adding filters in RowFields [15623]

$
0
0
Hi all,

I wrote here because I have a lot time trying to add a filter in RowFields.

I made an example test and this is what I got:
![Image](http://thumbs.subefotos.com/1474de3eac45f671a709f5f7890f1737o.jpg)

This is what I need:
![Image](http://thumbs.subefotos.com/a6f4c621331d86ad8c630349aebe5032o.jpg)

Example data:
![Image](http://thumbs.subefotos.com/8e43a489d32a77a7136be88c6b8b285ao.jpg)

This is what I working on (Real pivot table I need):
![Image](http://thumbs.subefotos.com/877d7816e173745f432d0652fad2e45do.jpg)


Additionally I have to add conditions changing the color of the row in case anyone has ideas

This is my code:

try![Image](http://example.com/logo.jpg)
{
const string FORMATCURRENCY = "#,###;[Red](#,###)";

var file = new FileInfo(@"c:\temp\pruebas" + DateTime.Now.Second * 1000 + DateTime.Now.Millisecond + ".xlsx");
if (file.Exists)
file.Delete();

var pck = new ExcelPackage(file);
var workbook = pck.Workbook;
ExcelWorksheet worksheet = workbook.Worksheets.Add("newsheet");

insertaDatos(worksheet);

pck.Workbook.FullCalcOnLoad = true;

// Pivot table
ExcelPivotTable pivotTable = worksheet.PivotTables.Add(worksheet.Cells["A16"], worksheet.Cells["A1:D10"], "test");

pivotTable.ShowHeaders = true;
pivotTable.GrandTotalCaption = "TOTAL";
pivotTable.DataCaption = "";


pivotTable.RowFields.Add(pivotTable.Fields["Col1"]);
pivotTable.Fields["Col1"].Compact = false;

pivotTable.RowFields.Add(pivotTable.Fields["Col2"]);

// Columnas de datos
var field = pivotTable.DataFields.Add(pivotTable.Fields["Col3"]);
field.Name = "Sum of Col3";
field.Function = DataFieldFunctions.Sum;
field.Format = FORMATCURRENCY;

field = pivotTable.DataFields.Add(pivotTable.Fields["Col4"]);
field.Name = "Sum of Col4";
field.Function = DataFieldFunctions.Sum;
field.Format = FORMATCURRENCY;


pivotTable.DataOnRows = false;
pivotTable.Outline = true;
pivotTable.OutlineData = true;

pck.Save();


int nFilas = worksheet.Dimension.End.Row;

Close();
}
catch (Exception ex)
{
MessageBox.Show("Error: " + ex);
throw;
}

I appreciate all the collaboration that you can give me.

Thanks for your help.


Commented Unassigned: Considering migrating away from CodePlex [15618]

$
0
0
CodePlex is about to be shut down.
Are you considering to migrate your projet to another platform (like GitHub) ?
Comments: It looks like this question has already been addressed in the Discussions section. [https://epplus.codeplex.com/discussions/662424](https://epplus.codeplex.com/discussions/662424)

Commented Unassigned: ExcelRange.Value = null; throws an exception [15402]

$
0
0
Please find attached a sample application which opens a workbook and sets cell values to null. The workbook is inside the attachment ( ConsoleApplication1\bin\Debug\in.xlsx ).

The error message is:
Specified argument was out of the range of valid values.
Parameter name: Start cell Address must be less or equal to End cell address
at OfficeOpenXml.ExcelAddressBase.Validate()
at OfficeOpenXml.ExcelAddressBase.SetAddress(String address)
at OfficeOpenXml.ExcelAddress.set_Address(String value)
at OfficeOpenXml.ExcelRange.get_Item(String Address)
at OfficeOpenXml.ExcelRangeBase.SplitFormula(ExcelAddressBase address, Int32 ix)
at OfficeOpenXml.ExcelRangeBase.SplitFormulas(ExcelAddressBase address)
at OfficeOpenXml.ExcelRangeBase.Set_Value(Object value, Int32 row, Int32 col)
at OfficeOpenXml.ExcelRangeBase.SetValueAddress(ExcelAddress address, _setValue valueMethod, Object value)
at OfficeOpenXml.ExcelRangeBase.SetRange(_setValue valueMethod, Object value)
at OfficeOpenXml.ExcelRangeBase.set_Value(Object value)
Comments: Any update on this?

Commented Unassigned: ExcelRange.Value = null; throws an exception [15402]

$
0
0
Please find attached a sample application which opens a workbook and sets cell values to null. The workbook is inside the attachment ( ConsoleApplication1\bin\Debug\in.xlsx ).

The error message is:
Specified argument was out of the range of valid values.
Parameter name: Start cell Address must be less or equal to End cell address
at OfficeOpenXml.ExcelAddressBase.Validate()
at OfficeOpenXml.ExcelAddressBase.SetAddress(String address)
at OfficeOpenXml.ExcelAddress.set_Address(String value)
at OfficeOpenXml.ExcelRange.get_Item(String Address)
at OfficeOpenXml.ExcelRangeBase.SplitFormula(ExcelAddressBase address, Int32 ix)
at OfficeOpenXml.ExcelRangeBase.SplitFormulas(ExcelAddressBase address)
at OfficeOpenXml.ExcelRangeBase.Set_Value(Object value, Int32 row, Int32 col)
at OfficeOpenXml.ExcelRangeBase.SetValueAddress(ExcelAddress address, _setValue valueMethod, Object value)
at OfficeOpenXml.ExcelRangeBase.SetRange(_setValue valueMethod, Object value)
at OfficeOpenXml.ExcelRangeBase.set_Value(Object value)
Comments: Any update on this?
Viewing all 2262 articles
Browse latest View live


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