Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

Print Multiple C1TrueDBGrid Controls in a Single Document

Background:

How to Print Multiple C1TrueDBGrid Controls in a Single Document.

Steps to Complete:

You can use C1PrintDocument to print multiple C1TrueDBGrid controls in a single document using this code snippet:

Grid1.PrintInfo.ShowProgressForm = false;
Grid2.PrintInfo.ShowProgressForm = false;
Grid3.PrintInfo.ShowProgressForm = false;


MemoryStream memoryStream1 = (MemoryStream)c1TrueDBGrid1.PrintInfo.PrintToStream();
MemoryStream memoryStream2 = (MemoryStream)c1TrueDBGrid2.PrintInfo.PrintToStream();
MemoryStream memoryStream3 = (MemoryStream)c1TrueDBGrid3.PrintInfo.PrintToStream();


C1PrintDocument printDocument1 = new C1PrintDocument();
printDocument1.Load(memoryStream1);
C1PrintDocument printDocument2 = new C1PrintDocument();
printDocument2.Load(memoryStream2);
C1PrintDocument printDocument3 = new C1PrintDocument();
printDocument3.Load(memoryStream3);

RenderTable table1 = (RenderTable) printDocument1.Body.Children[0].Clone();
RenderTable table2 = (RenderTable) printDocument2.Body.Children[0].Clone();
RenderTable table3 = (RenderTable) printDocument3.Body.Children[0].Clone();

C1PrintDocument finaldocument = new C1PrintDocument();
finaldocument.Body.Children.Add(table1);
finaldocument.Body.Children.Add(new RenderText(" "));
finaldocument.Body.Children.Add(table2);
finaldocument.Body.Children.Add(new RenderText(" "));
finaldocument.Body.Children.Add(table3);
finaldocument.Print();
Get the Latest Version of WinForms Edition
Download the Free Trial Now