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 Mike,
We tried it again and could reproduce it with NetAdvantage 2010.1. However, in NetAdvantage 2009.2 it works fine.
We run on WIndows 7. Printer: Microsoft XPS Document Writer.
We can reproduce it on 4 different systems here.
Did you run you test in NA 2010.1?
Henk said:First of all delete the rows
Yes, I did that, as per your instructions.
Henk said:Did you printpreview as landscape?
No, there wasn't any mention of Landscape in your original post.
I tried it again, just now, with both portrait and landscape and deleted 29, 30, and 31 rows just to cover a range, but I still don't get any errors.
It's possible that maybe the error is caused by a calculation that is one pixel off, so it might depend on the printer driver you are using. Just as a test, try changing the default printer on your system and see if the problem still occurs.
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)
.
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?