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

Edited Unassigned: ExcelRow.Height sets wrong height to ALL drawings in v4.0.4 [15387]

$
0
0
I add some picture (Drawings) with EditAs = OneCell (default) and set size,
then change some row's height, after that, all drawing's heights are changed (changed value is equal to width size).

following is test code:
```
ExcelWorksheet worksheet = package.Workbook.Worksheets.First();
var _imagePath = outputDir.FullName + @"\image.jpg";
var _image = System.Drawing.Image.FromFile(_imagePath);

var picture = worksheet.Drawings.AddPicture("Image", _image);
picture.SetPosition(0, 0, 0, 0);
picture.SetSize(200, 40);
picture.Locked = true;
picture.EditAs = OfficeOpenXml.Drawing.eEditAs.Absolute;

Samplex.AddPicture(worksheet, "Image1", _image, 0, 0, 200, 40);
worksheet.Row(1).Height = 50;
```


In ExcelRow's Height property, there is suspicious code:
```
public double Height
{
...
set
{
var r = GetRowInternal();
if (_worksheet._package.DoAdjustDrawings)
{
var pos = _worksheet.Drawings.GetDrawingWidths();
r.Height = value;
_worksheet.Drawings.AdjustHeight(pos);
}
else
...
}
}
```
Is it not __GetDrawingWidths__ but __GetDrawingHeight__ ?
(I think this codes is based on ExcelColumn's Width property...)

Commented Unassigned: ExcelRow.Height sets wrong height to ALL drawings in v4.0.4 [15387]

$
0
0
I add some picture (Drawings) with EditAs = OneCell (default) and set size,
then change some row's height, after that, all drawing's heights are changed (changed value is equal to width size).

following is test code:
```
ExcelWorksheet worksheet = package.Workbook.Worksheets.First();
var _imagePath = outputDir.FullName + @"\image.jpg";
var _image = System.Drawing.Image.FromFile(_imagePath);

var picture = worksheet.Drawings.AddPicture("Image", _image);
picture.SetPosition(0, 0, 0, 0);
picture.SetSize(200, 40);
picture.Locked = true;
picture.EditAs = OfficeOpenXml.Drawing.eEditAs.Absolute;

Samplex.AddPicture(worksheet, "Image1", _image, 0, 0, 200, 40);
worksheet.Row(1).Height = 50;
```


In ExcelRow's Height property, there is suspicious code:
```
public double Height
{
...
set
{
var r = GetRowInternal();
if (_worksheet._package.DoAdjustDrawings)
{
var pos = _worksheet.Drawings.GetDrawingWidths();
r.Height = value;
_worksheet.Drawings.AdjustHeight(pos);
}
else
...
}
}
```
Is it not __GetDrawingWidths__ but __GetDrawingHeight__ ?
(I think this codes is based on ExcelColumn's Width property...)
Comments: Fixed in changeset 31e4b2540087

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

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

Commented 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!
Comments: As I wrote to you in the discussions forum - I think this is because you are using semicolon as a separator between the arguments to the Indirect function. Excel natively uses comma, which what always should be used with epplus, regardless of client localization. INDIRECT(INDIRECT(ADDRESS(ROW(),1,3)))

Closed 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!

Closed Unassigned: Issue saving complex string value [15395]

$
0
0
When I try to insert a DataTable using

```
sheet.Cells["A1"].LoadFromDataTable(data, true);
```

if the DataTable contains a string column containing large complex data, in my case a geometry GeoJson or KML string value, then the resulting Excel file requires Excel to repair it when opening. Excel provides the following message "Repaired Records: String properties from /xl/sharedStrings.xml part (Strings)".
Comments: Ok, thanks!

Commented 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.
Comments: Thanks for reporting, can you specify which functions that you are referring to? Or at least give an example? In general EPPlus also treats null as 0 in calculations, for example the following test succeeds: ``` // C4 and D4 are empty cells (value == null) _worksheet.Cells["B3"].Formula = "C4 + D4"; _worksheet.Calculate(); var result = _worksheet.Cells["B3"].Value; Assert.AreEqual(0d, result); ``` But in Excel this handling varies from function to function and we have had to try and implement that in EPPlus as well. So you have probably found something that we could correct, but I need some more input to understand what that is. Thanks, /Mats

Closed 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: fix will be included in next release.

Closed Unassigned: ClosedXML files are empty [15388]

$
0
0
I'm using EPPlus to open an .xlsx file generated with ClosedXML library and unfortunately something gets wrong, since the file is opened as an empty worksheet with no data (rows and columns collections are empty).
The file has custom properties and I noticed that they're still present: I'm sorry to say that that they're the only "data" that is maintained when opening with EPPlus library... :(
Are you aware of any compatibilty issues between these two libraries?

Comments: Hi, we are not aware of this. Could you create a new issue and attach the xlsx?

Edited 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

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

Edited Unassigned: InsertColumn(int, int, int) only copies style from first cell in v4.0.4 [15329]

$
0
0
Hello,

the method InsertColumn(int, int, int) only copies style (background-color, border etc) from first cell. That means, that if you insert a new column, the colors from the first cell are applied to all bottom cells. I would expect/need that the style is applied for each cell seperately.

The method InsertRow applies the style for each cell, it's working fine.

I noticed that the concept in the Source Code to set the styles after inserting rows/columns are quite different.

Styles for new rows:
```
if (copyStylesFromRow > 0)
{
var cseS = new CellsStoreEnumerator<int>(_styles, copyStylesFromRow, 0, copyStylesFromRow, ExcelPackage.MaxColumns); //Fixes issue 15068 , 15090
while(cseS.Next())
{
for (var r = 0; r < rows; r++)
{
_styles.SetValue(rowFrom + r, cseS.Column, cseS.Value);
}
}
}
```

Styles for new columns:
```
if (copyStylesFromColumn > 0)
{
for (var c = 0; c < columns; c++)
{
var col = this.Column(columnFrom + c);
col.StyleID = this.Column(copyStylesFromColumn).StyleID;
}
}
```

Thanks in advance

Commented Unassigned: InsertColumn(int, int, int) only copies style from first cell in v4.0.4 [15329]

$
0
0
Hello,

the method InsertColumn(int, int, int) only copies style (background-color, border etc) from first cell. That means, that if you insert a new column, the colors from the first cell are applied to all bottom cells. I would expect/need that the style is applied for each cell seperately.

The method InsertRow applies the style for each cell, it's working fine.

I noticed that the concept in the Source Code to set the styles after inserting rows/columns are quite different.

Styles for new rows:
```
if (copyStylesFromRow > 0)
{
var cseS = new CellsStoreEnumerator<int>(_styles, copyStylesFromRow, 0, copyStylesFromRow, ExcelPackage.MaxColumns); //Fixes issue 15068 , 15090
while(cseS.Next())
{
for (var r = 0; r < rows; r++)
{
_styles.SetValue(rowFrom + r, cseS.Column, cseS.Value);
}
}
}
```

Styles for new columns:
```
if (copyStylesFromColumn > 0)
{
for (var c = 0; c < columns; c++)
{
var col = this.Column(columnFrom + c);
col.StyleID = this.Column(copyStylesFromColumn).StyleID;
}
}
```

Thanks in advance
Comments: Fixed in changeset 76ad63957ea9

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

Commented 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!
Comments: Fixed in changeset 76ad63957ea9

Edited Unassigned: Drawings within a "oneCellAnchor" element are not fully loaded [15371]

$
0
0
In ExcelDrawings.cs, ExcelDrawings.AddDrawings(), there's a switch case which loads up "oneCellAnchor" elements as a basic ExcelDrawing:

```
case "oneCellAnchor":
dr = new ExcelDrawing(this, node, "xdr:sp/xdr:nvSpPr/xdr:cNvPr/@name")
```

My document has ExcelPictures within the oneCellAnchor element. I was able to make these fully load by changing that case to match the others:

```
case "oneCellAnchor":
dr = ExcelDrawing.GetDrawing(this, node);
```

Commented Unassigned: Drawings within a "oneCellAnchor" element are not fully loaded [15371]

$
0
0
In ExcelDrawings.cs, ExcelDrawings.AddDrawings(), there's a switch case which loads up "oneCellAnchor" elements as a basic ExcelDrawing:

```
case "oneCellAnchor":
dr = new ExcelDrawing(this, node, "xdr:sp/xdr:nvSpPr/xdr:cNvPr/@name")
```

My document has ExcelPictures within the oneCellAnchor element. I was able to make these fully load by changing that case to match the others:

```
case "oneCellAnchor":
dr = ExcelDrawing.GetDrawing(this, node);
```
Comments: Fixed in changeset 4927bfd94201

Edited Unassigned: Cannot set column width to zero [15373]

$
0
0
If you try, the column retains its default width. Setting the property is effectively ignored.

Commented Unassigned: Cannot set column width to zero [15373]

$
0
0
If you try, the column retains its default width. Setting the property is effectively ignored.
Comments: Fixed in changeset 4927bfd94201
Viewing all 2262 articles
Browse latest View live


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