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

Commented Unassigned: Version 4.0.4 produces OleDB unreadable workbook [15396]

$
0
0
Hi EPPlus team,
an issue with reading xlsx by OleDB reader was found since we have upgraded EPPlus library from 2.8.0.2 to 4.0.4.0.
In case of 4.0.4 output throws OleDbConnection.Open exception:
> "External table is not in the expected format."

although epp 2.8.0 prododuces OleDB compatible result. See following example for demonstration this behavior:

```C#
static void Main()
{
const string name = "Data";
const string ConnectionStringMask = "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=\"Excel 12.0;ReadOnly=True;HDR=Yes;IMEX=1;TypeGuessRows=0\";Data Source={0}";

var data = new[]
{
new object[] {"AB", "1/1/2010"},
new object[] {"Test", 1.25}
};

var tmp = new FileInfo(Path.GetTempFileName());
if (tmp.Exists) tmp.Delete();
var file = new FileInfo(Path.ChangeExtension(tmp.FullName, ".xlsx"));
if (file.Exists) file.Delete();

using (var excel = new ExcelPackage(file))
{
var sheet = excel.Workbook.Worksheets.Add(name);
var range = sheet.Cells[2, 2].LoadFromArrays(data);
excel.Workbook.Names.Add(name, range);
excel.Save();
}

var constr = string.Format( ConnectionStringMask, file.FullName );
var dt = new DataTable();
using (var con = new OleDbConnection(constr))
{
con.Open();

var cmd = new OleDbCommand(string.Format("SELECT * FROM [{0}]", name), con);
var reader = cmd.ExecuteReader();
if (reader == null) throw new NoNullAllowedException();
dt.Load(reader);
}
}
```
> Both results ( 2.8.0, 4.0.4 ) are open in MS excel without warnings.
> After open and save in MS excel is content readable in OleDB.

Attached is xlsx produced by version 2.0.8

We need to open the xlsx via OleDb, could you help us with a workaround or fix?

