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

Commented Unassigned: How to Read .xls format file Using Epplus [15355]

$
0
0
i can read .xlsx file format using epplus but i cant read file format .xls so pls help me to read .xls file format
or any convert method .xls to .xlsx
Comments: EPPlus is a .net library that reads and writes Excel 2007/2010 files using the Open Office Xml format (xlsx).

Edited Unassigned: epplus 4.0.4: wrong row height [15344]

$
0
0
```
OfficeOpenXml.ExcelPackage pkg =
new OfficeOpenXml.ExcelPackage( new FileInfo(@"C:\Test\Out\out_file.xlsx")
, new FileInfo(@"C:\Test\template_2.xlsx"));
pkg.Save();
```

The template has a line of varying heights, EPPlus 4.0.4 resize rows without my participation.

For example, in the template file "template_2.xlsx" line 1,2,4,5 have a height: 0.3cm, but in the resulting file, we see that the height of rows changed.

Why is that?

__UPDATE:__
File: ExcelWorksheet.cs
private void WriteRow(StringBuilder cache, ExcelStyleCollection<ExcelXfs> cellXfs, int prevRow, int row)

If condition:

```
else if (currRow.Height != DefaultRowHeight && currRow.Height>=0)
{
cache.AppendFormat(string.Format(CultureInfo.InvariantCulture, "ht=\"{0}\" ", currRow.Height));
if (currRow.CustomHeight)
{
cache.Append("customHeight=\"1\" ");
}
}
```

then rows height in result file - INCORRECT

if condition :

```
else if (currRow.Height>=0)
{
cache.AppendFormat(string.Format(CultureInfo.InvariantCulture, "ht=\"{0}\" ", currRow.Height));
if (currRow.CustomHeight)
{
cache.Append("customHeight=\"1\" ");
}
}
```

then result file is OK !

Edited Unassigned: epplus 4.0.4: wrong row height [15344]

$
0
0
```
OfficeOpenXml.ExcelPackage pkg =
new OfficeOpenXml.ExcelPackage( new FileInfo(@"C:\Test\Out\out_file.xlsx")
, new FileInfo(@"C:\Test\template_2.xlsx"));
pkg.Save();
```

The template has a line of varying heights, EPPlus 4.0.4 resize rows without my participation.

For example, in the template file "template_2.xlsx" line 1,2,4,5 have a height: 0.3cm, but in the resulting file, we see that the height of rows changed.

Why is that?

__UPDATE:__
File: ExcelWorksheet.cs
private void WriteRow(StringBuilder cache, ExcelStyleCollection<ExcelXfs> cellXfs, int prevRow, int row)

If condition:

```
else if (currRow.Height != DefaultRowHeight && currRow.Height>=0)
{
cache.AppendFormat(string.Format(CultureInfo.InvariantCulture, "ht=\"{0}\" ", currRow.Height));
if (currRow.CustomHeight)
{
cache.Append("customHeight=\"1\" ");
}
}
```

then rows height in result file - INCORRECT

if condition :

```
else if (currRow.Height>=0)
{
cache.AppendFormat(string.Format(CultureInfo.InvariantCulture, "ht=\"{0}\" ", currRow.Height));
if (currRow.CustomHeight)
{
cache.Append("customHeight=\"1\" ");
}
}
```

then result file is OK !

PS. MS Office 2010

Created Unassigned: How to open a worksheet in an Excel file using EPPlus [15356]

$
0
0
There is a Default Excel Sheet. I want to Export data to the default Excel template which I can able to do using OledbCommand. I want some formatting to be done after exporting the data.

When I to try to open a worksheet in an Excel file, I am getting System.ArgumentException : An item with the same key has already been added.

Please find below the code I used for accessing the Excel file.

