Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all 1877 articles
Browse latest View live

Created Unassigned: Object reference not set to an instance of an object [8960]

$
0
0
Hi again,

Seems I've run into an issue with opening Excel documents generated by Microsoft's OpenXML. I receive an "Object reference not set to an instance of an object" error when trying to open the attached document.

If I open the document with Excel, and re-save it, it opens with ClosedXML fine. Just the original document refuses to open with ClosedXML.

I've included the Stack trace below, though it only really points to LoadSpreadsheetDocument.

```
Object reference not set to an instance of an object.

at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
at ClosedXML_Test.Form1.button1_Click(Object sender, EventArgs e) in D:\ClosedXML Test\Form1.cs:line 21
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ClosedXML_Test.Program.Main() in D:\ClosedXML Test\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
```

Commented Unassigned: Object reference not set to an instance of an object [8960]

$
0
0
Hi again,

Seems I've run into an issue with opening Excel documents generated by Microsoft's OpenXML. I receive an "Object reference not set to an instance of an object" error when trying to open the attached document.

If I open the document with Excel, and re-save it, it opens with ClosedXML fine. Just the original document refuses to open with ClosedXML.

I've included the Stack trace below, though it only really points to LoadSpreadsheetDocument.

```
Object reference not set to an instance of an object.

at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
at ClosedXML_Test.Form1.button1_Click(Object sender, EventArgs e) in D:\ClosedXML Test\Form1.cs:line 21
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ClosedXML_Test.Program.Main() in D:\ClosedXML Test\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
```
Comments: ** Comment from web user: ShadowXVII **

Here is the second attachment. Wouldn't let me put up more than one at once.

Commented Unassigned: Object reference not set to an instance of an object [8960]

$
0
0
Hi again,

Seems I've run into an issue with opening Excel documents generated by Microsoft's OpenXML. I receive an "Object reference not set to an instance of an object" error when trying to open the attached document.

If I open the document with Excel, and re-save it, it opens with ClosedXML fine. Just the original document refuses to open with ClosedXML.

I've included the Stack trace below, though it only really points to LoadSpreadsheetDocument.

```
Object reference not set to an instance of an object.

at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)
at ClosedXML_Test.Form1.button1_Click(Object sender, EventArgs e) in D:\ClosedXML Test\Form1.cs:line 21
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ClosedXML_Test.Program.Main() in D:\ClosedXML Test\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
```
Comments: ** Comment from web user: ShadowXVII **

