This there a way to access the PrintDocument of an UltraGrid like the one that exist on the UltraChart? Like the property UltraChart.PrintDocument
I'm trying to PrintPreview an UltraGrid and an UltraChart on Pave1 and Page2
Hello,
I am just checking about the progress of this issue. Let me know If you need any further assistance on this issue?
Thank you for using Infragistics Components.
Thanks for the quick reply.
I already new about the MultiPrintDocument class. UltraGridPrintDocument was what I was looking for.
Now how do I specify a UltraGridLayout to the Print/Preview? UltraGrid.PrintPreview accepts a UltraGridLayout as a parameter, how do I specify GridLayout with UltraGridPtintDocument?
Yes, the suggested solution worked fine.
Sorry for the late reply. I've been a bit busy on another topic.
Thanks for the help.
Hi,
I just wanted to know if you were able to solve your issue based on my suggestions or you still need help? Just let me know.
Thank you.
Hello,
Before UltraGrid to be printed, its rises InitializePrint event, more information about this event you could find on the following link:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v12.1~Infragistics.Win.UltraWinGrid.UltraGrid~OnInitializePrint.html
In this event you could manage PrintLayou of the printed UltraGrid, to do this you could use PrintLayout property of the argument
http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v12.1~Infragistics.Win.UltraWinGrid.CancelablePrintEventArgs_members.html http://help.infragistics.com/Help/NetAdvantage/WinForms/2012.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v12.1~Infragistics.Win.UltraWinGrid.CancelablePrintEventArgs~PrintLayout.html
So the correct place where you should add your print layout is in the InitializePrint event - PrintLayout property of the argument. For example, with the test sample which I have posted, please subscribe for this event and put following code there, just to see how this works :
e.PrintLayout.Bands[0].Columns[0].CellAppearance.BackColor = Color.Red;
Please let me know if you have any further questions.
I think I didn't formulate my question poperly. I used to do this to PrintPreview/Print the UltraGrid with a different Layout
UltraGridLayout
gridPrintLayout = new UltraGridLayout(); gridPrintLayout.LoadFromXml("theFile.xml");
this.ultraGrid1.PrintPreview(gridPrintLayout);
Now I need to do
UltraGridPrintDocument
gridPrintDoc = new UltraGridPrintDocument(); gridPrintDoc.Grid = this.ultraGrid1;
UltraGridPrintDocument gridPrintDoc2 = new UltraGridPrintDocument(); gridPrintDoc2.Grid = this.ultraGrid2;
MultiPrintDocument
multiPrint = new MultiPrintDocument(new PrintDocument[] { gridPrintDoc , gridPrintDoc2 });
previewDlg.Document = multiPrint;
previewDlg.ShowDialog();
But now I don't know where to specify my "gridPrintLayout" Can you propose something or is there something I haven't understood.
Hello ,
Print and PrintPreview methods have several overloads, the lists of overload od this methods you could find on the following links:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGrid~Print.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGrid~PrintPreview.html
So as you can see that this parameter is optional using it you could specify a Layout object that controls the formatting of the grid data when printed. The Layout object gives you the opportunity to create a custom-formatted report based on the data in the grid, applying different attributes such as fonts, colors and arrangement of data specifically for the printed page.
On the following link you could find more information about using this methods with layout optional parameter.
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGrid~Print%28UltraGridLayout%29.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.1/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.1~Infragistics.Win.UltraWinGrid.UltraGrid~PrintPreview%28UltraGridLayout%29.html