using (OfficeOpenXml.ExcelPackage xlPackage = new OfficeOpenXml.ExcelPackage(new FileInfo(FilePathAndName)))
{
var worksheet = xlPackage.Workbook.Worksheets[3];

if (worksheet != null)
{
//if (Worksheets.Count > 0)
//{
// var worksheet = xlPackage.Workbook.Worksheets["Accounts"];

using (OfficeOpenXml.ExcelRange range = worksheet.Cells["C8:H8"])
{
range.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.White);
range.Style.Font.SetFromFont(new Font("Arial", 10));
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.CenterContinuous;
worksheet.View.ShowGridLines = true;
}
xlPackage.Save();
// }
}

Commented Unassigned: How to open a worksheet in an Excel file using EPPlus [15356]

$
0
0
There is a Default Excel Sheet. I want to Export data to the default Excel template which I can able to do using OledbCommand. I want some formatting to be done after exporting the data.

When I to try to open a worksheet in an Excel file, I am getting System.ArgumentException : An item with the same key has already been added.

Please find below the code I used for accessing the Excel file.

using (OfficeOpenXml.ExcelPackage xlPackage = new OfficeOpenXml.ExcelPackage(new FileInfo(FilePathAndName)))
{
var worksheet = xlPackage.Workbook.Worksheets[3];

if (worksheet != null)
{
//if (Worksheets.Count > 0)
//{
// var worksheet = xlPackage.Workbook.Worksheets["Accounts"];

using (OfficeOpenXml.ExcelRange range = worksheet.Cells["C8:H8"])
{
range.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.White);
range.Style.Font.SetFromFont(new Font("Arial", 10));
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.CenterContinuous;
worksheet.View.ShowGridLines = true;
}
xlPackage.Save();
// }
}

Comments: var worksheet = xlPackage.Workbook.Worksheets[3]; // <- Workbook already has a worksheet at location 3.

Commented Unassigned: How to Read .xls format file Using Epplus [15355]

$
0
0
i can read .xlsx file format using epplus but i cant read file format .xls so pls help me to read .xls file format
or any convert method .xls to .xlsx
Comments: Not possible. Please find another library. . http://stackoverflow.com/questions/26152215/error-when-trying-to-read-an-xls-file-using-epplus

Commented Unassigned: large Strings in cells corrupt file [15352]

$
0
0
Create a cell value with a string larger then 32768 characters seems not possible for ms excel 2013. After saving this file with EPPlus and open in MS Excel 2013 you get an message "file corrupt ...". The repair log shows an error in part SharedStrings.

Maybe EPPlus should throw an exception if a cell contain a string larger then 32768 chars.
Comments: String length is Excel dependent and perhaps will increase with future versions of Office. Easier way perhaps, is to check your string by going something like: ``` if strVal.Length > 32767 { /* trim or error code here */} ```

Created Unassigned: Can not open a hidden worksheet [15357]

$
0
0
My process can open and use the worksheets there are hidden in the workbook. I get an error, when I run this on a sheet that is hidden. If it is not hidden, then no error. Is this a bug?
In VB, where Sht is the sheetname.
objExcel.Workbook.Worksheets(Sht).Hidden = False

Created Unassigned: Creating a Comment with an empty Author leads to corrupt Excel file [15358]

$
0
0
Hi EPPlus developers,

a fix from 01 Sept 2015 (65115680ca04) on ___ExcelRangeBase.AddComment___ invoked some deeper problem, which existed already before.
Creating a Comment with an empty Author
```
package.Workbook.Worksheets.First().Cells["A1"].AddComment("Text", String.Empty);
```
will lead to a cell with no __authorId__ attribute
```
<comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<authors/>
<commentList>
<comment ref="D1" >
<text>
...
```
This is not allowed by specification. See ___18.7.1 author (Author)___

> This element holds a string representing the name of a single author of comments. Every comment shall have an author.


Excel does not want to open these files either and repares them by deleting the whole comment tag. I think this is not crucial, if you will allow emty Author again. By the way, if ___Author___ property of ___ExcelComment___ class is read, when it was never set before - it throws a NullReferenceException.

