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

Created Unassigned: Cell RichText collection not initial empty [15374]

$
0
0
When using ExcelRangeBase.RichText, when the ExcelRangeBase is a single cell, the first cell works fine. However, the second cell you set initially gets a copy of the previous cell's content. When you call ExcelRichTextCollection.Add, the content is added to the copy from the first cell.

Fortunately, calling ExcelRichTextCollection.Clear is an easy workaround.

Created Unassigned: ExcelChartAxis NumberFormat and SourceLinked [15375]

$
0
0
Hi,
working with excel files and Charts, i discover a small problem:
if you use the Format property in ExcelChartAxis, in the node c:numFmt you should add also the attribute sourceLinked="0", because if not Excel get the format number on the excel cell instead of what you inserted in the Format property of the axes

Created Unassigned: SUMPRODUCT not working when the arrays are one cell [15376]

$
0
0
I am working on a spreadsheet where the repeating patterns dictate that the SUMPRODUCT is sometimes multiplying a range of one cell by another range of one cell. SUMPRODUCT( A3:A3, D10:D10 )

When the ranges are one cell in size, SUMPRODUCT appears to not function.

This appears to be related to this 2012 ticket, which was resolved. This appears to be related and is still having the same problem.

http://epplus.codeplex.com/workitem/14711

Created Unassigned: GetTypedValue Nullable Conversion [15377]

$
0
0
ExcelWorksheet.GetValue<T> throws an exception when passed double?.

In ExcelWorksheet.cs, Line 2603 throws an exception when trying to convert a nullable type (e.g. double?): "'DoubleConverter' is unable to convert 'System.Double' to 'System.Nullable`1[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'".

Changing the line from
```
return (T)cnv.ConvertTo(v, typeof(T));
```

to

```
return (T)cnv.ConvertTo(v, toType);
```

fixes this issue. This works because line 2600 is changing 'toType' to the underlying type of the nullable (see below).

```
toType = Nullable.GetUnderlyingType(toType);
if (cnv.CanConvertTo(toType))
{
return (T)cnv.ConvertTo(v, toType);
}
```

Created Unassigned: Bubble Chart Series being converted as ChartSeries instead of BubbleChartSeries [15378]

$
0
0
When opening a workbook created in Excel that includes a bubble chart, the chart gets represented as an ExcelBubbleChart object that has ExcelChartSeries series instead of ExcelBubbleChartSeries series, which makes updating the bubble size challenging.

When opening a workbook that includes a bubble chart, the chart series should be created as an ExcelBubbleChartSeries where possible (instead of ExcelChartSeries).

Commented Unassigned: Worksheet.Add fails with Unicode [15125]

$
0
0
I have tried to use version 4.0.1. But it fails when processing excel file with worksheets in Unicode (I'm using Microsoft Excel with Russian language).
Steps to reproduce error:
1) create ExcelPackage from excel file with 3 sheets: Template, Градуировка, Перецень АЦ
2) try to add list by copy sheet Template
```
xlPackage.Workbook.Worksheets.Add(sDate, template);
```
3) epplus fails with error "Vba module names can't contain unicode characters"

Version 3.1.3 works fine with the same excel file.
Comments: I attempted to reproduce this issue using the steps provided in version 4.0.4 and was unable to do so; it appears to be resolved.

Created Unassigned: Charts with Data not on Sheet [15379]

$
0
0
Hello:

With excel, I can manually enter data that isn't associated in a cell or sheet and have it graph for me. I cannot figure a way to do with with EPPlus? Does this software offer this feature? I have attached my example in Excel.

Created Unassigned: Problems with dots in WorkSheet name [15380]

$
0
0
Hi EPPlus developers,

EPPlus has problems when working with excel file, which has a dot (.) in a worksheet name.

The issue is, that excel does not take addresses with a dot into quotation marks. When working with a __ExcelNamedRange__ which name is _Sheet.1!MyNamedRange_ the address type is defined by EPPlus as Formula (by the __ExcelAddressBase.IsValid()__ method). This leads to a null reference exception, when calling for example a __FullAddress__ property of such a __ExcelNamedRange__

