Hi,
My sample code is here .I have added the dll based on GDI+( PDFsharp + MigraDoc) Version is 1.32.4334 .Please finds the image as well. If I did anything wrong please let me know am new to migradoc.
Code:
//Button click
private void button1_Click(object sender, EventArgs e)
{
Document document1 = new Document();
document1=CreateDocument();
string ddl = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(document1);
documentPreview1.Ddl = ddl;
}
//Create Document Method
public static Document CreateDocument()
{
Document document = new Document();
Section section = document.AddSection();
section.PageSetup.TopMargin = 25;
section.PageSetup.LeftMargin = 25;
section.PageSetup.RightMargin = 25;
section.PageSetup.PageFormat = PageFormat.A4;
Paragraph paragraph = section.AddParagraph();
paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Color.FromCmyk(100, 30, 20, 50);
Table envTable = new Table();
envTable = section.AddTable();
Row row = new Row();
Column column = envTable.AddColumn("7.0cm");
row = envTable.AddRow();
row.Borders.Color = Colors.LightGray;
row.Format.Font.Bold = true;
row.Format.Font.Size = 12;
row.Format.Alignment = ParagraphAlignment.Center;
row.VerticalAlignment = VerticalAlignment.Center;
row.Height = "1cm";
row.Cells[0].AddParagraph("Sample Field");
row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
row.Cells[0].Borders.Right.Visible = true;
for (int i = 0; i < 60; i++)
{
row = new Row();
row = envTable.AddRow();
row.Borders.Color = Colors.LightGray;
row.Format.Alignment = ParagraphAlignment.Center;
row.VerticalAlignment = VerticalAlignment.Center;
row.TopPadding = 4;
row.Cells[0].AddParagraph("Test1- "+i.ToString());
row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
row.Cells[0].Borders.Right.Visible = true;
}
return document;
}