This is related to this issue;
[https://closedxml.codeplex.com/workitem/8631](https://closedxml.codeplex.com/workitem/8631)

And fixed in patch;
[#14484](https://www.codeplex.com/Download?ProjectName=closedxml&DownloadId=679794)

The WorkbookProperties don't seem to all be defaulted which causes it to fall over when loading a 'minimalist' OpenXML document.

New Post: How do I get formatted cell values, according to the excel cell format definitions?

$
0
0
Sorry for the late reply. I don't understand the problem. ClosedXML can get you the formatted value if it can resolve the formula. If it can't resolve the formula then it won't have any value to format. What functions are you using? (in English)

Closed Unassigned: Object reference not set to an instance of an object [8960]

$
0
0
__Resolved in Patch #[14484](https://www.codeplex.com/Download?ProjectName=closedxml&DownloadId=679794). Pending merge into latest__

Hi again,

Seems I've run into an issue with opening Excel documents generated by Microsoft's OpenXML. I receive an "Object reference not set to an instance of an object" error when trying to open the attached document.

If I open the document with Excel, and re-save it, it opens with ClosedXML fine. Just the original document refuses to open with ClosedXML.

I've included the Stack trace below, though it only really points to LoadSpreadsheetDocument.

```
Object reference not set to an instance of an object.

at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(String fileName)
at ClosedXML.Excel.XLWorkbook.Load(String file)
at ClosedXML.Excel.XLWorkbook..ctor(String file, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(String file)

```
Comments: Applied patch.

Source code checked in, #79773

$
0
0
Fix issue loading workbooks without WorkbookProperties

Patch Applied: #14354

Source code checked in, #79774

$
0
0
Better performance when dealing with numbers and guard against inserting nulls into cells

Patch Applied: #14250

$
0
0

MDeLeon has applied patch #14250.

Comment:
Better late than never... thank you very much.

Source code checked in, #79776

$
0
0
Applied patch to better handle streams

Patch Applied: #14355

New Post: How do I get formatted cell values, according to the excel cell format definitions?

$
0
0
Also sorry for my late answer.

The formula in English is:
=ROUND(R3/MIN(INDIRECT(CONCATENATE("R";MATCH(J3;INDIRECT(CONCATENATE("J";MATCH(G3;G:G;0);":J";MATCH(G3;G:G)));0)+MATCH(G3;G:G;0)-1;":R";MATCH(J3;INDIRECT(CONCATENATE("J";MATCH(G3;G:G;0);":J";MATCH(G3;G:G))))+MATCH(G3;G:G;0)-1)));1)-1

The values of the cells G3, J3 and R3 are also calculated by the use of formulas.
The value of J3 is calculated by the formula "=MTRANS('Technical Data'!D90:IV90)". As you already told me MTRANS is not supported. Perhaps this is the reason why I don't get the "visible" value "0,1"?

Regards,
Christian

Created Unassigned: Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' [8972]

$
0
0
Error occurs while using saveAs method:
Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' from assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

New Post: How do I get formatted cell values, according to the excel cell format definitions?

$
0
0
I'm afraid ClosedXML won't be able to give you the number (formatted or otherwise) because first it has to resolve the formula :(

Closed Unassigned: Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' [8972]

$
0
0
Error occurs while using saveAs method:
Could not load type 'DocumentFormat.OpenXml.Spreadsheet.SmartTags' from assembly 'DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Comments: ClosedXML uses the OpenXML SDK 2.0, not 2.5

New Post: Excel range to Outlook Body

$
0
0
Hi,

I can send emails no problem through C# but now want to be able to send Excel Range in an email body.

Any ideas?

Thanks,

New Post: Excel range to Outlook Body

$
0
0
You have to create an HTML table and put it as part of the email. There's no way to embed an Excel range in an email.

Commented Issue: How to Filter on a Table? [7732]

$
0
0
The following works (but if I use "SetAutoFilter()" then the workbook is corrupt, I'll fix that). In the meantime just use "table.AutoFilter" instead: var wb = new XLWorkbook();
var ws = wb.Worksheets.Add("Sheet1");

ws.FirstCell().SetValue("Categories")
.CellBelow().SetValue("A")
.CellBelow().SetValue("B")
.CellBelow().SetValue("A")
.CellBelow().SetValue("B");
 
var table = ws.RangeUsed().CreateTable();
table.AutoFilter.Column(1).AddFilter("A");
Comments: ** Comment from web user: vlash **

Can you filter on more than one column?

table.AutoFilter.Column(6).AddFilter<string>("xxx");
table.AutoFilter.Column(1).AddFilter<string>("ccc");

The example above will only filter on the last row, even though the filtervalues are set for column 6.

Commented Unassigned: Style, colour, formulas when using XLEventTracking.Disabled [8852]

$
0
0
i need to create some larger excel sheets using a "template" for colors, forumulas and styles.
(template is attached).
1st thing i do is adding the nr of needed rows using
ws.Row(srcrow).InsertRowsBelow();
srcrow is the row with the colors, formulas and stuff

when i open the template with XLEventTracking.Enabled i get Out of memory exeptions on some larger files.

when i try it with XLEventTracking.Disabled it seem a lot better with memory usage, but the copy'd rowd dont have colors styles or formulas.

C.huede
Comments: ** Comment from web user: chuede **

Noone with any idea on the excessive memory usage on closedXML ?

Commented Unassigned: System.OutOfMemoryException in v0.68.0.10, regression? [8808]

$
0
0
Hello,

In order to improve the speed of reading/writing of Excel files, I have recently updated ClosedXML from v0.64.0.0 to v0.68.0.10.

The kind of Excel file that I deal with is a big file, embedding a lot of VBA code ; I use it as a template, filling only 2 sheets with raw data (number or string, no formula).

The VBA developper improve this file continuously, for some files there was a huge speed difference, but we have arrived in a point where :

- With v0.64.0.0, we have the good results, but it is very slow
- With v0.68.0.10, the memory is increasing and then a "System.OutOfMemoryException" is thrown.

The exception is thrown in the code below

```
public XLWorkbook OpenExcel(MemoryStream xlsStream)
{
return new XLWorkbook(xlsStream, XLEventTracking.Disabled); //RR 13/06/2013 Turning off events
}
```

with v0.64.0.0 the memory is not increasing a lot during this operation (quite stable), but with v0.68.0.10 the memory used is increasing a lot (1 more GB) and then the exception occured.

I try to turn of the events, but it doesn't change anything.

Does anyone else had this issue before?

Thank you very much for your help.

Regards,
Renaud
Comments: ** Comment from web user: chuede **

still no news ?

Viewing all 1877 articles
Browse latest View live


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