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

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

Created Unassigned: ExcelHorizontalAlignment not work on new file [15262]

$
0
0
If I create a new file and I use the horizontal alignment on the first two cells, the first cell works properly, the second cell is not aligned correctly.
```
FileInfo woFileInfo = new FileInfo(wStrFileExcel);
ExcelPackage woPackage = new ExcelPackage(woFileInfo);
ExcelWorksheet woExcelWorksheet = woPackage.Workbook.Worksheets.Add("TestSheet");
ExcelRange woExcelRange = null;
woExcelRange = woExcelWorksheet.Cells(1, 1);
woExcelRange.Value = "Test1";
woExcelRange.Style.HorizontalAlignment = Style.ExcelHorizontalAlignment.Right;
woExcelRange = woExcelWorksheet.Cells(1, 2);
woExcelRange.Value = "Test2";
woExcelRange.Style.HorizontalAlignment = Style.ExcelHorizontalAlignment.Left;
woPackage.Save();
woPackage.Dispose();
```

Created Unassigned: FIPS Compliant Encryption [15263]

$
0
0
We are using the library at a US Gov site to send encrypted spreadsheets, and it has been great until moving to a Win 2008 Server (that's modern here). The 2008 servers have FIPS compliance set enabled and cannot be toggled off since the settings are governed by a policy setting that is pushed from a central server. So we have no choice but to get the encryption to use one of the un-managed, FIPS certified algorithms.

I see that the "" provides for the un-managed TripleDES, which is considered compliant, but that the "EncryptPackageAgile" method has a hardcoded XML string that it ingests to configure the Agile encryption. From what I can tell, it will always use the AES implementation that uses RindjaelManaged package, which having the wonderful "Managed" as part of its name is thus not FIPS compliance (FIPS is so uncool).

Anyway, if you want someone to have a go at clearing this path, let me know. I may have some time to dedicate to it. Perhaps I missed something. I'll try to fork it and see if I can get through it. If it is in working order, it might just need a decent sample added.

Commented Unassigned: [4.0 RC1] COMException on opening of HttpInputStream that is not a valid Excel file [15091]

$
0
0
Repro steps:
1) Create a simple text file (or just use INVALID EXCEL FILE.xlsx in attached sample project)
2) Upload it to a web application (ASP .NET MVC application, for example)
3) The uploaded file comes in as a HttpInputStream. Instantiate a new ExcelPackage instance using this stream
Actual Result:
__COMException__ is thrown with a message: "A disk error occurred during a write operation. (Exception from HRESULT: 0x8003001D (STG_E_WRITEFAULT))"
Expected:
__FileFormatException__ is thrown with a message like:
"The file is not a valid Excel 2007 file"
or just
"The file contains corrupt data"

I've attached an archive with a lightweight sample ASP .NET MVC application, where it is very easy to reproduce the problem.
Comments: I just had that same error with my local install of NopCommerce (3.5) for asp.net mvc. I exported products in an excel file from a previous version of Nop and tried the "import from excel" function in the new version and got: ``` A disk error occurred during a write operation. (Exception from HRESULT: 0x8003001D (STG_E_WRITEFAULT)) ``` Any idea?

Commented 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 open 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
Comments: It's very unusual to be using the 64bit version of office unless you work with massive documents. The 32 bit version of office is the primary version that's supposed to be used on both 32 and 64bit systems. 64bit office also has quite a few limitations that the 32 bit version doesn't have. Mainly, compatible with many office addons and vba office scripts, interop, etc. All that said, it looks like there are many worksheets referenced that are possibly empty or missing? Might check the code to be sure that you're not creating worksheets where you're not adding any cells to...

Commented 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!
Comments: I think I am seeing a similar problem, and I can provide detail. The simple workbook I am trying to load has an invalid defined name: name: badName refers to: "!C3" (note the empty sheet name) If I try to load the sheet using the following snippet: var info = new FileInfo(reference.FullPath); var package = new ExcelPackage(info); var workbook = package.Workbook; ... it throws out of the ExcelRangeBase ctor with a null reference to xlWorksheet. I will try to attach a simple sample spreadsheet. Like the OP, I am new to codeplex, but I will try the suggested fix here as well. In the meantime, I have voted the issue up.

Commented 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!
Comments: Am attaching file for previous comment.

Commented Unassigned: FIPS Compliant Encryption [15263]

