You are not logged in.
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.
System.ArgumentOutOfRangeException was unhandled
_HResult=-2146233086
_message=Index was out of range. Must be non-negative and less than the size of the collection.
HResult=-2146233086
IsTransient=false
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source=mscorlib
ParamName=index
StackTrace:
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at unvell.ReoGrid.Worksheet.ag.c(RGDrawingContext A_0)
at unvell.ReoGrid.Worksheet.ag.aj(RGDrawingContext A_0)
at unvell.ReoGrid.Worksheet.an.ai(RGDrawingContext A_0)
at unvell.ReoGrid.Worksheet.a(Object A_0, PrintPageEventArgs A_1)
at System.Drawing.Printing.PrintDocument.OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintDocument._OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at System.Windows.Forms.PrintPreviewControl.ComputePreview()
at System.Windows.Forms.PrintPreviewControl.CalculatePageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
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.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.PrintPreviewControl.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.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at Rozliczenie_utargu.FrmStart.button1_Click(Object sender, EventArgs e) in d:\Marck\Documents\Visual Studio 2013\Projects\Rozliczenie utargu\Rozliczenie utargu\FrmStart.cs:line 65
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 Rozliczenie_utargu.Program.Main() in d:\Marck\Documents\Visual Studio 2013\Projects\Rozliczenie utargu\Rozliczenie utargu\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
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:
var sheet = grid.CurrentWorksheet;
using (var doc = sheet.CreatePrintDocument())
{
using (PrintPreviewDialog ppd = new PrintPreviewDialog())
{
ppd.Document = doc;
ppd.SetBounds(200, 200, 1024, 768);
ppd.PrintPreviewControl.Zoom = 1d;
ppd.ShowDialog(this); // <--- here comes exception
}
}
Workbook is initialized with this code:
grid.SetSettings(WorkbookSettings.View_ShowScrolls | WorkbookSettings.View_ShowSheetTabControl, false);
using (var ms = new System.IO.MemoryStream(Properties.Resources.template))
{
grid.Load(ms, unvell.ReoGrid.IO.FileFormat.ReoGridFormat);
}
var sheet = grid.CurrentWorksheet;
sheet.SetSettings(WorksheetSettings.View_ShowHeaders | WorksheetSettings.View_ShowGridLine, false);
sheet.SetSettings(WorksheetSettings.Edit_AllowAdjustRowHeight | WorksheetSettings.Edit_AllowAdjustColumnWidth, false);
sheet.Resize(12, 17);
sheet.PageSettings.Landscape = true;
sheet.PageSettings.Margins = new System.Drawing.Printing.Margins(6, 6, 6, 6);
Same problem exists when trying to print without preview. File loaded to grid was created in ReoGridEditor.
Windows 7 64bit
Offline
I think the Resize method deleted some rows and columns that have been allocated as print pages in ReoGridEditor.
Please remove the Resize call and try again, I will also add some check in order to avoid this internal unhandled exception. Thanks for reporting.
sheet.Resize(12, 17);
If you need change the print region try set PrintableRange property and call AutoSplitPage again, or just resize worksheet in ReoGridEditor.
Last edited by Jingwood (2015-01-20 06:46:33)
Offline