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 2016-03-23 14:23:17

victororlov82
Member
Registered: 2016-03-23
Posts: 2

ReoGridControl crash if worksheet contains Line chart

System.ArgumentNullException
  HResult=-2147467261
  Message=Value cannot be null.
Parameter name: textToFormat
  ParamName=textToFormat
  Source=PresentationCore
  StackTrace:
       at System.Windows.Media.FormattedText..ctor(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground, NumberSubstitution numberSubstitution, TextFormattingMode textFormattingMode)
       at di.DrawText(String text, String fontName, Double size, SolidColor color, Rectangle rect, ReoGridHorAlign halign, ReoGridVerAlign valign)
       at h.OnPaint(DrawingContext dc)
       at unvell.ReoGrid.Drawing.DrawingObject.Draw(DrawingContext dc)
       at unvell.ReoGrid.Drawing.DrawingComponent.DrawChildren(DrawingContext dc)
       at unvell.ReoGrid.Drawing.DrawingComponent.OnPaint(DrawingContext dc)
       at unvell.ReoGrid.Drawing.DrawingObject.Draw(DrawingContext dc)
       at unvell.ReoGrid.Drawing.DrawingComponent.DrawChildren(DrawingContext dc)
       at ai.OnPaint(DrawingContext dc)
       at unvell.ReoGrid.Drawing.DrawingObject.Draw(DrawingContext dc)
       at cd.b4(CellDrawingContext A_0)
       at cc.ae(CellDrawingContext A_0)
       at ca.p(CellDrawingContext A_0)
       at cc.b4(CellDrawingContext A_0)
       at cc.ae(CellDrawingContext A_0)
       at ca.p(CellDrawingContext A_0)
       at ca.ae(CellDrawingContext A_0)
       at c3.cd(CellDrawingContext A_0)
       at c7.cd(CellDrawingContext A_0)
       at unvell.ReoGrid.ReoGridControl.OnRender(DrawingContext dc)
       at System.Windows.UIElement.Arrange(Rect finalRect)
       at System.Windows.ContextLayoutManager.UpdateLayout()
       at System.Windows.UIElement.UpdateLayout()
       at System.Windows.Interop.HwndSource.SetLayoutSize()
       at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
       at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
       at System.Windows.Window.SetRootVisual()
       at System.Windows.Window.SetRootVisualAndUpdateSTC()
       at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
       at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
       at System.Windows.Window.CreateSourceWindowDuringShow()
       at System.Windows.Window.SafeCreateWindowDuringShow()
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(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.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at ExcelTest.App.Main() in C:\Users\orlov.VI\Documents\Visual Studio 2015\Projects\ExcelTest\ExcelTest\obj\Debug\App.g.cs:line 0
       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()
  InnerException:

Last edited by victororlov82 (2016-03-24 17:00:27)

Offline

#2 2016-03-24 10:53:30

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

Re: ReoGridControl crash if worksheet contains Line chart

Could you please provide some code or a sample file to reappear this error? Thanks!

Offline

#3 2016-03-24 16:59:42

victororlov82
Member
Registered: 2016-03-23
Posts: 2

Re: ReoGridControl crash if worksheet contains Line chart

With this file link

XAML:

<Window x:Class="ExcelTestWpf.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:rg="clr-namespace:unvell.ReoGrid;assembly=unvell.ReoGrid"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <rg:ReoGridControl x:Name="ExcelViewer" >
        </rg:ReoGridControl>
    </Grid>
</Window>

CS:

namespace ExcelTestWpf
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            ExcelViewer.Load(@"D:\test.xlsx");
        }
    }
}

Offline

#4 2016-03-25 01:54:15

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: ReoGridControl crash if worksheet contains Line chart

Hello Victor,
The reason why the the control is doing this is because you are not load the file correctly.

Try this

namespace ExcelTestWpf
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            
            'sets the control to workbook
            var workbook = ExcelViewer;
 
            'loads the Excel file into the workbook
             workbook.Load(@"D:\test.xlsx", IO.FileFormat.Excel2007);
        }
    }
}

You can get more information from Excel file format

Shane

Last edited by asparatu (2016-03-25 02:02:56)

Offline

#5 2016-03-25 02:41:53

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

Re: ReoGridControl crash if worksheet contains Line chart

Thanks Shane. And Thanks victororlov82 for the test file and code. There is really a problem when Chart loaded from Excel file. ReoGrid cannot read serial labels and all text of serial label is null, when drawing the chart ReoGrid crashes because of null text.

It will be fixed in next release. Thanks for reporting!

Offline

Board footer

Powered by FluxBB