To add an item to the C1MultiDocumentItemCollection, you can use the Add method. To load a file into the C1MultiDocument component you can use the Load method. To remove a file, you would use the Clear method. This method clears any file previously loaded into the C1MultiDocument component.
To add an item to the C1MultiDocumentItemCollection, you can use the Add method. Complete the following steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim ppc As New C1PrintPreviewControl Controls.Add(ppc) ppc.Dock = DockStyle.Fill Dim pdoc As New C1PrintDocument Dim pdoc2 As New C1PrintDocument Dim mdoc As New C1MultiDocument pdoc.Body.Children.Add(New C1.C1Preview.RenderText("Hello!")) pdoc2.Body.Children.Add(New C1.C1Preview.RenderText("World!")) mdoc.Items.Add(pdoc) mdoc.Items.Add(pdoc2) ppc.Document = mdoc mdoc.Generate() |
To write code in C#
C# |
Copy Code
|
---|---|
C1PrintPreviewControl ppc = new C1PrintPreviewControl(); Controls.Add(ppc); ppc.Dock = DockStyle.Fill; C1PrintDocument pdoc = new C1PrintDocument(); C1PrintDocument pdoc2 = new C1PrintDocument(); C1MultiDocument mdoc = new C1MultiDocument(); pdoc.Body.Children.Add(new C1.C1Preview.RenderText("Hello!")); pdoc2.Body.Children.Add(new C1.C1Preview.RenderText("World!")); mdoc.Items.Add(pdoc); mdoc.Items.Add(pdoc2); ppc.Document = mdoc; mdoc.Generate(); |
This code loads two C1PrintDocument into the C1MultiDocument component and displays the documents in a C1PrintPreviewControl at run time.