//---------------------------------------------------- //---------------------------------------------------- public static void AddImageWithTextRow(MigraDoc.DocumentObjectModel.Section section, int iRow, MyImage Image1) { Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = new Unit(3 * (1 - iRow) + .5 * iRow, UnitType.Centimeter); //------------------------------------ Table tbl = AddTable4Image(section, ImageRowType.ImageText); //--------- frist row: image name and number Row row = tbl.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Left; row.Format.Font.Bold = true; //row.Cells[0].MergeRight = 2; row.Cells[0].AddParagraph("Image #:" + Image1.ImageNo + " - " + Image1.ImageName); if (Image1.ImageDesc.Length > 0) { row.Cells[1].AddParagraph("Inspection / Recommendation:"); } else { row.Cells[1].AddParagraph("--"); } //AddIamge(row.Cells[0], Image1); // second row row = tbl.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Left; row.Format.Font.Bold = false; AddIamge(row.Cells[0], Image1, "10.5cm"); if (Image1.ImageDesc.Length > 0) { Paragraph prg = row.Cells[1].AddParagraph(RenderDescXML(Image1.ImageDesc)); prg.Format.Font.Size = 8; row.Cells[1].Format.Alignment = ParagraphAlignment.Left; } }
//--------------------------- private static void AddIamge(Cell cell, MyImage ImageFile, string ImageWidth) { //row.Shading.Color = TableBlue; Image img = cell.AddImage(ImageFile.ImageFile); if (ImageFile.ImageOrientation == Orientation.Landscape) { img.Width = ImageWidth; } else { img.Height = "9.8cm"; } //img.Height = "9cm"; img.LockAspectRatio = true; cell.Format.Font.Bold = false; cell.Format.Alignment = ParagraphAlignment.Center; cell.VerticalAlignment = VerticalAlignment.Center; }
// public static void AddImageWithoutTextRow(MigraDoc.DocumentObjectModel.Section section) //---------------------------------------------------- //---------------------------------------------------- public static void AddImageWithoutTextRow(MigraDoc.DocumentObjectModel.Section section, int iRow, MyImage Image1, MyImage Image2) { Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = new Unit(2.5 * (1 - iRow) + .3 * iRow, UnitType.Centimeter); //------------------------------------ Table tbl = AddTable4Image(section, ImageRowType.ImageImage); // Create the header of the table Row row = tbl.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; // row.Cells[0].AddParagraph("Image #:" + Image1.ImageNo + " - " + Image1.ImageName); row.Cells[1].AddParagraph("Image #:" + Image2.ImageNo + " - " + Image2.ImageName); //AddIamge(row.Cells[0], Image1); // second row row = tbl.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Left; row.Format.Font.Bold = false; AddIamge(row.Cells[0], Image1, "9.8cm"); AddIamge(row.Cells[1], Image2, "9.8cm"); }