ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2015-04-01 13:17:32

mgrogin
Member
Registered: 2015-04-01
Posts: 4

Exception after a while of running

Hi my program is the only one touching  the cells (no human input) and I get this exception after a while running

System.ArgumentNullException was unhandled
  Message=Value cannot be null.
Parameter name: font
  Source=System.Drawing
  ParamName=font
  StackTrace:
       at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
       at unvell.ReoGrid.Worksheet.af.c(RGDrawingContext A_0, ReoGridCell A_1)
       at unvell.ReoGrid.Worksheet.af.a(RGDrawingContext A_0, ReoGridCell A_1)
       at unvell.ReoGrid.Worksheet.af.c(RGDrawingContext A_0)
       at unvell.ReoGrid.Worksheet.af.al(RGDrawingContext A_0)
       at unvell.ReoGrid.Worksheet.am.ak(RGDrawingContext A_0)
       at unvell.ReoGrid.Worksheet.a7.ac(RGDrawingContext A_0)
       at unvell.ReoGrid.Worksheet.a.ac(RGDrawingContext A_0)
       at unvell.ReoGrid.ReoGridControl.OnPaint(PaintEventArgs e)
       at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
       at System.Windows.Forms.Control.WmPaint(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at unvell.ReoGrid.ReoGridControl.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 OrSEA.GUI.Program.Main() in C:\Projects\OSEA-2010\OrSEAGUI\Program.cs:line 30
       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.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Offline

#2 2015-04-01 13:25:28

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Exception after a while of running

Seems font cannot be found in your system. What was the font specified as cell style? or workbook loaded from Excel?

Last edited by Jingwood (2015-04-01 13:26:59)

Offline

#3 2015-04-02 07:35:37

mgrogin
Member
Registered: 2015-04-01
Posts: 4

Re: Exception after a while of running

The form could be running for a while and then suddenly it gets the exception.

I go over the cells and set the font to Arial in the Forms constructor like this:

for (int i = 1; i < m_sAbcCaps.Length; i++) {
					for (int iRow = 0; iRow < m_oReoGridControl.CurrentWorksheet.RowCount; iRow++) {
						string sCell = m_sAbcCaps[i] + (iRow + 1).ToString();
						m_oReoGridControl.CurrentWorksheet[sCell] = "";
						var oCell = m_oReoGridControl.CurrentWorksheet.GetCell(sCell);
						if (oCell != null) {
							oCell.Style.BackColor = Color.White;
							oCell.Style.HAlign = unvell.ReoGrid.ReoGridHorAlign.Center;
							oCell.Style.VAlign = unvell.ReoGrid.ReoGridVerAlign.Middle;
							oCell.DataFormat = unvell.ReoGrid.DataFormat.CellDataFormatFlag.Number;
							oCell.Style.FontName = "Arial";
							oCell.Style.FontSize = 11;
							switch (m_sAbcCaps[i].ToString()) {
								case AMOUNT_COL:
								case AMOUNT_WITH_ORDERS_COL:
								case ORDER_AMOUNT_COL:
									oCell.DataFormatArgs = new unvell.ReoGrid.DataFormat.NumberDataFormatter.NumberFormatArgs()
									{
										DecimalPlaces = 0,
										UseSeparator = true
									};
									break;
								case SECURITY_NUMBER_COL:
									oCell.DataFormatArgs = new unvell.ReoGrid.DataFormat.NumberDataFormatter.NumberFormatArgs()
									{
										DecimalPlaces = 0,
									};
									break;
								case SUM_COL:
									oCell.DataFormatArgs = new unvell.ReoGrid.DataFormat.NumberDataFormatter.NumberFormatArgs()
									{
										DecimalPlaces = 5
									};
									break;
								default:
									break;
							}
						}
					}
				}

Offline

#4 2015-04-07 08:35:40

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Exception after a while of running

How many worksheets / control instances exist inside your form? Did any forms/controls get closed or disposed before this exception happen. I am guessing that other instances that release the font resource and make it become null during memory release, not sure.

Offline

#5 2015-04-07 09:02:43

mgrogin
Member
Registered: 2015-04-01
Posts: 4

Re: Exception after a while of running

Just one worksheet  inside my form.
there are other controls in the form not related to reogrid.

nothing was closed before the exception.

Offline

#6 2015-07-13 14:25:59

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Exception after a while of running

Have you did resolve this problem?

Offline

#7 2015-07-13 14:31:14

mgrogin
Member
Registered: 2015-04-01
Posts: 4

Re: Exception after a while of running

Is there a new release that fixed it?

Offline

#8 2015-07-13 14:49:24

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Exception after a while of running

We couldn't fix it because it wasn't confirmed, we couldn't make it happen in our environment.
Could you please provide a demo project? A RGF or Excel file that causes this happen would be helpful. Thanks.

Offline

Board footer

Powered by FluxBB