private void PutAdress(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo) { //create table to add address of the customer Table adressTable = new Table(); adressTable.IsFirstParagraph = true; adressTable.ColumnWidths = "60 180 60 180"; adressTable.DefaultCellTextInfo.FontSize = 10; adressTable.DefaultCellTextInfo.LineSpacing = 3; adressTable.DefaultCellPadding.Bottom = 3; //add this table in the first section/page Section section = pdf.Sections[0]; section.Paragraphs.Add(adressTable); //add a new row in the table Row row1AdressTable = new Row(adressTable); adressTable.Rows.Add(row1AdressTable); //add cells and text Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.Color = new Aspose.Pdf.Generator.Color(111, 146, 188); tf1.FontName = "Helvetica-Bold"; row1AdressTable.Cells.Add("Bill To:", tf1); row1AdressTable.Cells.Add(passengerInfo.Name + "#$NL" + passengerInfo.Address + "#$NL" + passengerInfo.Email + "#$NL" + passengerInfo.PhoneNumber); }
//create object with text styling information private Aspose.Pdf.Generator.TextInfo SetTextInfo(string fontName, float fontSize, string fontColor, bool isBold) { Aspose.Pdf.Generator.TextInfo textInfo = new Aspose.Pdf.Generator.TextInfo(); textInfo.FontSize = fontSize; textInfo.Color = new Aspose.Pdf.Generator.Color(fontColor); textInfo.Alignment = AlignmentType.Center; textInfo.IsTrueTypeFontBold = isBold; textInfo.TruetypeFontFileName = fontName; return(textInfo); }
private Table AddTable(Aspose.Pdf.Generator.Pdf pdf) { //create a table to hold order details Table detailTable = new Table(); Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188); detailTable.Margin.Top = 20; detailTable.ColumnWidths = "60 150 60 80 60 80"; //detailTable.DefaultCellBorder = new BorderInfo((int)(BorderSide.Top|BorderSide.Bottom), color); detailTable.DefaultCellBorder = new BorderInfo((int)(BorderSide.Top | BorderSide.Bottom | BorderSide.Right | BorderSide.Left), color); detailTable.DefaultCellTextInfo.FontSize = 10; detailTable.DefaultCellPadding.Bottom = detailTable.DefaultCellPadding.Top = 4; Section section = pdf.Sections[0]; section.Paragraphs.Add(detailTable); Row row1DetailTable = detailTable.Rows.Add(); Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 10; tf1.Color = new Aspose.Pdf.Generator.Color("White"); tf1.FontName = "Helvetica-Bold"; tf1.Alignment = AlignmentType.Center; Cell cell1Row1DetailTable = row1DetailTable.Cells.Add("Product ID", tf1); cell1Row1DetailTable.BackgroundColor = color; Cell cell2Row1DetailTable = row1DetailTable.Cells.Add("Product Name", tf1); cell2Row1DetailTable.BackgroundColor = color; Cell cell3Row1DetailTable = row1DetailTable.Cells.Add("Quantity", tf1); cell3Row1DetailTable.BackgroundColor = color; Cell cell4Row1DetailTable = row1DetailTable.Cells.Add("Unit Price", tf1); cell4Row1DetailTable.BackgroundColor = color; Cell cell5Row1DetailTable = row1DetailTable.Cells.Add("Discount", tf1); cell5Row1DetailTable.BackgroundColor = color; Cell cell6Row1DetailTable = row1DetailTable.Cells.Add("Extended Price", tf1); cell6Row1DetailTable.BackgroundColor = color; return(detailTable); }
private void AddRow(Aspose.Pdf.Generator.Pdf pdf, Aspose.Pdf.Generator.Table tabel, FlightInfo flightInfo) { //add a new row in order detail. Section section = pdf.Sections[0]; Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 10; tf1.Alignment = AlignmentType.Center; Row row1DetailTable = tabel.Rows.Add(); row1DetailTable.Cells.Add("1", tf1); tf1.Alignment = AlignmentType.Left; row1DetailTable.Cells.Add("Ticket: " + flightInfo.DepartureLocation + " to " + flightInfo.Destination, tf1); tf1.Alignment = AlignmentType.Center; row1DetailTable.Cells.Add("1", tf1); row1DetailTable.Cells.Add(flightInfo.Fare.ToString("c", locale), tf1); row1DetailTable.Cells.Add("0" + "%", tf1); row1DetailTable.Cells.Add(flightInfo.Fare.ToString("c", locale), tf1); }
//create a new cell private Cell AddTextToCell(string strText, Row currentRow, Aspose.Pdf.Generator.TextInfo textInfo, bool isRightAligned) { Cell tempCell = new Cell(currentRow); Text text = new Text(strText); text.TextInfo = textInfo; if (isRightAligned) { text.TextInfo.Alignment = AlignmentType.Right; } else { text.TextInfo.Alignment = AlignmentType.Left; } tempCell.Paragraphs.Add(text); return(tempCell); }
private void PutAmount(Aspose.Pdf.Generator.Pdf pdf, float fare, float tax) { //add total amount for this invoice Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188); CultureInfo culture = new CultureInfo("en-US"); Table amountTable = new Table(); amountTable.Margin.Top = 20; amountTable.Margin.Left = 370; amountTable.ColumnWidths = "60 60"; amountTable.DefaultCellBorder = new BorderInfo((int)BorderSide.Bottom, color); amountTable.DefaultCellPadding.Bottom = amountTable.DefaultCellPadding.Top = 5; amountTable.DefaultCellTextInfo.FontSize = 10; Section section = pdf.Sections[0]; section.Paragraphs.Add(amountTable); Row row1AmountTable = amountTable.Rows.Add(); Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 10; tf1.Color = color; tf1.FontName = "Helvetica-Bold"; row1AmountTable.Cells.Add("Subtotal", tf1); row1AmountTable.Cells.Add(fare.ToString("c", culture)); Row row2AmountTable = amountTable.Rows.Add(); row2AmountTable.Cells.Add("Tax", tf1); row2AmountTable.Cells.Add(tax.ToString("c", culture)); Row row3AmountTable = amountTable.Rows.Add(); row3AmountTable.Cells.Add("Total", tf1); row3AmountTable.Cells.Add((fare + tax).ToString("c", culture)); }
private void PutSummary(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, BookingInfo bookingInfo, FlightInfo flightInfo, bool isReturn) { //create table structure for the ticket Table summaryTable = new Table(); Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188); summaryTable.Margin.Top = 20; summaryTable.ColumnWidths = "80 80 80 80"; summaryTable.DefaultCellTextInfo.FontSize = 10; summaryTable.DefaultCellPadding.Bottom = summaryTable.DefaultCellPadding.Top = 3; summaryTable.Border = new BorderInfo((int)BorderSide.Box, 0.5f ,color); summaryTable.BackgroundColor = new Color(173, 202, 225); //add table to the PDF page Section section = pdf.Sections[0]; section.Paragraphs.Add(summaryTable); //declare temporary variables Aspose.Pdf.Generator.TextInfo textInfo = new Aspose.Pdf.Generator.TextInfo(); Cell tempCell; //add logo and barcode images Row row1SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); Cell cell1 = new Cell(row1SummaryTable); cell1.ColumnsSpan = 2; cell1.DefaultCellTextInfo = textInfo; Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image(); img.ImageInfo.File = path + "\\FlyNowLogoOnly.jpg"; img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg; img.ImageInfo.FixWidth = 90; img.ImageInfo.FixHeight = 30; cell1.Paragraphs.Add(img); row1SummaryTable.Cells.Add(cell1); Cell cell2 = new Cell(row1SummaryTable); cell2.ColumnsSpan = 2; cell2.DefaultCellTextInfo = textInfo; cell2.Alignment = AlignmentType.Right; img = new Aspose.Pdf.Generator.Image(); if(!isReturn) img.ImageInfo.File = path + "\\barcodeleave.jpg"; else img.ImageInfo.File = path + "\\barcodereturn.jpg"; img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg; img.ImageInfo.FixWidth = 160; img.ImageInfo.FixHeight = 30; cell2.Paragraphs.Add(img); row1SummaryTable.Cells.Add(cell2); Row row2SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Class:", row2SummaryTable, textInfo, true); row2SummaryTable.Cells.Add(tempCell); //cell2 = new Cell(row2SummaryTable); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); tempCell = AddTextToCell("Economy", row2SummaryTable, textInfo, false); row2SummaryTable.Cells.Add(tempCell); //add emptry cells Cell cell3 = new Cell(row2SummaryTable); row2SummaryTable.Cells.Add(cell3); Cell cell4 = new Cell(row2SummaryTable); row2SummaryTable.Cells.Add(cell4); //add flight details Row row3SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Flight: ", row3SummaryTable, textInfo,true); row3SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if(!isReturn) tempCell = AddTextToCell(flightInfo.FlightNumberLeave, row3SummaryTable, textInfo, false); else tempCell = AddTextToCell(flightInfo.FlightNumberReturn, row3SummaryTable, textInfo, false); row3SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Seat Number: ", row3SummaryTable, textInfo, true); row3SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); tempCell = AddTextToCell(passengerInfo.SeatNumber, row3SummaryTable, textInfo, false); row3SummaryTable.Cells.Add(tempCell); Row row4SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("From: ", row3SummaryTable, textInfo, true); row4SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if(!isReturn) tempCell = AddTextToCell(flightInfo.DepartureLocation, row3SummaryTable, textInfo, false); else tempCell = AddTextToCell(flightInfo.Destination, row3SummaryTable, textInfo, false); row4SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("To: ", row3SummaryTable, textInfo, true); row4SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if(!isReturn) tempCell = AddTextToCell(flightInfo.Destination, row3SummaryTable, textInfo, false); else tempCell = AddTextToCell(flightInfo.DepartureLocation, row3SummaryTable, textInfo, false); row4SummaryTable.Cells.Add(tempCell); Row row5SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman",9, "Black", true); tempCell = AddTextToCell("Departure:", row5SummaryTable, textInfo, true); row5SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if(!isReturn) tempCell = AddTextToCell(flightInfo.DepartureDateandTime.ToString(), row5SummaryTable, textInfo, false); else tempCell = AddTextToCell(flightInfo.ReturnDateandTime.ToString(), row5SummaryTable, textInfo, false); row5SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Arrival:", row5SummaryTable, textInfo, true); row5SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if(!isReturn) tempCell = AddTextToCell(flightInfo.ArrivalDateandTimeDest.ToString(), row5SummaryTable, textInfo, false); else tempCell = AddTextToCell(flightInfo.ArrivalDateandTimeBack.ToString(), row5SummaryTable, textInfo, false); row5SummaryTable.Cells.Add(tempCell); }
//create object with text styling information private Aspose.Pdf.Generator.TextInfo SetTextInfo(string fontName, float fontSize, string fontColor, bool isBold) { Aspose.Pdf.Generator.TextInfo textInfo = new Aspose.Pdf.Generator.TextInfo(); textInfo.FontSize = fontSize; textInfo.Color = new Aspose.Pdf.Generator.Color(fontColor); textInfo.Alignment = AlignmentType.Center; textInfo.IsTrueTypeFontBold = isBold; textInfo.TruetypeFontFileName = fontName; return textInfo; }
private void PutSummary(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, FlightInfo flightInfo) { //create a table to hold summary of the order Table summaryTable = new Table(); Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188); summaryTable.Margin.Top = 20; summaryTable.ColumnWidths = "60 80 80 80 80 80"; summaryTable.DefaultCellTextInfo.FontSize = 10; summaryTable.DefaultCellBorder = new BorderInfo((int)BorderSide.All, color); summaryTable.DefaultCellPadding.Bottom = summaryTable.DefaultCellPadding.Top = 3; //add table to the first section/page Section section = pdf.Sections[0]; section.Paragraphs.Add(summaryTable); //create row and add cells and contents Row row1SummaryTable = summaryTable.Rows.Add(); Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 10; tf1.Color = new Aspose.Pdf.Generator.Color("White"); tf1.FontName = "Helvetica-Bold"; tf1.Alignment = AlignmentType.Center; Cell cell1Row1SummaryTable = row1SummaryTable.Cells.Add("Order ID", tf1); cell1Row1SummaryTable.BackgroundColor = color; Cell cell2Row1SummaryTable = row1SummaryTable.Cells.Add("Customer ID", tf1); cell2Row1SummaryTable.BackgroundColor = color; Cell cell3Row1SummaryTable = row1SummaryTable.Cells.Add("Agent ID", tf1); cell3Row1SummaryTable.BackgroundColor = color; Cell cell4Row1SummaryTable = row1SummaryTable.Cells.Add("Sales Person", tf1); cell4Row1SummaryTable.BackgroundColor = color; Cell cell5Row1SummaryTable = row1SummaryTable.Cells.Add("Required Date", tf1); cell5Row1SummaryTable.BackgroundColor = color; Cell cell6Row1SummaryTable = row1SummaryTable.Cells.Add("Shipped Date", tf1); cell6Row1SummaryTable.BackgroundColor = color; Row row2SummaryTable = summaryTable.Rows.Add(); tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 9; tf1.Color = new Aspose.Pdf.Generator.Color("Black"); tf1.FontName = "Times-Roman"; tf1.Alignment = AlignmentType.Center; row2SummaryTable.Cells.Add("90234", tf1); row2SummaryTable.Cells.Add("3762", tf1); row2SummaryTable.Cells.Add("AU89", tf1); row2SummaryTable.Cells.Add("James Smith", tf1); row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1); row2SummaryTable.Cells.Add(DateTime.Now.Date.ToString(), tf1); }
private Table AddTable(Aspose.Pdf.Generator.Pdf pdf) { //create a table to hold order details Table detailTable = new Table(); Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188); detailTable.Margin.Top = 20; detailTable.ColumnWidths = "60 150 60 80 60 80"; //detailTable.DefaultCellBorder = new BorderInfo((int)(BorderSide.Top|BorderSide.Bottom), color); detailTable.DefaultCellBorder = new BorderInfo((int)(BorderSide.Top | BorderSide.Bottom | BorderSide.Right | BorderSide.Left), color); detailTable.DefaultCellTextInfo.FontSize = 10; detailTable.DefaultCellPadding.Bottom = detailTable.DefaultCellPadding.Top = 4; Section section = pdf.Sections[0]; section.Paragraphs.Add(detailTable); Row row1DetailTable = detailTable.Rows.Add(); Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 10; tf1.Color = new Aspose.Pdf.Generator.Color("White"); tf1.FontName = "Helvetica-Bold"; tf1.Alignment = AlignmentType.Center; Cell cell1Row1DetailTable = row1DetailTable.Cells.Add("Product ID", tf1); cell1Row1DetailTable.BackgroundColor = color; Cell cell2Row1DetailTable = row1DetailTable.Cells.Add("Product Name", tf1); cell2Row1DetailTable.BackgroundColor = color; Cell cell3Row1DetailTable = row1DetailTable.Cells.Add("Quantity", tf1); cell3Row1DetailTable.BackgroundColor = color; Cell cell4Row1DetailTable = row1DetailTable.Cells.Add("Unit Price", tf1); cell4Row1DetailTable.BackgroundColor = color; Cell cell5Row1DetailTable = row1DetailTable.Cells.Add("Discount", tf1); cell5Row1DetailTable.BackgroundColor = color; Cell cell6Row1DetailTable = row1DetailTable.Cells.Add("Extended Price", tf1); cell6Row1DetailTable.BackgroundColor = color; return detailTable; }
public Aspose.Pdf.Generator.Pdf GetProductsByCategory() { IList <Product> productsList = productDao.GetAll(); IList <Category> CategoryList = categoryDao.GetAll(); Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf(); pdf.IsTruetypeFontMapCached = false; // If you have purchased a license, // Set license like this: // string licenseFile = MapPath("License") + "\\Aspose.Pdf.lic"; // Aspose.Pdf.License lic = new Aspose.Pdf.License(); // lic.SetLicense(licenseFile); string xmlFile = Server.MapPath("~/App_Data/xml/ProductsByCategory.xml"); pdf.BindXML(xmlFile, null); Section section = pdf.Sections["section1"]; Aspose.Pdf.Generator.Table table1 = new Aspose.Pdf.Generator.Table(section); section.Paragraphs.Add(table1); table1.ColumnWidths = "314 314 314"; table1.Border = new BorderInfo((int)BorderSide.Top, 4, new Aspose.Pdf.Generator.Color(204)); table1.IsRowBroken = false; table1.DefaultCellPadding.Top = table1.DefaultCellPadding.Bottom = 15; table1.DefaultCellTextInfo.FontSize = 14; table1.Margin.Top = 10; int j; Row curRow = null; Cell curCell = null; Aspose.Pdf.Generator.Table curSubTab = null; string[] names = new string[] { "Catagory: Beverages", "Catagory: Condiments", "Catagory: Confections", "Catagory: Dairy Products", "Catagory: Grains/Cereals", "Catagory: Meat/Poultry", "Catagory: Produce", "Catagory: Seafood" }; for (j = 1; j <= 8; j++) { if (j == 1 || j == 4 || j == 7) { curRow = table1.Rows.Add(); } curCell = curRow.Cells.Add(); curSubTab = new Aspose.Pdf.Generator.Table(curCell); curSubTab.DefaultCellPadding.Top = curSubTab.DefaultCellPadding.Bottom = 3; curCell.Paragraphs.Add(curSubTab); curSubTab.ColumnWidths = "214 90"; Row row0 = curSubTab.Rows.Add(); Aspose.Pdf.Generator.TextInfo tf1 = new Aspose.Pdf.Generator.TextInfo(); tf1.FontSize = 16; tf1.FontName = "Times-Bold"; row0.Cells.Add(names[j - 1], tf1); IList <Product> filteredProductsList = (from productsTable in productsList where (productsTable.Discontinued == false) && (productsTable.CategoryID == j) orderby productsTable.ProductName select productsTable).ToList <Product>(); DataTable dataTable1 = ConvertToDataTable(filteredProductsList); curSubTab.ImportDataTable(dataTable1, true, 1, 0); curSubTab.Rows[1].Border = new BorderInfo((int)(BorderSide.Top | BorderSide.Bottom), 4, new Aspose.Pdf.Generator.Color(204)); Row lastRow = curSubTab.Rows[curSubTab.Rows.Count - 1]; foreach (Cell cCell in lastRow.Cells) { cCell.Padding.Bottom = 20; } lastRow = curSubTab.Rows.Add(); lastRow.Cells.Add("number of products:"); lastRow.Cells.Add(dataTable1.Rows.Count.ToString()); lastRow.Border = new BorderInfo((int)BorderSide.Top, new Aspose.Pdf.Generator.Color(204)); } curRow.Cells.Add(); return(pdf); }
private void PutSummary(Aspose.Pdf.Generator.Pdf pdf, PassengerInfo passengerInfo, BookingInfo bookingInfo, FlightInfo flightInfo, bool isReturn) { //create table structure for the ticket Table summaryTable = new Table(); Aspose.Pdf.Generator.Color color = new Aspose.Pdf.Generator.Color(111, 146, 188); summaryTable.Margin.Top = 20; summaryTable.ColumnWidths = "80 80 80 80"; summaryTable.DefaultCellTextInfo.FontSize = 10; summaryTable.DefaultCellPadding.Bottom = summaryTable.DefaultCellPadding.Top = 3; summaryTable.Border = new BorderInfo((int)BorderSide.Box, 0.5f, color); summaryTable.BackgroundColor = new Color(173, 202, 225); //add table to the PDF page Section section = pdf.Sections[0]; section.Paragraphs.Add(summaryTable); //declare temporary variables Aspose.Pdf.Generator.TextInfo textInfo = new Aspose.Pdf.Generator.TextInfo(); Cell tempCell; //add logo and barcode images Row row1SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); Cell cell1 = new Cell(row1SummaryTable); cell1.ColumnsSpan = 2; cell1.DefaultCellTextInfo = textInfo; Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image(); img.ImageInfo.File = path + "\\FlyNowLogoOnly.jpg"; img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg; img.ImageInfo.FixWidth = 90; img.ImageInfo.FixHeight = 30; cell1.Paragraphs.Add(img); row1SummaryTable.Cells.Add(cell1); Cell cell2 = new Cell(row1SummaryTable); cell2.ColumnsSpan = 2; cell2.DefaultCellTextInfo = textInfo; cell2.Alignment = AlignmentType.Right; img = new Aspose.Pdf.Generator.Image(); if (!isReturn) { img.ImageInfo.File = path + "\\barcodeleave.jpg"; } else { img.ImageInfo.File = path + "\\barcodereturn.jpg"; } img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg; img.ImageInfo.FixWidth = 160; img.ImageInfo.FixHeight = 30; cell2.Paragraphs.Add(img); row1SummaryTable.Cells.Add(cell2); Row row2SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Class:", row2SummaryTable, textInfo, true); row2SummaryTable.Cells.Add(tempCell); //cell2 = new Cell(row2SummaryTable); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); tempCell = AddTextToCell("Economy", row2SummaryTable, textInfo, false); row2SummaryTable.Cells.Add(tempCell); //add emptry cells Cell cell3 = new Cell(row2SummaryTable); row2SummaryTable.Cells.Add(cell3); Cell cell4 = new Cell(row2SummaryTable); row2SummaryTable.Cells.Add(cell4); //add flight details Row row3SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Flight: ", row3SummaryTable, textInfo, true); row3SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if (!isReturn) { tempCell = AddTextToCell(flightInfo.FlightNumberLeave, row3SummaryTable, textInfo, false); } else { tempCell = AddTextToCell(flightInfo.FlightNumberReturn, row3SummaryTable, textInfo, false); } row3SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Seat Number: ", row3SummaryTable, textInfo, true); row3SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); tempCell = AddTextToCell(passengerInfo.SeatNumber, row3SummaryTable, textInfo, false); row3SummaryTable.Cells.Add(tempCell); Row row4SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("From: ", row3SummaryTable, textInfo, true); row4SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if (!isReturn) { tempCell = AddTextToCell(flightInfo.DepartureLocation, row3SummaryTable, textInfo, false); } else { tempCell = AddTextToCell(flightInfo.Destination, row3SummaryTable, textInfo, false); } row4SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("To: ", row3SummaryTable, textInfo, true); row4SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if (!isReturn) { tempCell = AddTextToCell(flightInfo.Destination, row3SummaryTable, textInfo, false); } else { tempCell = AddTextToCell(flightInfo.DepartureLocation, row3SummaryTable, textInfo, false); } row4SummaryTable.Cells.Add(tempCell); Row row5SummaryTable = summaryTable.Rows.Add(); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Departure:", row5SummaryTable, textInfo, true); row5SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if (!isReturn) { tempCell = AddTextToCell(flightInfo.DepartureDateandTime.ToString(), row5SummaryTable, textInfo, false); } else { tempCell = AddTextToCell(flightInfo.ReturnDateandTime.ToString(), row5SummaryTable, textInfo, false); } row5SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", true); tempCell = AddTextToCell("Arrival:", row5SummaryTable, textInfo, true); row5SummaryTable.Cells.Add(tempCell); textInfo = SetTextInfo("Times-Roman", 9, "Black", false); if (!isReturn) { tempCell = AddTextToCell(flightInfo.ArrivalDateandTimeDest.ToString(), row5SummaryTable, textInfo, false); } else { tempCell = AddTextToCell(flightInfo.ArrivalDateandTimeBack.ToString(), row5SummaryTable, textInfo, false); } row5SummaryTable.Cells.Add(tempCell); }