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

Edited Unassigned: Missing AlternativeText property by Excel comment [15229]

$
0
0
Hi,

Excel comment has a property of Alternative Text, which is not implemented in EPPlus.

To implement it, it is enough to add the following property to ExcelVmlDrawingBase class:

```
public string AlternativeText
{
get
{
return GetXmlNodeString("@alt");
}
set
{
SetXmlNodeString("@alt", value);
}
}
```

Please add this code, we find this property very usefull. Thank you

Regards,
Ivan


Commented Unassigned: Missing AlternativeText property by Excel comment [15229]

$
0
0
Hi,

Excel comment has a property of Alternative Text, which is not implemented in EPPlus.

To implement it, it is enough to add the following property to ExcelVmlDrawingBase class:

```
public string AlternativeText
{
get
{
return GetXmlNodeString("@alt");
}
set
{
SetXmlNodeString("@alt", value);
}
}
```

Please add this code, we find this property very usefull. Thank you

Regards,
Ivan

Comments: Fixed in changeset 3992e0ed4ed5

Created Unassigned: copied sheet as a reference to the original sheet for the drawing [15250]

$
0
0
if you copy a sheet and delete the original one, all drawing on the copied sheet will be lost and Excel will ask to repair the sheet. (unreadable content)

step to reproduce

1. create a new excel file with Excel 2007 and stay on sheet1
2. Go to insert
3. Click picture
4. Select a picture
5. Save
6. Close Excel

run this code on it
```
using exfile as new excelpackage(new fileinfo("excel file from step 1")

exfile.workbook.worksheets.copy("sheet1","copiedSheet")

exfile.workbook.worksheets.delete("sheet1")

exfile.save()
end using
```

open the Excel file, you wil have repair it and the image are lost.

Commented Unassigned: copied sheet as a reference to the original sheet for the drawing [15250]

$
0
0
if you copy a sheet and delete the original one, all drawing on the copied sheet will be lost and Excel will ask to repair the sheet. (unreadable content)

step to reproduce

1. create a new excel file with Excel 2007 and stay on sheet1
2. Go to insert
3. Click picture
4. Select a picture
5. Save
6. Close Excel

run this code on it
```
using exfile as new excelpackage(new fileinfo("excel file from step 1")

exfile.workbook.worksheets.copy("sheet1","copiedSheet")

exfile.workbook.worksheets.delete("sheet1")

exfile.save()
end using
```

open the Excel file, you wil have repair it and the image are lost.
Comments: found this issue while changing the sheet, from embed picture to actual picture, to bypass the issue of https://epplus.codeplex.com/workitem/15248

Created Unassigned: compression choice is ignored [15251]

$
0
0
step to reproduce

create a new excel file and run this, compare file size

```
Using exFile As New ExcelPackage(New FileInfo("c:\book1.xlsx"))

For row = 1 To 1000
For col = 1 To 100
exFile.Workbook.Worksheets("sheet1").Cells(row, col).Value = "aaaaaa"
Next
Next

exFile.Compression = CompressionLevel.None
exFile.SaveAs(New FileInfo("c:\book1-None.xlsx"))
End Using

Using exFile As New ExcelPackage(New FileInfo("c:\book1.xlsx"))

For row = 1 To 1000
For col = 1 To 100
exFile.Workbook.Worksheets("sheet1").Cells(row, col).Value = "aaaaaa"
Next
Next

exFile.Compression = CompressionLevel.BestCompression
exFile.SaveAs(New FileInfo("c:\book1-BestCompression.xlsx"))
End Using
```

steping into the code show that line 1939 of the file zipentry.write.cs, the if, CompressionLevel is still set to "default" even if "none" or "bestcompression" is specified

Created Unassigned: double saveas create an exception [15252]

$
0
0
if you do a double saveas, an exception will be thrown with "Part already exist"

step to reproduce