To reproduce please use the Reproduce.xlsx file attached.
My solution suggestion is attached as a diff file.

Sincere,
Ivan

Commented Unassigned: Problems with dots in WorkSheet name [15380]

$
0
0
Hi EPPlus developers,

EPPlus has problems when working with excel file, which has a dot (.) in a worksheet name.

The issue is, that excel does not take addresses with a dot into quotation marks. When working with a __ExcelNamedRange__ which name is _Sheet.1!MyNamedRange_ the address type is defined by EPPlus as Formula (by the __ExcelAddressBase.IsValid()__ method). This leads to a null reference exception, when calling for example a __FullAddress__ property of such a __ExcelNamedRange__

To reproduce please use the Reproduce.xlsx file attached.
My solution suggestion is attached as a diff file.

Sincere,
Ivan
Comments: File to reproduce the problem

Created Unassigned: MS Access can not import file generated by EPP. [15381]

$
0
0
[Full description here](https://epplus.codeplex.com/discussions/647427) - link to EPP discussion post.

Any file created with App can not be imported by Access.

Work around is: Open by Excel and save (without any edit changes). Access reads such file successfully.

What is even MORE interesting, while file generated by EPP is being open by Excel
it could be imported by Access as well. But if you close file in Excel w/o saving,
it again become "unknown format" to Access..




Commented Unassigned: Changing any row height after inserting picture makes it square [14846]

$
0
0
After inserting picture I change some other row's height. The result is that picture is square. If I comment out row's height change, picture is rectangular as expected.

Image position and size does not have any impact on that issue. It does not have to be positioned in the row with changed height.

```
static void Main(string[] args)
{
var targetPath = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), ".xlsx"));

using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("new");

var image = new Bitmap(150, 50);
using(var g = Graphics.FromImage(image)) g.FillRectangle(Brushes.Black, 0, 0, 149, 49);

var picture = worksheet.Drawings.AddPicture("Picture", image);
worksheet.Row(1).Height = 5;

package.SaveAs(new FileInfo(targetPath));
}

Process.Start(targetPath);
}
```
Comments: Helly, guys! I got this problem as well. And after some research I figured out where the bug is. It's in the ExcelRow class on the 149 line of code (ExcelRow.cs file). There is a mistake, when row's Height got changed it recalcs all pictures heights but uses pictures widths inplace of heights, so it's easy to fix. Just change the line > var pos = _worksheet.Drawings.GetDrawingWidths(); to > var pos = _worksheet.Drawings.GetDrawingHeight(); P.S. Hope somebody can change that and commit changes to the repo.

Commented Unassigned: Changing any row height after inserting picture makes it square [14846]

$
0
0
After inserting picture I change some other row's height. The result is that picture is square. If I comment out row's height change, picture is rectangular as expected.

Image position and size does not have any impact on that issue. It does not have to be positioned in the row with changed height.

```
static void Main(string[] args)
{
var targetPath = Path.Combine(Path.GetTempPath(), Path.ChangeExtension(Path.GetRandomFileName(), ".xlsx"));

using (var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("new");

var image = new Bitmap(150, 50);
using(var g = Graphics.FromImage(image)) g.FillRectangle(Brushes.Black, 0, 0, 149, 49);

var picture = worksheet.Drawings.AddPicture("Picture", image);
worksheet.Row(1).Height = 5;

package.SaveAs(new FileInfo(targetPath));
}

Process.Start(targetPath);
}
```
Comments: Would be nice if someone could get this in a new nuget version of the package.

Created Unassigned: Multiple TextRuns in Cell [15382]

$
0
0
When multiple textruns exist in a single cell, the loop in LoadCells() is broken, causing the rest of the <sheetData> to not be read. The applicable code is in ExcelWorksheet.cs, line 1280:

```
else if (xr.LocalName == "is") //Inline string
{
xr.Read();
if (xr.LocalName == "t")
{
_values.SetValue(address._fromRow, address._fromCol, ConvertUtil.ExcelDecodeString(xr.ReadElementContentAsString()));
//cell._value = xr.ReadInnerXml();
}
else
{
_values.SetValue(address._fromRow, address._fromCol, xr.ReadOuterXml()); // <-- this line
_types.SetValue(address._fromRow, address._fromCol, "rt");
_flags.SetFlagValue(address._fromRow, address._fromCol, true, CellFlags.RichText);
//cell.IsRichText = true;
}
}
else
{
break;
}
```

Example XML:

```
<is>
<r>
<rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><sz val="9.99937011841774"></sz><color theme="1"></color><rFont val="Calibri"></rFont></rPr>
<t xml:space="preserve"> </t>
</r>
<r>
<rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><u val="none"></u><sz val="8"></sz><color rgb="FF000000"></color><rFont val="Arial"></rFont></rPr>
<t xml:space="preserve">Shifra Gitelman; Meital Sari Azrieli; Moses Azriel; Asaf Azriel </t>
</r>
<r>
<rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><sz val="9.99937011841774"></sz><color theme="1"></color><rFont val="Calibri"></rFont></rPr>
<t xml:space="preserve"> </t>
</r>
</is>
```

The code will read the first <r> element using xr.ReadOuterXml(), leaving the next textrun in queue. This causes the next iteration of the loop to break at line 1287.

Commented Unassigned: Multiple TextRuns in Cell [15382]

$
0
0
When multiple textruns exist in a single cell, the loop in LoadCells() is broken, causing the rest of the <sheetData> to not be read. The applicable code is in ExcelWorksheet.cs, line 1280:

```
else if (xr.LocalName == "is") //Inline string
{
xr.Read();
if (xr.LocalName == "t")
{
_values.SetValue(address._fromRow, address._fromCol, ConvertUtil.ExcelDecodeString(xr.ReadElementContentAsString()));
//cell._value = xr.ReadInnerXml();
}
else
{
_values.SetValue(address._fromRow, address._fromCol, xr.ReadOuterXml()); // <-- this line
_types.SetValue(address._fromRow, address._fromCol, "rt");
_flags.SetFlagValue(address._fromRow, address._fromCol, true, CellFlags.RichText);
//cell.IsRichText = true;
}
}
else
{
break;
}
```

Example XML:

```
<is>
<r>
<rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><sz val="9.99937011841774"></sz><color theme="1"></color><rFont val="Calibri"></rFont></rPr>
<t xml:space="preserve"> </t>
</r>
<r>
<rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><u val="none"></u><sz val="8"></sz><color rgb="FF000000"></color><rFont val="Arial"></rFont></rPr>
<t xml:space="preserve">Shifra Gitelman; Meital Sari Azrieli; Moses Azriel; Asaf Azriel </t>
</r>
<r>
<rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><sz val="9.99937011841774"></sz><color theme="1"></color><rFont val="Calibri"></rFont></rPr>
<t xml:space="preserve"> </t>
</r>
</is>
```

The code will read the first <r> element using xr.ReadOuterXml(), leaving the next textrun in queue. This causes the next iteration of the loop to break at line 1287.
Comments: I attempted to fix the issue by adding the following at line 1278 in Worksheet.cs: ``` else if (xr.LocalName == "r") { StringBuilder sb = new StringBuilder(); while (xr.LocalName == "r") { sb.Append(xr.ReadOuterXml()); } _values.SetValue(address._fromRow, address._fromCol, sb.ToString()); _types.SetValue(address._fromRow, address._fromCol, "rt"); _flags.SetFlagValue(address._fromRow, address._fromCol, true, CellFlags.RichText); } ``` This adds all textruns to the valet of the cell, but results in a corrupted package, specifically within sharedStrings.xml: ``` <si> <r xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><sz val="9.99937011841774"></sz><color theme="1"></color><rFont val="Calibri"></rFont></rPr> <t xml:space="preserve"></t> </r> <r xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><u val="none"></u><sz val="8"></sz><color rgb="FF000000"></color><rFont val="Arial"></rFont></rPr> <t xml:space="preserve">Shifra Gitelman; Meital Sari Azrieli; Moses Azriel; Asaf Azriel </t> </r> <r xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <rPr><b val="0"></b><i val="0"></i><strike val="0"></strike><sz val="9.99937011841774"></sz><color theme="1"></color><rFont val="Calibri"></rFont></rPr> <t xml:space="preserve"></t> </r> </si> ``` Opening this file causes Excel to prompt to repair the spreadsheet.

Commented Unassigned: Bug when generating more than 65536 hyperlink rows [14949]

$
0
0
When generating many rows with a column containing hypelinks, Excel finds unreadable content when opening the file. I recover the file and Excel removes the hyperlinks.

If I choose to generate a file with less than 65000 rows it works fine.
Comments: Same issue here. ETA on fix?

Created Unassigned: Column AutoFit() Arithmetic Operation Overflow [15383]

$
0
0
When AutoFit() is executed from an ExcelColumn that is not included in the worksheet dimension, produces an Arithmetic Overflow Exception at the Init() method called from the CellsStoreEnumerator Constructor.

```
public void AutoFitColumns()
{
this.AutoFitColumns(this._worksheet.DefaultColWidth);
}

/// <summary>
/// Set the column width from the content of the range.
/// Note: Cells containing formulas are ignored if no calculation is made.
/// Wrapped and merged cells are also ignored.
///
/// </summary>
///
/// <remarks>
/// This method will not work if you run in an environment that does not support GDI
/// </remarks>
/// <param name="MinimumWidth">Minimum column width</param>
public void AutoFitColumns(double MinimumWidth)
{
this.AutoFitColumns(MinimumWidth, double.MaxValue);
}

/// <summary>
/// Set the column width from the content of the range.
/// Note: Cells containing formulas are ignored if no calculation is made.
/// Wrapped and merged cells are also ignored.
///
/// </summary>
/// <param name="MinimumWidth">Minimum column width</param><param name="MaximumWidth">Maximum column width</param>
public void AutoFitColumns(double MinimumWidth, double MaximumWidth)
{
if (this._worksheet.Dimension == null)
return;
if (this._fromCol < 1 || this._fromRow < 1)
this.SetToSelectedRange();
Dictionary<int, Font> dictionary = new Dictionary<int, Font>();
bool doAdjustDrawings = this._worksheet._package.DoAdjustDrawings;
this._worksheet._package.DoAdjustDrawings = false;
int[,] drawingWidths = this._worksheet.Drawings.GetDrawingWidths();
int fromCol1 = this._fromCol > this._worksheet.Dimension._fromCol ? this._fromCol : this._worksheet.Dimension._fromCol;
int toCol1 = this._toCol < this._worksheet.Dimension._toCol ? this._toCol : this._worksheet.Dimension._toCol;
if (this.Addresses == null)
{
this.SetMinWidth(MinimumWidth, fromCol1, toCol1);
}
else
{
```
```
private void SetMinWidth(double minimumWidth, int fromCol, int toCol)
{
CellsStoreEnumerator<object> cellsStoreEnumerator = new CellsStoreEnumerator<object>(this._worksheet._values, 0, fromCol, 0, toCol);
```
```
public CellsStoreEnumerator(CellStore<T> cellStore, int StartRow, int StartCol, int EndRow, int EndCol)
{
this._cellStore = cellStore;
this._startRow = StartRow;
this._startCol = StartCol;
this._endRow = EndRow;
this._endCol = EndCol;
this.Init();
}

internal void Init()
{
this.minRow = this._startRow;
this.maxRow = this._endRow;
this.minColPos = this._cellStore.GetPosition(this._startCol);
if (this.minColPos < 0)
this.minColPos = ~this.minColPos;
this.maxColPos = this._cellStore.GetPosition(this._endCol);
if (this.maxColPos < 0)
this.maxColPos = ~this.maxColPos - 1;
this.row = this.minRow;
this.colPos = this.minColPos - 1;
int length = this.maxColPos - this.minColPos + 1;
this.pagePos = new int[length];
this.cellPos = new int[length];
for (int index = 0; index < length; ++index)
{
this.pagePos[index] = -1;
this.cellPos[index] = -1;
}
}
```

Created Unassigned: Error in Calculate - empty string vs null [15384]

$
0
0
If a formula refers to a blank (value = null) cell, Excel will automatically treat a blank as a value zero (if using in a numeric formula). EPPlus gives a #VALUE! error. However, in EPPlus an empty string "" is treated as zero in a numeric formula, but Excel gives a #VALUE! error.

So the behaviour is inconsistent with Excel. EPPlus should handle blank cells (value = null) correctly.

Created Unassigned: Adding protected ranges results in corrupted file [15385]

$
0
0
When adding a new protected range with following code:
```
ExcelProtectedRange protectedRange = mySheet.ProtectedRanges.Add("test", new ExcelAddress(2, 1, 4, 1));
```
the resulting file is corrupted. In particular the worksheet "mySheet".

The issue is that the XML element <protectedRanges> has to be before <autoFilter>. But it is appended as one of the last elements.

To fix this "ExcelWorksheet.cs" has to be modified.
Change code below:
```
public ExcelProtectedRangeCollection ProtectedRanges
{
get
{
if (_protectedRanges == null)
_protectedRanges = new ExcelProtectedRangeCollection(NameSpaceManager, TopNode, this);
return _protectedRanges;
}
}
```
to:
```
public ExcelProtectedRangeCollection ProtectedRanges
{
get
{
if (_protectedRanges == null)
{
_protectedRanges = new ExcelProtectedRangeCollection(NameSpaceManager, TopNode, this);
_protectedRanges.SchemaNodeOrder = SchemaNodeOrder;
}
return _protectedRanges;
}
}
```

Edited Unassigned: Adding protected ranges results in corrupted file (with FIX) [15385]

$
0
0
When adding a new protected range with following code:
```
ExcelProtectedRange protectedRange = mySheet.ProtectedRanges.Add("test", new ExcelAddress(2, 1, 4, 1));
```
the resulting file is corrupted. In particular the worksheet "mySheet".

The issue is that the XML element <protectedRanges> has to be before <autoFilter>. But it is appended as one of the last elements.

To fix this "ExcelWorksheet.cs" has to be modified.
Change code below:
```
public ExcelProtectedRangeCollection ProtectedRanges
{
get
{
if (_protectedRanges == null)
_protectedRanges = new ExcelProtectedRangeCollection(NameSpaceManager, TopNode, this);
return _protectedRanges;
}
}
```
to:
```
public ExcelProtectedRangeCollection ProtectedRanges
{
get
{
if (_protectedRanges == null)
{
_protectedRanges = new ExcelProtectedRangeCollection(NameSpaceManager, TopNode, this);
_protectedRanges.SchemaNodeOrder = SchemaNodeOrder;
}
return _protectedRanges;
}
}
```

Created Unassigned: The same local name in two different worksheets [15386]

$
0
0
I use local name ranges for calculations (i.e. their scope is only within a particular sheet), rather than global named ranges, which apply to an entire workbook. If I have two sheets in a workbook with the same local named range in them, I've noticed that there seems to be a bug.

E.g. I have a range "ClientName" in both Sheet1 and Sheet2 of workbook "Book1". I can read from and write to both names and it seems to work fine. But the property "Worksheet" on the names will both be "Sheet1".

Where this breaks is when I try to copy the entirety of Sheet2 into a different workbook, "Book2". The CopySheetNames() private method in ExcelWorksheets freaks out over the reference to a Worksheet that doesn't exist in Book2, so a null reference exception gets thrown.

I think the issue needs to be traced back to when the ExcelNamedRanges are constructed in the first place. I haven't had a go at fixing it myself in case it's already on your radar, but I'm happy to dig in if it's not.
Viewing all 2262 articles
Browse latest View live


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