Created Unassigned: First Few rows not getting formatted in Epplus 4.0.4 [15359]

$
0
0

i am opening an existing blank excel template and copy the worksheet and write the data in it and useing save as i stored in different name.

Previously i developed the application 3.1 version all formatting works fine and now used new version 4.0.4 by generating same excel it shows first few rows is not formatiing.

Any help please appreciated! Thanks!

Commented Unassigned: How to open a worksheet in an Excel file using EPPlus [15356]

$
0
0
There is a Default Excel Sheet. I want to Export data to the default Excel template which I can able to do using OledbCommand. I want some formatting to be done after exporting the data.

When I to try to open a worksheet in an Excel file, I am getting System.ArgumentException : An item with the same key has already been added.

Please find below the code I used for accessing the Excel file.

using (OfficeOpenXml.ExcelPackage xlPackage = new OfficeOpenXml.ExcelPackage(new FileInfo(FilePathAndName)))
{
var worksheet = xlPackage.Workbook.Worksheets[3];

if (worksheet != null)
{
//if (Worksheets.Count > 0)
//{
// var worksheet = xlPackage.Workbook.Worksheets["Accounts"];

using (OfficeOpenXml.ExcelRange range = worksheet.Cells["C8:H8"])
{
range.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
range.Style.Fill.BackgroundColor.SetColor(Color.White);
range.Style.Font.SetFromFont(new Font("Arial", 10));
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.CenterContinuous;
worksheet.View.ShowGridLines = true;
}
xlPackage.Save();
// }
}

Comments: I have to open the worksheet at loacation 3. I have to format the Excel sheet cells like change the background color of cell and change the font size and font family. I also want to delete the formula columns. Please give suggestion for this.

Created Unassigned: issues with .xlsm file saving [15360]

$
0
0
Hi Guys,

Does anyone know how to save changes to a .xlsm excel cell that has a formula using EPPLUS, Excelpackage.save() does not save the changes it merely puts them there until I physically open the file and save the changes using Excel,

Thanks in advance.

Created Unassigned: When a Normal style is not called "Normal" [15361]

$
0
0
Hi EPPlus developers,

there could be excel files (see attachment for an example) where built in Normal style does not has a name "Normal" but "Standard" (very old migrated xls files). EPPlus save these files ignoring this built in style, which lead to corrupt xlsx files in result.

The sollution to the problem is to look not only for __NamedStyle.Name == "Normal"__ but allso for __NamedStyle.BuildInId == 0__

My proposed solution I added as a patch to the ticket [15349](https://epplus.codeplex.com/workitem/15349). The problem for the ticket 15349 has to be solved on the same place.

Commented Unassigned: cellStyleXfs records are copied to cellXfs resulting in a corruppt xlsx file [15349]

$
0
0
Hi EPPlus developers,

shortly I got a problem with an excel file, which was corrupt after I opened and saved it with EPPlus. The file is attached, one can reproduce the problem using following snippet:
```
using (ExcelPackage package = new ExcelPackage(
new FileInfo(openPath)))
{ package.SaveAs(new FileInfo(savePath)); }
```
For some reason this almost emty file has thousands of named styles. Extended properties of the named styles are normally stored in _<cellStyleXfs>_ node of the _styles.xml_. But when EPPlus saves this file those cellStyleXfs are additionally written to _<cellXfs>_ node. Which is not right according to specification and also Excel has problem opening this file afterwards.

My fix suggestion is:
1. change AddNamedStyle function of ExcelStyles like following:
```
private void AddNamedStyle(int id, XmlNode styleXfsNode,XmlNode cellXfsNode, ExcelNamedStyleXml style)
{
var styleXfs = CellStyleXfs[style.StyleXfId];
styleXfsNode.AppendChild(styleXfs.CreateXmlNode(_styleXml.CreateElement("xf", ExcelPackage.schemaMain), true));
styleXfs.newID = id;
styleXfs.XfId = style.StyleXfId;

var ix = CellXfs.FindIndexByID(styleXfs.Id);
if (ix >= 0)
{
if(id<0) CellXfs[ix].XfId = id;
cellXfsNode.AppendChild(CellXfs[ix].CreateXmlNode(_styleXml.CreateElement("xf", ExcelPackage.schemaMain)));
CellXfs[ix].useCnt = 0;
CellXfs[ix].newID = id;
}

if (style.XfId >= 0)
style.XfId = CellXfs[style.XfId].newID;
else
style.XfId = 0;
}
```

2. change UpdateXml function of ExcelStyles like following:
Snippet between the comments ___//CellStyle___ and the ___//Set dxf styling for conditional Formatting___
```
...
//CellStyle
int xfix = 0;
foreach (ExcelXfs xf in CellXfs)
{
if (xf.useCnt > 0 )
{
cellXfsNode.AppendChild(xf.CreateXmlNode(_styleXml.CreateElement("xf", ExcelPackage.schemaMain)));
xf.newID = xfix;
count++;
}
xfix++;
}
(cellXfsNode as XmlElement).SetAttribute("count", cellXfsNode.ChildNodes.Count.ToString());

//Set dxf styling for conditional Formatting
...
```

I tested this at my site and it works stable.
Comments: Hi, I found and fixed one problem in the upper solution. Please use the attached patch instead of picking the changes from the text in the previous comment. This patch includes also a solution for the ticket [15361](https://epplus.codeplex.com/workitem/15361) because its fix had to be done on the same place

Created Unassigned: Excel File is corrupt after setting a Named Range VAlue [15362]

$
0
0
Hi,

I use EPPlus to set some named range values (always on a single cell) in an Excel 2013 document. If I open the file in Excel after writing the value Excel is telling it has to repair the corrupt file.

This is the write method I use:

public void WriteRangeValue(string RangeName, string Value)
{
_package.Workbook.Names[RangeName].Value = Value;
}

Here is the recovery Logfile:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error174040_01.xml</logFileName><summary>Fehler in Datei 'C:\TEMP\Test.xlsx'</summary><repairedRecords summary="Die folgenden Reparaturen wurden durchgeführt:_x000d__x000a__x000d__x000a_"><repairedRecord>Reparierte Datensätze: Zellinformationen von /xl/worksheets/sheet19.xml-Part</repairedRecord><repairedRecord>Reparierte Datensätze: Zellinformationen von /xl/worksheets/sheet20.xml-Part</repairedRecord><repairedRecord>Reparierte Datensätze: Zellinformationen von /xl/worksheets/sheet21.xml-Part</repairedRecord></repairedRecords></recoveryLog>

Thanks for any help!

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: We have the same issue. It is posible to know if this will be fixed soon?

Created Unassigned: Changing the Color of the Majorgrid? [15363]

$
0
0
Hey Guys,

Is it possible to change the color of the majorgrid in a without directly manipulating the xml of the excel? I didn't found a property for that.

Thanks for any help!

Edited Unassigned: Changing the Color of the Majorgrid? [15363]

$
0
0
Hey Guys,

Is it possible to change the color of the majorgrid in a ColumnClustered-Chart without directly manipulating the xml of the excel? I didn't found a property for that.

Thanks for any help!

Created Unassigned: New release please [15364]

$
0
0
A very ugly bug has been fixed in changeset b4e5169e301b9e666010952538a8d73cd94667ef , but that changeset is not included in any release. Please release so that we can have the fix.

Thanks!

Created Unassigned: external file cell in formula [15365]

$
0
0
How can get the value of external cell calculation in excel sheet? I use .Calculate method but still It does not return any value.

=SUM('G:\RND\ReadWriteExcelFile\ReadWriteExcelFile\ExlFile[Test1.xlsx]Sheet1'!$A$4:$B$4)

We are using above formul. It does not return any value.

Is there any help for this?
Viewing all 2262 articles
Browse latest View live


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