```
Using exFile As New ExcelPackage(New FileInfo("c:\book1.xlsx"))

For row = 1 To 1000
For col = 1 To 100
exFile.Workbook.Worksheets("sheet1").Cells(row, col).Value = "aaaaaa"
Next
Next

exFile.SaveAs(New FileInfo("c:\book1-copy1.xlsx"))
exFile.SaveAs(New FileInfo("c:\book1-copy2.xlsx"))

End Using

```

Edited Unassigned: compression choice is ignored [15251]

$
0
0
step to reproduce

create a new excel file and run this

```
Using exFile As New ExcelPackage(New FileInfo("c:\book1.xlsx"))

For row = 1 To 1000
For col = 1 To 100
exFile.Workbook.Worksheets("sheet1").Cells(row, col).Value = "aaaaaa"
Next
Next

exFile.Compression = CompressionLevel.None
exFile.SaveAs(New FileInfo("c:\book1-None.xlsx"))
End Using
```

steping into the code show that line 1939 of the file zipentry.write.cs, the if, CompressionLevel is still set to "default" even if "none" is specified

Created Unassigned: The OFFSET function is not calculating the toRow and toCol correctly [15253]

$
0
0
The OFFSET function is not calculating the toRow and toCol correctly.

Current code:

```
var toRow = (height != 0 ? height : adr._toRow) + rowOffset;
var toCol = (width != 0 ? width : adr._toCol) + colOffset;
```

Proposed Code:

```
var toRow = (height != 0 ? fromRow + height : adr._toRow + rowOffset);
var toCol = (width != 0 ? fromCol + width : adr._toCol + colOffset);
```


Commented Issue: System.InvalidOperationException saving document with cloned sheet containing images [14776]

$
0
0
EPPlus is working fantastically for my project, except that I get an exception when saving a document that contains a cloned sheet with images.

If I leave the 'template' sheet in the document then it saves fine.

If I delete the template I get the following exception when saving:

[System.InvalidOperationException] = {"Specified part does not exist in the package."}
at OfficeOpenXml.ExcelPackage.Save()
at OfficeOpenXml.ExcelPackage.SaveAs(FileInfo file)


I have made the simplest template that shows the issue (attached).

Example code is:

public void DemonstrateError()
{
var templateFile = new FileInfo(Environment.CurrentDirectory + @"\Templates\Template.xlsx");
var outputDirectoryInfo = Directory.CreateDirectory(Environment.CurrentDirectory + @"\Reports\" + DateTime.UtcNow.ToFileTimeUtc());
var outputFile = new FileInfo(outputDirectoryInfo.FullName + @"\Report.xlsx");

using (var package = new ExcelPackage(templateFile))
{
//Copy the template sheet to a new one.
var newSheet = package.Workbook.Worksheets.Copy("Template", String.Format("Site {0}", 1));

/* Normally lots of processing goes here */

//We no longer need the template sheet.
package.Workbook.Worksheets.Delete("Template");

//Save the completed document (will generate an exception)
package.SaveAs(outputFile);
}
}
Comments: Just sharing an observation for anyone else using this workaround: At least as of EPPlus 4.0,4, this no longer seems to be necessary.

Edited Issue: The OFFSET function is not calculating the toRow and toCol correctly [15253]

$
0
0
The OFFSET function is not calculating the toRow and toCol correctly.

Current code:

```
var toRow = (height != 0 ? height : adr._toRow) + rowOffset;
var toCol = (width != 0 ? width : adr._toCol) + colOffset;
```

Proposed Code:

```
var toRow = (height != 0 ? fromRow + height : adr._toRow + rowOffset);
var toCol = (width != 0 ? fromCol + width : adr._toCol + colOffset);
```

Commented Issue: Cannot add more than 1 pivot table to xlsx file [14695]

$
0
0
I have attached a mvc3 c# project that creates two tabs of data(6 rows, 6 columns) and then tries to create two pivot table, each on their own tab. If I only create one pivot table(does not matter which one) it works. But when I try to build both pivot tables I get an error message when I open the file in excel "Excel found unreadable content. Do you want to recover. I answer yes and it displays "Removed Records: Workbook properties from /xl/workbook.xml part (Workbook)"........And the 2nd pivot table is always empty.
I purposely made sure that I did not use any duplicate names/fields .

Any suggestions would be appreciated.
Comments: Fantastic, thank you for the help, this works like a charm now!

Commented Unassigned: Excel crash with pivot table [15240]

$
0
0
Hi,

when creating a pivot table for a data range where one of the field names contains a line break (\r\n) , Excel crashes on opening the resulting .xlsx file.

This can also be reproduced with one of the EPPlus samples:

Sample12.cs, starting with line 97:

```
wsData.Cells[2, 6, dataRange.End.Row, 6].Style.Numberformat.Format = "mm-dd-yy";
wsData.Cells[2, 7, dataRange.End.Row, 11].Style.Numberformat.Format = "#,##0";

// Add the following line to reproduce the error
wsData.Cells["B1"].Value = "FirstName\r\n(as in Passport)";

dataRange.AutoFitColumns();

```
The weird thing is, even if you do not have the line break in the resulting file, but add it afterwards via Excel and do a "refresh all" for the pivot tables - it crashes as well.

If you save the file after adding the line break without doing a "refresh all" it will not open up afterwards but crash, which effectively destroys the file...

Currently I'm not using the line break to avoid this but it would be very good if this was fixed because you can't know what the users are doing with those files.

If I manually create a pivot with line breaks in Excel , this problem does not occur.

Thomas
Comments: Perfect! Thanks for the quick fix - I will donate some Euro to help keep the project running!

Created Unassigned: ExcelBorderXml | diagonalUp and diagonalDown fields are not set [15254]

$
0
0

The internal fields ___diagonalUp__ and ___diagonalDown__ fields of the class __ExcelBorderXml__ are not parsed from Xml, when opening an excel file.
This leads to the effect, that programmatical cells know nothing about their diagonal borders, until these are set explicitelly.

To fix the issue I suggest adding following two lines of code to the ExcelBorderXml constructor

```
_diagonalUp = GetXmlNodeBool(diagonalUpPath);
_diagonalDown = GetXmlNodeBool(diagonalDownPath);
```

The constructor looks afterall as following:

```
internal ExcelBorderXml(XmlNamespaceManager nsm, XmlNode topNode) :
base(nsm, topNode)
{
_left = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(leftPath, nsm));
_right = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(rightPath, nsm));
_top = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(topPath, nsm));
_bottom = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(bottomPath, nsm));
_diagonal = new ExcelBorderItemXml(nsm, topNode.SelectSingleNode(diagonalPath, nsm));
_diagonalUp = GetXmlNodeBool(diagonalUpPath);
_diagonalDown = GetXmlNodeBool(diagonalDownPath);
}

```

Best regadrs,
Ivan

Created Unassigned: Failed address resolution by "[]" [15255]

$
0
0
When creating a named area in MS Excel application sometimes it puts empty square brakets at the beginning of the address string. I did not find out depending on what circumstances Excel does so. So I was able reproduce the error only sporadical.
In any case the error is reproduceble. Here is my suggestion for sulution:

The function __ExcelAddress.SetAddress(string address)__ I extended with the following two lines of code on the beginning:

```
if (address.Contains("[]"))
address = address.Replace("[]", String.Empty);
```

So the function looks like that afterall:

```
protected internal void SetAddress(string address)
{
//Sometimes (especially in named areas) excel puts empty brackets
if (address.Contains("[]"))
address = address.Replace("[]", String.Empty);
if(address.StartsWith("'"))
{
int pos = address.IndexOf("'", 1);
while (pos < address.Length && address[pos + 1] == '\'')
{
pos = address.IndexOf("'", pos+2);
}
var wbws = address.Substring(1,pos-1).Replace("''","'");
SetWbWs(wbws);
_address = address.Substring(pos + 2);
}
else if (address.StartsWith("[")) //Remove any external reference
{
SetWbWs(address);
}
else
{
_address = address;
}
if(_address.IndexOfAny(new char[] {',','!', '['}) > -1)
{
//elided..
```

Best regards,
Ivan

Created Unassigned: System.NullReferenceException in ExcelRangeBase constructor [15256]

$
0
0
Hi,

I got the following exception when trying to read a XLSX file:

```
System.NullReferenceException: Object reference not set to an instance of an object
at OfficeOpenXml.ExcelRangeBase..ctor (OfficeOpenXml.ExcelWorksheet xlWorksheet, System.String address) [0x00000] in :0
at OfficeOpenXml.ExcelNamedRange..ctor (System.String name, OfficeOpenXml.ExcelWorksheet nameSheet, OfficeOpenXml.ExcelWorksheet sheet, System.String address, Int32 index) [0x00000] in :0
at OfficeOpenXml.ExcelNamedRangeCollection.Add (System.String Name, OfficeOpenXml.ExcelRangeBase Range) [0x00000] in :0
at OfficeOpenXml.ExcelWorkbook.GetDefinedNames () [0x00000] in :0
at OfficeOpenXml.ExcelPackage.get_Workbook () [0x00000] in :0
```

I think it is related to [this issue](https://epplus.codeplex.com/workitem/15038), and the reason is the same, "_worksheet" ExcelWorksheet member variable is null. However, the issue is marked as resolved.

I could fix this issue by adding conditional validators to check if the ExcelWorksheet parameters is null in the ExcelRangeBase constructors:

``` C#
#region Constructors
internal ExcelRangeBase(ExcelWorksheet xlWorksheet)
{
_worksheet = xlWorksheet;
if (xlWorksheet != null)
{
_ws = _worksheet.Name;
_workbook = _worksheet.Workbook;
}
else
{
_ws = null;
_workbook = null;
}
this.AddressChange += new EventHandler(ExcelRangeBase_AddressChange);
SetDelegate();
}

void ExcelRangeBase_AddressChange(object sender, EventArgs e)
{
if (Table != null)
{
SetRCFromTable(_workbook._package, null);
}
SetDelegate();
}
internal ExcelRangeBase(ExcelWorksheet xlWorksheet, string address) :
base(xlWorksheet == null ? "" : xlWorksheet.Name, address)
{
_worksheet = xlWorksheet;
if (xlWorksheet != null)
{
_workbook = _worksheet.Workbook;
base.SetRCFromTable(_worksheet._package, null);
}
else
{
_workbook = null;
base.SetRCFromTable(null, null);
}
if (string.IsNullOrEmpty(_ws)) _ws = _worksheet == null ? "" : _worksheet.Name;
this.AddressChange += new EventHandler(ExcelRangeBase_AddressChange);
SetDelegate();
}
internal ExcelRangeBase(ExcelWorkbook wb, ExcelWorksheet xlWorksheet, string address, bool isName) :
base(xlWorksheet == null ? "" : xlWorksheet.Name, address, isName)
{
SetRCFromTable(wb._package, null);
_worksheet = xlWorksheet;
_workbook = wb;
if (string.IsNullOrEmpty(_ws)) _ws = (xlWorksheet == null ? null : xlWorksheet.Name);
this.AddressChange += new EventHandler(ExcelRangeBase_AddressChange);
SetDelegate();
}
~ExcelRangeBase()
{
this.AddressChange -= new EventHandler(ExcelRangeBase_AddressChange);
}
#endregion
```

I didn't make a commit because I'm still not comfortable with Codeplex.

Thanks in advance!

Created Unassigned: Error when opening protected worksheet [15257]

$
0
0
The error is -
__Can not open the package. Package is an OLE compound document. If this is an encrypted package, please supply the password__

Here is the process:

1. My application opens a blank version of this file using EPPlus, populates the sheets, adds sheet protection, then saves as a different file name. The blank version of the file was created using Excel 2013.

2. Users are expected to enter more data in the unprotected sheets and then save it and send it back to us.

3. The application opens it again using EPPlus and does some more edits before processing.

This all works when editing the file in Excel 2013. However, if step #2 is done by a user with Excel 2007, step 3 raises the error mentioned at the top. I can open and resave the file in Excel 2013 and everything works fine. Or, the worksheet protection can be removed in excel and resaved and it works fine.

__So basically, if a file uses workbook protection and it is saved using Excel 2007, EPPlus cannot open it.__

The code I'm using to open the file is (in VB.NET):

Dim strFromFile As String = "[file name]"
Dim oXLFrom As New ExcelPackage(New System.IO.FileInfo(strFromFile)) __<--The error is raised with this line__

Can someone advise on something that can help with this? I really would like to be able to leave all of the workbook protection in place with these files if possible. Due to the potentially sensitive nature of the contents of my file, I would prefer not to attach it to this public forum. I can send it in a private message or email it to any developer that can look at it though.

Created Unassigned: CellStore bug / InsertRow [15258]

$
0
0
Hi,
I've seemed to found a problem in the Insert method of the CellStore that affects the InsertRow operation. First, steps to reproduce it (I had the issue with functions, but I suppose it affects all the items)
1) have row 12 with some formula in column 1
2) have row 16 with formula in column 1
3) start inserting 2032 rows at position 15, one by one. This should still end up correctly, the second formula ends on row 2048
4) attempt to insert one more row. The second formula stays on row 2048
5) future inserts will work "correctly", ie. move the formula again due to the way step 4 changes the data (but it is now one row higher than expected)

