0

This the orginal design i want

But designed like a table I don't know how to make nested table and remove the unwanted lines... can anyone help me sort this out? And can we do the word wrap for the 10 columns? I have added both the screenshots.

PdfPTable pdfMastertable = new PdfPTable(10);

PdfPCell CalibrationContent = new PdfPCell(FormatPhrase("", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 6;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;
pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Approved By", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 2;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;
pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Sign", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 2;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;
pdfMastertable.AddCell(CalibrationContent);

PdfPCell cell = new PdfPCell(new Phrase("The following measuring instruments have been tested as below with result"));
cell.Colspan = 10;
cell.HorizontalAlignment = 1;
pdfMastertable.AddCell(cell);

pdfMastertable.DefaultCell.Padding = 10;
pdfMastertable.WidthPercentage = 96;
pdfMastertable.DefaultCell.BorderWidth = 1;
pdfMastertable.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
pdfMastertable.DefaultCell.VerticalAlignment = Element.ALIGN_BOTTOM;
pdfMastertable.DefaultCell.MinimumHeight = 40.0F;
pdfMastertable.HorizontalAlignment = 1;

Single[] widths10 = { 0.4F, 0.4F, 0.4F, 0.4F, 0.4F, 0.4F, 0.4F, 0.4F, 0.4F, 0.4F };
pdfMastertable.SetWidths(widths10);

CalibrationContent = new PdfPCell(FormatPhrase("Month Of Test", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Date Of Test", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;
pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Instrument Type", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Asset Id & Serial No", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Manufacturer", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Calibration Type", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Result", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Room Temp, Humidity", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Comments", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

CalibrationContent = new PdfPCell(FormatPhrase("Tested By", 8, Font.NORMAL, BaseColor.BLACK));
CalibrationContent.Colspan = 1;
CalibrationContent.BackgroundColor = new BaseColor(255, 191, 0);
CalibrationContent.NoWrap = true;
CalibrationContent.HorizontalAlignment = Element.ALIGN_CENTER;

pdfMastertable.AddCell(CalibrationContent);

pdfDoc.Add(pdfMastertable);

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Vinoth Narayan
  • 275
  • 2
  • 15
  • See [this for removing the borders on cells](http://stackoverflow.com/a/17986705/231316) (what you are calling lines) – Chris Haas Jun 19 '16 at 16:13
  • You will need to explain what you mean by "word wrap" in greater detail, perhaps in another question. – Chris Haas Jun 19 '16 at 16:14

0 Answers0