Thank you
Comments: see [Opening an Excel (created with EPPLUS) with OleDB](https://epplus.codeplex.com/discussions/560832) martinbeers (Dec 3 at 5:20 PM) modification helps

Created Unassigned: Set BackgroundColor before Font.Color.SetColor [15397]

$
0
0
I can be with the same problem as issue 15329.
When you run the following configuration, for example:

workSheet.Cells ["F: G"] = Style.Fill.PatternType OfficeOpenXml.Style.ExcelFillStyle.Solid;
workSheet.Cells ["F: G"] Style.Fill.BackgroundColor.SetColor ("RED");

And then:

workSheet.Cells ["F:H"] Style.Font.Color.SetColor ("BLUE").

The correct would be the columns "F" and "G" are with background color "Red" with text "blue", however the column "H" just copying the style of previous "column / cell", causing the column "H" continue with the background color" Red ".

If case execute the same flow and we configure the font color for the whole spreadsheet, due to this error cell style check, it generates a self processing and a file with significant size. Logically, because all cells are now with the background color "Red".

Checking the code, the error apparently is to enter the next cell is not made style print of this cell specifies, then retains the style read the first cell of the column group "F:H".

Thanks!

Created Unassigned: Error while use (double) Indirect function [15398]

$
0
0
In a worksheet I have a table. In one of the columns there will be a code of 3 characters. Target is another column with data validation, based on the column with that code. Because I don't know what code will be entered, the formula in the validated column must be the same for the whole column.

In Excel it works fine. For each possible code I create a named range. After that, I use the following code in the List Datavalidation source for the whole column:
```
INDIRECT(INDIRECT(ADDRESS(ROW();1;3)))
```

The code I try to use:
```
Dim myValidat = mySheet.DataValidations.AddListValidation("A2:A7))
With myValidat
.ErrorStyle = OfficeOpenXml.DataValidation.ExcelDataValidationWarningStyle.warning
.ShowErrorMessage = True
.ShowInputMessage = True
.PromptTitle = "prompttitle"
.Prompt = "prompt"
.Formula.ExcelFormula = "INDIRECT(INDIRECT(ADDRESS(ROW();1;3)))"
End With
```

The first indirect is to get the value in the addressed cell.
The second indirect is to call the named range with the value in that cell

In Excel it works fine, but after using it in VB.NET and opening in Excel, that worksheet in that document is in errorstate, starts repairing, and delete the validation of that column.

In attachments you will find a working demo file. What I want is to accomplish this with code in VB.NET and using epplus. Please tell me what I'm doing wrong!

Created Unassigned: External links propagation results into corrupt excel file [15399]

$
0
0
Hi EPPlus developers,

the function _GetDefinedNames_ of _ExcelWorkbook_ replaces external references withing defined names with direct paths to the external files.

```
<definedName name="de">[3]DB!$B$1:$D$59</definedName>
```

```
<definedName name="de">[/DOCUME~1/e9701/LOCALS~1/Temp/xSAPtemp6639.xls]DB!$B$1:$D$59</definedName>
```
This is nice, but only until these extrenal files are stil awailable. If one tries to open the file processed with EPPlus with Excel from a location, there the external files are not awailable; Excel will delete all those defined names, treating them as corrupt.

This is surely not a right behaviour. I propose not to replace the external references with their direct paths. My patch is attached


Edited Unassigned: Remove StyleTest.cs or readd to the test csproj? [15330]

$
0
0
[This file](http://epplus.codeplex.com/SourceControl/latest#EPPlusTest/StyleTest.cs) is not attached to the visual studio project. Should it be removed?

Commented Unassigned: Remove StyleTest.cs or readd to the test csproj? [15330]

$
0
0
[This file](http://epplus.codeplex.com/SourceControl/latest#EPPlusTest/StyleTest.cs) is not attached to the visual studio project. Should it be removed?
Comments: Fixed in changeset 31e4b2540087

Edited Unassigned: NotSupportedException: This property or method is not supported for a Chartsheet [15367]

$
0
0
Getting this error in the 4.0.4 that did not happen with 3.1.3.

[NotSupportedException: This property or method is not supported for a Chartsheet]
OfficeOpenXml.ExcelWorksheet.get_Tables() +221
OfficeOpenXml.ExcelWorkbook.ReadAllTables() +144
OfficeOpenXml.ExcelWorksheet.get_Tables() +78
OfficeOpenXml.ExcelWorksheet.SaveTables() +60
OfficeOpenXml.ExcelWorksheet.Save() +303
OfficeOpenXml.ExcelWorkbook.Save() +715
OfficeOpenXml.ExcelPackage.GetAsByteArray(Boolean save) +39

Nothing has changed in my code. I just updated the EPPlus.dll via Nuget.

Here is a list of methods/commands that I am running against the ExcelPackage (pck) and ExcelWorksheet (wsTarget):
* pck.GetAsByteArray(); <-- this is where it bombs
* wsTarget.Cells[ca.Target.Range].LoadFromDataTable(ds.Tables[ca.Source.Name], ca.Source.CopyHeaders)
* wsTarget.HeaderFooter.FirstHeader.LeftAlignedText = ds.Tables[ca.Source.Name].Rows[0].ItemArray[0].ToString();
* wsTarget.HeaderFooter.EvenHeader.LeftAlignedText = ds.Tables[ca.Source.Name].Rows[0].ItemArray[0].ToString();
* wsTarget.HeaderFooter.OddHeader.LeftAlignedText = ds.Tables[ca.Source.Name].Rows[0].ItemArray[0].ToString();
* wsTarget.HeaderFooter.differentFirst = false;
* wsTarget.Cells[ca.Target.Range].Style.HorizontalAlignment = eha;
* wsTarget.Cells[ca.Target.Range].Style.Numberformat.Format = ca.Source.Format;

That's pretty much it. I don't do anything else with it and these are all pretty basic API calls, so I'm not sure why it will not work in the newer version.

I back rev'd to 3.1.3 so I'm fine for now, but I thought you might want to know there may be something going on.

Commented Unassigned: NotSupportedException: This property or method is not supported for a Chartsheet [15367]

$
0
0
Getting this error in the 4.0.4 that did not happen with 3.1.3.

[NotSupportedException: This property or method is not supported for a Chartsheet]
OfficeOpenXml.ExcelWorksheet.get_Tables() +221
OfficeOpenXml.ExcelWorkbook.ReadAllTables() +144
OfficeOpenXml.ExcelWorksheet.get_Tables() +78
OfficeOpenXml.ExcelWorksheet.SaveTables() +60
OfficeOpenXml.ExcelWorksheet.Save() +303
OfficeOpenXml.ExcelWorkbook.Save() +715
OfficeOpenXml.ExcelPackage.GetAsByteArray(Boolean save) +39

Nothing has changed in my code. I just updated the EPPlus.dll via Nuget.

Here is a list of methods/commands that I am running against the ExcelPackage (pck) and ExcelWorksheet (wsTarget):
* pck.GetAsByteArray(); <-- this is where it bombs
* wsTarget.Cells[ca.Target.Range].LoadFromDataTable(ds.Tables[ca.Source.Name], ca.Source.CopyHeaders)
* wsTarget.HeaderFooter.FirstHeader.LeftAlignedText = ds.Tables[ca.Source.Name].Rows[0].ItemArray[0].ToString();
* wsTarget.HeaderFooter.EvenHeader.LeftAlignedText = ds.Tables[ca.Source.Name].Rows[0].ItemArray[0].ToString();
* wsTarget.HeaderFooter.OddHeader.LeftAlignedText = ds.Tables[ca.Source.Name].Rows[0].ItemArray[0].ToString();
* wsTarget.HeaderFooter.differentFirst = false;
* wsTarget.Cells[ca.Target.Range].Style.HorizontalAlignment = eha;
* wsTarget.Cells[ca.Target.Range].Style.Numberformat.Format = ca.Source.Format;

That's pretty much it. I don't do anything else with it and these are all pretty basic API calls, so I'm not sure why it will not work in the newer version.

I back rev'd to 3.1.3 so I'm fine for now, but I thought you might want to know there may be something going on.
Comments: Fixed in changeset 31e4b2540087

Edited 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.

Commented 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.
Comments: Fixed in changeset 31e4b2540087

Edited 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

Commented 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
Comments: Fixed in changeset 31e4b2540087

Edited 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);
}
```

Commented 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);
}
```
Comments: Fixed in changeset 31e4b2540087

Edited 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: 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).

Comments: Fixed in changeset 31e4b2540087

Edited 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: Fixed in changeset 31e4b2540087

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;
}
}
```

Commented 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;
}
}
```
Comments: Fixed in changeset 31e4b2540087
Viewing all 2262 articles
Browse latest View live


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