Posted 13 January 2021, 12:43 pm EST
Hello,How do I export C1Grid1 and Grid2 on the same excel sheet and How do I include both in a PDF with Landscape format?
Thanks,
Victor
Forums Home / ComponentOne / WinForms Edition Topics
Posted by: Victor.m.charles.civ on 13 January 2021, 12:43 pm EST
Posted 13 January 2021, 12:43 pm EST
Hello,Replied 13 January 2021, 6:15 pm EST
Hello Victor,doc.PageLayout.PageSettings.Landscape = True
doc.Export("CombinedPDF.pdf", True)
doc.Export("CombinedPDF.pdf", True)
doc.Export("CombinedPDF.xlsx", True)
Replied 14 January 2021, 7:52 am EST
Hello,Marked as Answer
Replied 14 January 2021, 7:07 pm EST
Hello Victor,Dim doc1 As New C1PrintDocument()
doc1.Load("1.c1d", C1DocumentFormatEnum.C1d)
Dim doc2 As New C1PrintDocument()
doc2.Load("2.c1d", C1DocumentFormatEnum.C1d)
Dim doc3 As New C1PrintDocument()
doc3.Load("3.c1d", C1DocumentFormatEnum.C1d)
' the combined document:
Dim doc As New C1PrintDocument()
' add 1st document:
While doc1.Body.Children.Count > 0
Dim ro As RenderObject = doc1.Body.Children(0)
' a render object cannot have two parents at once, so removed from original parent first:
doc1.Body.Children.RemoveAt(0)
' now add to the combined doc:
doc.Body.Children.Add(ro)
End While
' ensure a page break between the two documents:
doc.Body.Children.Add(New RenderEmpty(BreakEnum.Page))
' add 2nd document:
While doc2.Body.Children.Count > 0
Dim ro As RenderObject = doc2.Body.Children(0)
doc2.Body.Children.RemoveAt(0)
doc.Body.Children.Add(ro)
End While
doc.Body.Children.Add(New RenderEmpty(BreakEnum.Page))
While doc3.Body.Children.Count > 0
Dim ro As RenderObject = doc3.Body.Children(0)
' a render object cannot have two parents at once, so removed from original parent first:
doc3.Body.Children.RemoveAt(0)
' now add to the combined doc:
doc.Body.Children.Add(ro)
End While
' ensure a page break between the two documents:
doc.PageLayout.PageSettings.Landscape = True
doc.Export("Demo.xlsx", True)
System.Diagnostics.Process.Start("Demo.xlsx")
Replied 18 January 2021, 1:53 pm EST
Hi,Replied 19 January 2021, 2:50 am EST
Hello Prabhat,Replied 19 January 2021, 3:00 pm EST
Hello Prabhat,Replied 19 January 2021, 3:04 pm EST
Hello Prabhat,Replied 19 January 2021, 5:23 pm EST
Hello Victor,string dir = @"C:\YourFolderName";
// If directory does not exist, create it
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
doc.Export("C:\YourFolderName\TEST66.pdf", True)