The issue seems to be in CellStore.Insert, starting at row 710 (within the section "//The row is on the page before."). When rowPos is negative (which in the described scenario it will be on step 4), nothing is updated; but the rows in pages from pagePos up should be still moved. Adding the code:
if (rowPos < 0)
{
rowPos = ~rowPos;
}

Seems to fix the problem.

I am using only InsertRow so I don't k now if similar problem affects the other paths. I hope this helps

regards,
Robert
p.s. this is tested on 4.0.4 code downloaded today

Created Unassigned: Write to shared workbook [15259]

$
0
0
How can I write to a shared workbook that is opened? I need to be able to write to an Excel doc that is opened by someone else, so that they can see updates in real time. However, if I save to a shared workbook, the next time it is saved or opened in Excel, I get a warning saying "This file is no longer shared". The only way to make it shared again is to close the file, reopen it, and set the shared properties again. But as soon as it is written to through the .net code, it becomes unshared again.

Created Unassigned: Support error bars for bar chart [15260]

$
0
0
It would be great if you could support error bars on a bar chart series.

Created Unassigned: File corrupt [15261]

$
0
0
I have a weird bug where the Excel file is corrupt. I use EPPlus to open a template which is an xlsx file where I add data coming from a database and serve that modified file to the client. When I opening it, Excel crashes, starts in protected mode and an error message comes up saying the file is corrupt. It works alright if I try to open the unprocessed file though.

The weird thing is it crashes my Excel which is version 14.0.7116.5000 but not on my colleague's version (14.0.6123.5001) and we both have the 64 bits version of Office Professional Plus 2010.

And when my colleague saves under Excel, I am able to open the file he saved without problem... So I've tried to compare the file he saved with the one generated by EPPlus (by opening it as a Zip file) and found differences in the [Content_Types].xml file. And when I tried to replace the EPPlus generated file's [Content_Types].xml with my collegue's saved file [Content_Types].xml, I could then open the xlsx file without problem...

So it looks like the EPPlus generated [Content_Types].xml file is causing this error... You'll find in the attachments the EPPlus generated [Content_Types].xml and the Excel generated [Content_Types].xml
Viewing all 2262 articles
Browse latest View live


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