$
0
0
We are using the library at a US Gov site to send encrypted spreadsheets, and it has been great until moving to a Win 2008 Server (that's modern here). The 2008 servers have FIPS compliance set enabled and cannot be toggled off since the settings are governed by a policy setting that is pushed from a central server. So we have no choice but to get the encryption to use one of the un-managed, FIPS certified algorithms.

I see that the "" provides for the un-managed TripleDES, which is considered compliant, but that the "EncryptPackageAgile" method has a hardcoded XML string that it ingests to configure the Agile encryption. From what I can tell, it will always use the AES implementation that uses RindjaelManaged package, which having the wonderful "Managed" as part of its name is thus not FIPS compliance (FIPS is so uncool).

Anyway, if you want someone to have a go at clearing this path, let me know. I may have some time to dedicate to it. Perhaps I missed something. I'll try to fork it and see if I can get through it. If it is in working order, it might just need a decent sample added.
Comments: I created a Fork (https://hg.codeplex.com/forks/mpolutta/epplusfips). The fix for FIPS compliance was actually not very intrusive. Some of the Managed code libraries were not certified (even though no doubt they contain the same algorithm). I replaced "RijndaelManaged" with "#if !MONO" compile directives that allowed for the AesCryptoProvider on MS platforms and used the Aes.Create() factory method to instantiate the best option for the platform otherwise. The Sha1Managed was likewise replaced with the Sha1Cng implementation. I tested this on a Windows Server 2008 R2 with the FIPS registry setting enabled. I used the Agile Version setting: package.Encryption.Version = EncryptionVersion.Agile;

Created Unassigned: Consider using recyclablememorystream to speed up generation of large spreadsheets [15264]

$
0
0
I want to investigate the benefits and risks of this: https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream

Commented Unassigned: TimeSpan greather than 24 hours [15031]

$
0
0
Hello guys,

I request permission to expose a problem.

When i try to add an value of TimeSpan greather than 24 hours, exists an problem to converto to OADate, in internals of EPPlus.

Conversion causes a OverflowException, which ends up leaving as the value 0 in xls.

To solve, i SUGGEST override this code:

d = new DateTime(((TimeSpan)v).Ticks).ToOADate();

for this:

d = DateTime.FromOADate(0).Add(((TimeSpan)v)).ToOADate();

this solved problem for me.

Thanks a lot for this project, EPPlus is amazing...




Comments: From both the code and the precompiled DLL I just downloaded it's still be an issue. These three locations need to be fixed: ``` --- a/Tredjeparts/epplus_6aec320281a6/EPPlus/FormulaParsing/ExpressionGraph/CompileResult.cs +++ b/Tredjeparts/epplus_6aec320281a6/EPPlus/FormulaParsing/ExpressionGraph/CompileResult.cs @@ -98,7 +98,7 @@ namespace OfficeOpenXml.FormulaParsing.ExpressionGraph } else if(Result is TimeSpan) { - return new DateTime(((TimeSpan)Result).Ticks).ToOADate(); + return DateTime.FromOADate(0).Add((TimeSpan)Result).ToOADate(); } else if (IsNumericString) { --- a/Tredjeparts/epplus_6aec320281a6/EPPlus/ExcelWorksheet.cs +++ b/Tredjeparts/epplus_6aec320281a6/EPPlus/ExcelWorksheet.cs @@ -3607,7 +3607,7 @@ namespace OfficeOpenXml } else if (v is TimeSpan) { - s = new DateTime(((TimeSpan)v).Ticks).ToOADate().ToString(CultureInfo.InvariantCulture); ; + s = DateTime.FromOADate(0).Add(((TimeSpan)v)).ToOADate().ToString(CultureInfo.InvariantCulture); } else if(v.GetType().IsPrimitive || v is double || v is decimal) { --- a/Tredjeparts/epplus_6aec320281a6/EPPlus/ExcelRangeBase.cs +++ b/Tredjeparts/epplus_6aec320281a6/EPPlus/ExcelRangeBase.cs @@ -1042,7 +1042,7 @@ namespace OfficeOpenXml } else { - double d = (new DateTime(((TimeSpan)v).Ticks)).ToOADate(); + double d = DateTime.FromOADate(0).Add((TimeSpan)v).ToOADate(); if (string.IsNullOrEmpty(nf.FractionFormat)) { return d.ToString(format, nf.Culture); ```

Created Unassigned: RepeatRows corrupts using worksheet name with apostrophe [15265]

$
0
0
In the xml, if using RepeatRows and a worksheet name with an apostrophe the workbook comes up as corrupted due to apostrophe's used to specify the worksheet name. Below is the workbook.xml where you can see the error in the definedNames section.

```
<workbook xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<bookViews>
<workbookView />
</bookViews>
<sheets>
<sheet name="Michelle's Report" sheetId="1" r:id="rId1" />
</sheets>
<definedNames>
<definedName name="_xlnm.Print_Titles" localSheetId="0">'Michelle's Report'!$1:$1</definedName>
</definedNames>
<calcPr fullCalcOnLoad="1" />
</workbook>
```

Edited Unassigned: RepeatRows corrupts using worksheet name with apostrophe [15265]

$
0
0
If using RepeatRows and a worksheet name with an apostrophe the workbook comes up as corrupted due to apostrophe's used to specify the worksheet name. Below is the workbook.xml where you can see the error in the definedNames section.

```
<workbook xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<bookViews>
<workbookView />
</bookViews>
<sheets>
<sheet name="Michelle's Report" sheetId="1" r:id="rId1" />
</sheets>
<definedNames>
<definedName name="_xlnm.Print_Titles" localSheetId="0">'Michelle's Report'!$1:$1</definedName>
</definedNames>
<calcPr fullCalcOnLoad="1" />
</workbook>
```

Commented Unassigned: Supplied properties in parameter Properties must be of the same type as T [14946]

$
0
0
First of all I'd like to thank you for this great plugin.

In the following file,

EPPlus\ExcelRangeBase.cs

the following method,

public ExcelRangeBase LoadFromCollection<T>(IEnumerable<T> Collection, bool PrintHeaders, TableStyles TableStyle, BindingFlags memberFlags, MemberInfo[] Members)

There is this following code which is throwing an exception when passing a dynamic object T with known MemberInfos.

var type = typeof(T);
if (Members == null)
{
Members = type.GetProperties(memberFlags);
}
else
{
foreach (var t in Members)
{
if (t.DeclaringType != type)
{
throw (new Exception("Supplied properties in parameter Properties must be of the same type as T"));
}
}
}

Currently I have commented this code and importing the whole source code in my solution. If the 'else' part is commented out all is working well even with dynamic objects.

Do you think you could comment the else part and update the nuget? if not why do you have to check the types of individual properties? This would not allow dynamic objects to be passed using dynamic keyword.

Please let me know.

Thank you.
Comments: I have a similar situation, and this doesn't quite fix it. I have a base class with property X. The collection I'm passing in is of type T which is a derived class. I'm passing in property X as one of the members. Can you add another check to the if statement... something like: && !type.IsSubclassOf(t.DeclaringType)

Created Unassigned: Problem saving spreadsheet with PivotTables [15266]

$
0
0
Latest version throwing an exception in ExcelWorkSheet.cs method SavePivotTables when using a template with pivot tables.

problem line
```
var ws = Workbook.Worksheets[pt.CacheDefinition.SourceRange.WorkSheet];
```
SourceRange is null in the Sheet I am saving.


Created Unassigned: Excel chart Axis Title [15267]

$
0
0
Hi

I am trying to change the orientation of each tick label in a chart, and to change it's format from "dd/MM/yyyy HH:mm:ss" to "dd/MM/yyyy" but it's not working.

chart.XAxis.Title.Rotation = 315;
chart.XAxis.Format = "dd/MM/yyyy";

Commented Unassigned: Problem saving spreadsheet with PivotTables [15266]

$
0
0
Latest version throwing an exception in ExcelWorkSheet.cs method SavePivotTables when using a template with pivot tables.

problem line
```
var ws = Workbook.Worksheets[pt.CacheDefinition.SourceRange.WorkSheet];
```
SourceRange is null in the Sheet I am saving.


Comments: I have the same issue and it happens only when the pivot table has a Table Name as source data. If the source is somethig like __'raw data'!$A$1:$H$18__ instead of __Table1__, then you will have no problem. This is for sure something that has to be fixed for next version of EPPlus by changing the way the Cache is read so that the SourceRange attribute gets populated the right way instead of being null, as it is right now for the case stated above. But for now the workaround is just to transform your source table to a plain range of data (https://support.office.com/en-sg/article/Convert-an-Excel-table-to-a-range-of-data-0b326ff1-1764-4ebe-84ea-786265d41c77) using Microsoft Office Excel or trying to reassign the source data for the pivot table as a range via EPPlus if you know the range dimensions. Cheers.

Commented Unassigned: Problem saving spreadsheet with PivotTables [15266]

$
0
0
Latest version throwing an exception in ExcelWorkSheet.cs method SavePivotTables when using a template with pivot tables.

problem line
```
var ws = Workbook.Worksheets[pt.CacheDefinition.SourceRange.WorkSheet];
```
SourceRange is null in the Sheet I am saving.


Comments: As a workaround I've just added a null test before the code block throwing the exception.

Created Unassigned: Load xlsm file [15268]

$
0
0
Hi,
i have created xlsm file with open file xml sdk concept. In that file , only xml is viewed in the sheet. I would like to know is it possible to modify xml using EPPLus package.

Regards

Commented Unassigned: Load xlsm file [15268]

$
0
0
Hi,
i have created xlsm file with open file xml sdk concept. In that file , only xml is viewed in the sheet. I would like to know is it possible to modify xml using EPPLus package.

Regards
Comments: i have attached sample xlsm file. i need to add picture using epplus api. string FileName ="6576_5075_28-04-2015_11_30_47148.xlsm"; FileInfo objFileInfo = new FileInfo(FileName); using (ExcelPackage Package = new ExcelPackage(objFileInfo)) { ExcelWorkbook workbook = Package .Workbook; if (workbook == null) { throw new Exception("Excel file has no workbooks!"); } else { if (workbook.Worksheets.Count == 0) { throw new Exception("Excel file has no worksheets!"); } else { ExcelWorksheet sheet = workbook.Worksheets.First(); string filePath = "Zeeshan Umar.jpg"; string imageName = "EmployeePhoto"; Bitmap image = new Bitmap(filePath); ExcelPicture picture = null; if (image != null) { picture = WorkSheetData.Drawings.AddPicture(imageName, image); picture.From.Column = 10; picture.From.Row = 5; picture.SetSize(100, 100); } } } } But am getting message as "Excel file does not have sheets". actually its having sheet with xml format. Please guide me to resolve this case.

Created Unassigned: mail merge fails at 4.0.4, was fine with 4.0.3 [15269]

$
0
0
Hi, I'm using EPPlus to generate excel file, that will feeds Microsoft.Office.Interop.Word.MailMerge with

```
docMerge.OpenDataSource(
dataFile.FullName,
ReadOnly: true,
SQLStatement: query);
```

where dataFile is poining the xlsx generated by EPPlus with this method:
```
//Step 1 : Create object of ExcelPackage class and pass file path to constructor.
using (var package = new ExcelPackage(newFile))
{
table.TableName = table.TableName.HasNoValue()
? "Table1"
: Regex.Replace(table.TableName, @"[^\w\s\-]*", "", RegexOptions.Compiled);

//Step 2 : Add a new worksheet to ExcelPackage object and give a suitable name
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(table.TableName);

//Step 3 : Start loading dataTable form A1 cell of worksheet.
worksheet.Cells["A1"].LoadFromDataTable(table, true, TableStyles.None);

//Step 4 : (Optional) Set the file properties like title, author and subject
package.Workbook.Properties.Title = @"CBR Export";
package.Workbook.Properties.Author = Core.CurrentUserName;
package.Workbook.Properties.Subject = @"";

//Step 5 : Save all changes to ExcelPackage object which will create Excel 2007 file.
package.Save();
}
```

Nothing fancy, but it started to fail after upgrading to 4.0.4 with "Error has occurred: External table is not in the expected format", I did comparison of xml inside both, and the difference are:

\good\xl\styles.xml
```
<cellStyleXfs count="1">
<xf numFmtId="0" fontId="0" />
</cellStyleXfs>
<cellXfs count="1">
<xf numFmtId="0" applyNumberFormat="1" fontId="0" applyFont="1" xfId="0" />
</cellXfs>
```
fail
```
<cellStyleXfs count="1">
<xf fontId="0" />
</cellStyleXfs>
<cellXfs count="1">
<xf fontId="0" applyFont="1" xfId="0" />
</cellXfs>
```

also there is different position of worksheets/sheet1.xml in [Content_Types].xml
```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default ContentType="application/xml" Extension="xml"/>
<Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" PartName="/xl/workbook.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" PartName="/xl/worksheets/sheet1.xml" />
<Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" PartName="/docProps/app.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml" PartName="/docProps/custom.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" PartName="/xl/styles.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml" PartName="/xl/tables/table1.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" PartName="/xl/sharedStrings.xml" />
</Types>
```
and
```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default ContentType="application/xml" Extension="xml"/>
<Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels"/>
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" PartName="/xl/workbook.xml" />
<Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" PartName="/docProps/app.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml" PartName="/docProps/custom.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" PartName="/xl/worksheets/sheet1.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" PartName="/xl/styles.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml" PartName="/xl/tables/table1.xml" />
<Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" PartName="/xl/sharedStrings.xml" />
</Types>
```

Hope that will help,
Thanks
Jakun
Viewing all 2262 articles
Browse latest View live


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