Hello,
In our product we use the UltraGrid. When doing a print preview, we get an OutOfRangeException.
Did anyone have seen this before and is there a workaround/solution available?
I checked the code in Infragistics.Win.UltraWinGridPrintManager.CalculateFirstRows.
There ut seems to be a situation of an endless loop when adding a new logical page. Somehow, for certain a certain amount of rows, it cannot determine what should be on the next logical page or it keep generating the same logical page.
I can reproduce this with one of the samples of NetAdvantage Select 2010, Vol. 1.
1. Goto Windows Forms -> Samples -> Grids -> Samples Explorer -> Print/Print Preview
2. Deselect Portrait
3. Delete first 30 rows.
4. Click on Preview
-> IndexOutOfRangeException
Service Release Version 0.1.2018
We're running on Windows7
Best regards,
Henk Wagterveld
Hi Henk,
I tried this out following the steps you listed here and it works just fine for me. Can you post the call stack of the exception?
Hi Mike,
It only happens the first time. First of all delete the rows. Did you printpreview as landscape?
Maybe play a bit with deleting the number of rows.
Here's the call stack
System.IndexOutOfRangeException: De index ligt buiten de matrixgrenzen. bij Infragistics.Win.UltraWinGrid.PrintManager.AddLogicalPrintPage(UltraGridRow row, Int32 scrollOffset) bij Infragistics.Win.UltraWinGrid.PrintManager.CalculateFirstRows() bij Infragistics.Win.UltraWinGrid.PrintManager.CalculatePageDimensions() bij Infragistics.Win.UltraWinGrid.PrintManager.BeginPrint(Object sender, PrintEventArgs e) bij Infragistics.Win.UltraWinGrid.UltraGridPrintDocument.OnBeginPrint(PrintEventArgs e) bij System.Drawing.Printing.PrintDocument._OnBeginPrint(PrintEventArgs e) bij System.Drawing.Printing.PrintController.Print(PrintDocument document) bij System.Drawing.Printing.PrintDocument.Print() bij Infragistics.Win.Printing.UltraPrintPreviewControl.GeneratePreviewHelper(Boolean synchronous) bij Infragistics.Win.Printing.UltraPrintPreviewControl.OnApplicationIdle(Object sender, EventArgs e) bij System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef) bij System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) bij System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bij System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bij System.Windows.Forms.Application.RunDialog(Form form) bij System.Windows.Forms.Form.ShowDialog(IWin32Window owner) bij SamplesExplorer.frmPrintDemo.cmdPrintPreview_Click(Object sender, EventArgs e) bij System.Windows.Forms.Control.OnClick(EventArgs e) bij System.Windows.Forms.Button.OnClick(EventArgs e) bij System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bij System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bij System.Windows.Forms.Control.WndProc(Message& m) bij System.Windows.Forms.ButtonBase.WndProc(Message& m) bij System.Windows.Forms.Button.WndProc(Message& m) bij System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bij System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bij System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
.