public ActionResult TestMigraDocMixPdfSharp() { PdfDocument doc = new PdfDocument(); doc.Info.Title = "Member information"; doc.Info.Author = "PalangPanya"; doc.Info.Subject = "Member information"; doc.Info.Keywords = "PalangPanya"; PdfPage page = doc.AddPage(); XGraphics gfx = XGraphics.FromPdfPage(page); gfx.MUH = PdfFontEncoding.Unicode; gfx.MFEH = PdfFontEmbedding.Default; XFont font = new XFont("Cordia New", 16, XFontStyle.Bold); gfx.DrawString("The following paragraph was rendered using ภาษาภ", font, XBrushes.Black, new XRect(100, 100, page.Width - 200, 300), XStringFormats.Center); XPen pen = new XPen(XColors.Navy, Math.PI); gfx.DrawRectangle(pen, 10, 0, 100, 60); gfx.DrawRectangle(XBrushes.DarkOrange, 130, 0, 100, 60); gfx.DrawRectangle(pen, XBrushes.DarkOrange, 10, 80, 100, 60); gfx.DrawRectangle(pen, XBrushes.DarkOrange, 150, 80, 60, 60); Document document = new Document(); Section sec = document.AddSection(); //Paragraph para = sec.AddParagraph(); //para.Format.Alignment = ParagraphAlignment.Justify; //para.Format.Font.Name = "Times New Roman"; //para.Format.Font.Size = 12; //para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray; //para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray; //para.AddText("Duisism odigna acipsum delesenisl "); //para.AddFormattedText("ullum in velenit", TextFormat.Bold); //para.AddText(" ipit iurero dolum zzriliquisis nit wis dolore vel et nonsequipit, velendigna " + // "auguercilit lor se dipisl duismod tatem zzrit at laore magna feummod oloborting ea con vel " + // "essit augiati onsequat luptat nos diatum vel ullum illummy nonsent nit ipis et nonsequis " + // "niation utpat. Odolobor augait et non etueril landre min ut ulla feugiam commodo lortie ex " + // "essent augait el ing eumsan hendre feugait prat augiatem amconul laoreet. ≤≥≈≠"); //para.Format.Borders.Distance = "5pt"; //para.Format.Borders.Color = Colors.Gold; Paragraph paragraph = sec.AddParagraph(); paragraph.Format.Font.Color = Color.FromCmyk(100, 30, 20, 50); paragraph.AddFormattedText("Hello,ไทย World!", TextFormat.Bold); paragraph.AddFormattedText("ทดสอบการใช้ภาษา", TextFormat.Italic); var logoPath = Path.Combine(_env.WebRootPath, "images"); logoPath = Path.Combine(logoPath, "logo_t.png"); Image imgLogo = sec.AddImage(logoPath); imgLogo.Height = "2cm"; imgLogo.LockAspectRatio = true; var memberPicPath = Path.Combine(_env.WebRootPath, "images_member"); memberPicPath = Path.Combine(memberPicPath, "_2_1365148227.jpg"); //memberPicPath = Path.Combine(memberPicPath, "_677138-topic-ix-1.jpg"); Image imgMember = sec.AddImage(memberPicPath); imgMember.Height = "5cm"; imgMember.LockAspectRatio = true; imgMember.RelativeVertical = RelativeVertical.Line; imgMember.RelativeHorizontal = RelativeHorizontal.Margin; imgMember.Top = ShapePosition.Top; imgMember.Left = ShapePosition.Right; imgMember.WrapFormat.Style = WrapStyle.Through; //document.UseCmykColor = true; const bool unicode = true; const PdfFontEmbedding embedding = PdfFontEmbedding.Always; PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(unicode, embedding); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); //MigraDoc.Rendering.DocumentRenderer docRenderer = new DocumentRenderer(document); //MigraDoc.Rendering.DocumentRenderer docRenderer = pdfRenderer.DocumentRenderer; //docRenderer.PrepareDocument(); //docRenderer.RenderObject(gfx, XUnit.FromCentimeter(5), XUnit.FromCentimeter(10), "12cm", paragraph); MemoryStream m = new MemoryStream(); doc.Save(m, false); return(new FileStreamResult(m, "application/pdf")); }
private void BtnPrintVouchersAndTickets_Click(object sender, EventArgs e) { Button button = sender as Button; bool closeForm = true; if ((button == BtnPrintHotelVouchers) || (button == BtnPrintBoth)) { //MessageBox.Show("Button pressed = " + button.Text, "PRINTING HOTEL VOUCHERS", MessageBoxButtons.OK, MessageBoxIcon.Information); /* open connection */ try { mySqlConnection.Open(); } catch (Exception errConnOpen) { MessageBox.Show("Error in opening mysql connection because : " + errConnOpen.Message); return; } /* now execute query to obtain data from hotel booking table * and fill t in dataset */ string mySqlQueryString = "SELECT DISTINCT `idhotelinfo` FROM `hotelbookinginfo` WHERE `queryid` = '" + queryId + "' ORDER BY `idhotelinfo`"; DataSet dataset = new DataSet(); MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlQueryString, mySqlConnection); mySqlDataAdapter.Fill(dataset, "TABLE_HOTEL_ID"); if ((dataset == null) || (dataset.Tables["TABLE_HOTEL_ID"].Rows.Count < 1)) { MessageBox.Show("No Hotel information present for QueryId = " + queryId, "No Data Present", MessageBoxButtons.OK, MessageBoxIcon.Warning); try { mySqlConnection.Close(); } catch (Exception errConnClose) { MessageBox.Show("Error in opening mysql connection because : " + errConnClose.Message); } return; } saveFileDialogItinerary.Title = "HOTEL VOUCHER FILE NAME"; if (saveFileDialogItinerary.ShowDialog() == DialogResult.OK) { /* file selected */ Debug.WriteLine("OUT FILE SELECTED : " + saveFileDialogItinerary.FileName); } else { Debug.WriteLine("File not selected thus returning"); try { mySqlConnection.Close(); } catch (Exception errConnClose) { MessageBox.Show("Error in opening mysql connection because : " + errConnClose.Message); } return; } string imagePath = saveFileDialogItinerary.FileName + "logo.png"; Properties.Resources.ExcursionHolidaysSmallLogo.Save(imagePath); Document document = new Document(); document.Info.Title = "HOTEL VOUCHER FOR " + queryId; /* now cange the style of the document */ MyPdfDocuments.DefineStyles(document); /* add section to document */ Section section = document.AddSection(); /* add hotel booking details. * add different page for different hotel */ for (int pageNumber = 0; pageNumber < dataset.Tables["TABLE_HOTEL_ID"].Rows.Count; pageNumber++) { mySqlQueryString = "SELECT * FROM `hotelbookinginfo` WHERE `queryid` = '" + queryId + "' AND idhotelinfo = " + dataset.Tables["TABLE_HOTEL_ID"].Rows[pageNumber]["idhotelinfo"].ToString(); mySqlDataAdapter = new MySqlDataAdapter(mySqlQueryString, mySqlConnection); string tableNameHotelRates = "TABLE_HOTEL_ID_" + pageNumber.ToString(); mySqlDataAdapter.Fill(dataset, tableNameHotelRates); mySqlQueryString = "SELECT `hoteladdress`, `hotelname` FROM `hotelinfo` WHERE `idhotelinfo` = " + dataset.Tables["TABLE_HOTEL_ID"].Rows[pageNumber]["idhotelinfo"].ToString(); mySqlDataAdapter = new MySqlDataAdapter(mySqlQueryString, mySqlConnection); string tableNameHotelAddress = "HOTEL_ADDRESS_" + pageNumber.ToString(); mySqlDataAdapter.Fill(dataset, tableNameHotelAddress); if (dataset.Tables[tableNameHotelRates].Rows.Count < 1) { continue; } if (pageNumber > 0) { section.AddPageBreak(); } Paragraph paragraph = section.AddParagraph("HOTEL VOUCHER", "Heading1"); /* enter reference details in tabular form */ Table table = null; Column column = null; int columnCount = 0; // 1; double columnWidth = 0; // (21.0 - 2.0) / columnCount; Row row = null; int rowsCount = 0; table = section.AddTable(); table.Borders.Visible = true; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 3; columnWidth = (21.0 - 2.0) / columnCount; for (int index = 0; index < columnCount; index++) { column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Center; } row = table.AddRow(); rowsCount++; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Reference No", "Heading2"); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText("Confirmed By", "Heading2"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Hotel Confirmation No", "Heading2"); row = table.AddRow(); rowsCount++; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText(queryId, "Heading3"); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[0]["confirmby"].ToString(), "Heading3"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[0]["idconfirmation"].ToString(), "Heading3"); /* Add contant for the table information */ table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 1.5, Colors.SkyBlue); rowsCount = columnCount = 0; section.AddParagraph("\n", "Normal"); /* add hotel address and agency address in table */ table = section.AddTable(); table.Borders.Visible = false; table.Borders.Width = 0.75; columnCount = 2; columnWidth = (21.0 - 2.0) / columnCount; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn(Unit.FromCentimeter(1.2)); column.Format.Alignment = ParagraphAlignment.Left; columnCount++; column = table.AddColumn(Unit.FromCentimeter(columnWidth - 1.2)); column.Format.Alignment = ParagraphAlignment.Left; row = table.AddRow(); rowsCount++; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Hotel Address Details", "Heading2"); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText("Agency Address Details", "Heading2"); row.Cells[1].MergeRight = 1; row = table.AddRow(); rowsCount++; //MyPdfDocuments.WriteHdrContentParagraph(row.Cells[0], dataset.Tables[tableNameHotelAddress].Rows[0]["hotelname"].ToString(), dataset.Tables[tableNameHotelAddress].Rows[0]["hoteladdress"].ToString()); paragraph = row.Cells[0].AddParagraph(); paragraph.Format.RightIndent = "1.5cm"; paragraph.AddFormattedText(dataset.Tables[tableNameHotelAddress].Rows[0]["hotelname"].ToString() + "\n", "Heading3"); paragraph.AddFormattedText(dataset.Tables[tableNameHotelAddress].Rows[0]["hoteladdress"].ToString()); MigraDoc.DocumentObjectModel.Shapes.Image image = row.Cells[1].AddImage(imagePath); image.Width = "1cm"; //image.Left = "-2.4cm"; MyPdfDocuments.WriteAgencyAddressDetails(row.Cells[2]); /* Add contant for the table information */ table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 1.5, Colors.SkyBlue); rowsCount = columnCount = 0; section.AddParagraph("\n", "Normal"); table = section.AddTable(); table.Borders.Visible = true; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 6; columnWidth = (21.0 - 2.0) / columnCount; for (int index = 1; index < columnCount; index++) { column = table.AddColumn(Unit.FromCentimeter(columnWidth + 0.45)); column.Format.Alignment = ParagraphAlignment.Left; } column = table.AddColumn(Unit.FromCentimeter(columnWidth - (0.45 * 5))); column.Format.Alignment = ParagraphAlignment.Left; row = table.AddRow(); rowsCount++; row.VerticalAlignment = VerticalAlignment.Center; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Lead Passenger Name", "Heading2"); row.Cells[0].MergeRight = 1; paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[0]["leadpassangername"].ToString(), "Heading3"); row.Cells[2].MergeRight = 3; row = table.AddRow(); rowsCount++; row.VerticalAlignment = VerticalAlignment.Center; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Check In Date", "Heading2"); paragraph = row.Cells[1].AddParagraph(); //paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[0]["checkindate"].ToString(), "Heading3"); paragraph.AddFormattedText(DateTime.Parse(dataset.Tables[tableNameHotelRates].Rows[0]["checkindate"].ToString()).ToString("yyyy - MM - dd"), "Heading3"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Check Out Date", "Heading2"); paragraph = row.Cells[3].AddParagraph(); //paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[0]["checkoutdate"].ToString(), "Heading3"); paragraph.AddFormattedText(DateTime.Parse(dataset.Tables[tableNameHotelRates].Rows[0]["checkoutdate"].ToString()).ToString("yyyy - MM - dd"), "Heading3"); paragraph = row.Cells[4].AddParagraph(); paragraph.AddFormattedText("No of Nights", "Heading2"); paragraph = row.Cells[5].AddParagraph(); double noOfnights = (DateTime.Parse(dataset.Tables[tableNameHotelRates].Rows[0]["checkoutdate"].ToString()) - DateTime.Parse(dataset.Tables[tableNameHotelRates].Rows[0]["checkindate"].ToString())).TotalDays; paragraph.AddFormattedText(Convert.ToInt32(noOfnights).ToString(), "Heading3"); row = table.AddRow(); rowsCount++; row.VerticalAlignment = VerticalAlignment.Center; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Pick Time", "Heading2"); paragraph = row.Cells[1].AddParagraph(); //paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[0]["checkindate"].ToString(), "Heading3"); paragraph.AddFormattedText(DateTime.Parse(dataset.Tables[tableNameHotelRates].Rows[0]["checkindate"].ToString()).ToString("HH:mm"), "Heading3"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Drop Time", "Heading2"); paragraph = row.Cells[3].AddParagraph(); //paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[0]["checkoutdate"].ToString(), "Heading3"); paragraph.AddFormattedText(DateTime.Parse(dataset.Tables[tableNameHotelRates].Rows[0]["checkoutdate"].ToString()).ToString("HH:mm"), "Heading3"); row.Cells[4].MergeRight = 1; table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 1.5, Colors.SkyBlue); rowsCount = columnCount = 0; section.AddParagraph("\n", "Normal"); table = section.AddTable(); table.Borders.Visible = true; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 6; columnWidth = (21.0 - 2.0) / columnCount; column = table.AddColumn(Unit.FromCentimeter(1.5)); column.Format.Alignment = ParagraphAlignment.Center; column = table.AddColumn(Unit.FromCentimeter(2 * columnWidth - 1.5)); column.Format.Alignment = ParagraphAlignment.Center; for (int index = 2; index < columnCount; index++) { column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Center; } row = table.AddRow(); rowsCount++; row.VerticalAlignment = VerticalAlignment.Center; //row.Shading.Color = Colors.LightSlateGray; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("S. No", "Heading2"); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText("Room Type", "Heading2"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Meal Plan", "Heading2"); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText("No of Rooms", "Heading2"); paragraph = row.Cells[4].AddParagraph(); paragraph.AddFormattedText("No of Guests", "Heading2"); paragraph = row.Cells[5].AddParagraph(); paragraph.AddFormattedText("Guests Type", "Heading2"); for (int roomCounter = 0; roomCounter < dataset.Tables[tableNameHotelRates].Rows.Count; roomCounter++) { row = table.AddRow(); rowsCount++; row.VerticalAlignment = VerticalAlignment.Center; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText((roomCounter + 1).ToString(), "Heading3"); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[roomCounter]["roomtype"].ToString(), "Heading3"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[roomCounter]["mealplan"].ToString(), "Heading3"); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countroom"].ToString(), "Heading3"); paragraph = row.Cells[4].AddParagraph(); int numberOfGuest = Convert.ToInt32(dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countadults"]) + Convert.ToInt32(dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countchildren"]); paragraph.AddFormattedText(numberOfGuest.ToString(), "Heading3"); paragraph = row.Cells[5].AddParagraph(); string guestType = "Adults(" + dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countadults"].ToString() + ")"; if (Convert.ToInt32(dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countchildren"]) > 0) { guestType = guestType + "\nChildren(" + dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countchildren"].ToString() + ")"; } if (Convert.ToInt32(dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countinfants"]) > 0) { guestType = guestType + "\nBabies(" + dataset.Tables[tableNameHotelRates].Rows[roomCounter]["countinfants"].ToString() + ")"; } paragraph.AddFormattedText(guestType, "Heading3"); } table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 1.5, Colors.SkyBlue); rowsCount = columnCount = 0; section.AddParagraph("\n", "Normal"); MyPdfDocuments.WriteHotelVoucherStaticDetails(section); } PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always); try { /* try to save file */ renderer.Document = document; renderer.RenderDocument(); renderer.PdfDocument.Save(saveFileDialogItinerary.FileName); renderer.PdfDocument.Close(); Process.Start(saveFileDialogItinerary.FileName); } catch (Exception errSave) { MessageBox.Show("Error in saving file " + saveFileDialogItinerary.FileName + " because " + errSave.Message); Debug.WriteLine("Error in saving file " + saveFileDialogItinerary.FileName + " because " + errSave.Message); closeForm = false; } finally { System.IO.File.Delete(imagePath); } /* now close connection */ try { mySqlConnection.Close(); } catch (Exception errConnClose) { MessageBox.Show("Error in opening mysql connection because : " + errConnClose.Message); } if (closeForm) { Debug.WriteLine("File saved: " + saveFileDialogItinerary.FileName); } else { return; } } if ((button == BtnPrintFlightTickets) || (button == BtnPrintBoth)) { //MessageBox.Show("Button pressed = " + button.Text, "PRINTING FLIGHT TICKETS", MessageBoxButtons.OK, MessageBoxIcon.Information); /* open connection */ try { mySqlConnection.Open(); } catch (Exception errConnOpen) { MessageBox.Show("Error in opening mysql connection because : " + errConnOpen.Message); return; } /* now execute query to obtain data from hotel booking table * and fill t in dataset */ string mySqlQueryString = "SELECT DISTINCT `pnr` FROM `flightbookinginfo` WHERE `queryid` = '" + queryId + "' ORDER BY `pnr`"; DataSet dataset = new DataSet(); MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlQueryString, mySqlConnection); mySqlDataAdapter.Fill(dataset, "TABLE_FLIGHT_PNR"); if ((dataset == null) || (dataset.Tables["TABLE_FLIGHT_PNR"].Rows.Count < 1)) { MessageBox.Show("No Flight information present for QueryId = " + queryId, "No Data Present", MessageBoxButtons.OK, MessageBoxIcon.Warning); try { mySqlConnection.Close(); } catch (Exception errConnClose) { MessageBox.Show("Error in opening mysql connection because : " + errConnClose.Message); } return; } saveFileDialogItinerary.Title = "FLIGHT TICKET FILE NAME"; if (saveFileDialogItinerary.ShowDialog() == DialogResult.OK) { /* file selected */ Debug.WriteLine("OUT FILE SELECTED : " + saveFileDialogItinerary.FileName); } else { Debug.WriteLine("File not selected thus returning"); try { mySqlConnection.Close(); } catch (Exception errConnClose) { MessageBox.Show("Error in opening mysql connection because : " + errConnClose.Message); } return; } string imagePath = saveFileDialogItinerary.FileName + "logo.png"; Properties.Resources.ExcursionHolidaysSmallLogo.Save(imagePath); Document document = new Document(); document.Info.Title = "FLIGHT TICKET FOR " + queryId; /* Ask for printing price on ticket */ bool printPrice = false; DialogResult dialogResult = MessageBox.Show("Flight price details needs to be printed in the flight voucher?", "PRINT PRICE ON VOUCHER", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { printPrice = true; } else { Debug.WriteLine("Price not printing in the ticket"); } /* now cange the style of the document */ MyPdfDocuments.DefineStyles(document); /* add section to document */ Section section = document.AddSection(); for (int pageNumber = 0; pageNumber < dataset.Tables["TABLE_FLIGHT_PNR"].Rows.Count; pageNumber++) { mySqlQueryString = "SELECT * FROM `flightbookinginfo` WHERE `queryid` = '" + queryId + "' AND `pnr` = '" + dataset.Tables["TABLE_FLIGHT_PNR"].Rows[pageNumber]["pnr"].ToString() + "'"; mySqlDataAdapter = new MySqlDataAdapter(mySqlQueryString, mySqlConnection); string tableFlightInfo = "TABLE_FLIGHT_ID_" + pageNumber.ToString(); mySqlDataAdapter.Fill(dataset, tableFlightInfo); if (dataset.Tables[tableFlightInfo].Rows.Count < 1) { continue; } if (pageNumber > 0) { section.AddPageBreak(); } Paragraph paragraph; Table table = null; Column column = null; int columnCount = 0; // 1; double columnWidth = 0; // (21.0 - 2.0) / columnCount; Row row = null; int rowsCount = 0; table = section.AddTable(); table.Borders.Visible = false; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 3; columnWidth = (21.0 - 2.0) / columnCount; column = table.AddColumn(Unit.FromCentimeter(1.2)); column.Format.Alignment = ParagraphAlignment.Left; columnCount++; column = table.AddColumn(Unit.FromCentimeter(columnWidth - 1.2)); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Center; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Right; row = table.AddRow(); rowsCount++; MigraDoc.DocumentObjectModel.Shapes.Image image = row.Cells[0].AddImage(imagePath); image.Width = "1cm"; MyPdfDocuments.WriteAgencyAddressDetails(row.Cells[1]); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("E - Ticket\nTICKETED", "Heading2"); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText("PNR: " + dataset.Tables[tableFlightInfo].Rows[0]["pnr"].ToString() + " \nIssued Date: " + DateTime.Parse(dataset.Tables[tableFlightInfo].Rows[0]["issuedate"].ToString()).ToString("ddd dd MM yyyy") + "", "Normal"); table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.None, 0, Colors.SkyBlue); rowsCount = columnCount = 0; section.AddParagraph("\n", "Normal"); table = section.AddTable(); table.Borders.Visible = false; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 3; columnWidth = (21.0 - 2.0) / columnCount; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Left; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Center; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Right; row = table.AddRow(); rowsCount++; row.Shading.Color = Colors.AliceBlue; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Passanger Name", "Heading3"); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText("Ticket Number", "Heading3"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Frequent flyer no.", "Heading3"); string[] persons = dataset.Tables[tableFlightInfo].Rows[0]["passangername"].ToString().Split(','); string[] tickets = dataset.Tables[tableFlightInfo].Rows[0]["ticketnumber"].ToString().Split(','); string[] ffys = dataset.Tables[tableFlightInfo].Rows[0]["ffy"].ToString().Split(','); for (int index = 0; index < persons.Length; index++) { if (string.Equals(persons[index], "")) { continue; } row = table.AddRow(); rowsCount++; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText(persons[index]); paragraph = row.Cells[1].AddParagraph(); try { paragraph.AddFormattedText(tickets[index]); } catch (Exception errindex) { MessageBox.Show("Error : " + errindex.Message, "Error in index", MessageBoxButtons.OK, MessageBoxIcon.Warning); paragraph.AddFormattedText(""); } paragraph = row.Cells[2].AddParagraph(); try { paragraph.AddFormattedText(ffys[index]); } catch (Exception errindex) { MessageBox.Show("Error : " + errindex.Message, "Error in index", MessageBoxButtons.OK, MessageBoxIcon.Warning); paragraph.AddFormattedText("-"); } } table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.None, 0.75, Colors.SkyBlue); rowsCount = columnCount = 0; section.AddParagraph("\n", "Normal"); table = section.AddTable(); table.Borders.Visible = false; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 4; columnWidth = (21.0 - 2.0) / columnCount; for (int index = 0; index < columnCount; index++) { column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Left; } row = table.AddRow(); row.Shading.Color = Colors.AliceBlue; rowsCount++; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Flight", "Heading3"); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText("Departure", "Heading3"); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Arrival", "Heading3"); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText("Status", "Heading3"); for (int flightCounter = 0; flightCounter < dataset.Tables[tableFlightInfo].Rows.Count; flightCounter++) { row = table.AddRow(); rowsCount++; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableFlightInfo].Rows[flightCounter]["flightinfo"].ToString()); paragraph = row.Cells[1].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableFlightInfo].Rows[flightCounter]["departureinfo"].ToString()); paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableFlightInfo].Rows[flightCounter]["arrivalinfo"].ToString()); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableFlightInfo].Rows[flightCounter]["statusinfo"].ToString()); } table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.None, 0.75, Colors.SkyBlue); rowsCount = columnCount = 0; section.AddParagraph("\n", "Normal"); table = section.AddTable(); table.Borders.Visible = false; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 4; columnWidth = (21.0 - 2.0) / columnCount; for (int index = 0; index < 2; index++) { column = table.AddColumn(Unit.FromCentimeter(columnWidth + 1.0)); column.Format.Alignment = ParagraphAlignment.Left; } for (int index = 2; index < 4; index++) { column = table.AddColumn(Unit.FromCentimeter(columnWidth - 1.0)); column.Format.Alignment = ParagraphAlignment.Right; } if (printPrice) { row = table.AddRow(); rowsCount++; row.Shading.Color = Colors.AliceBlue; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("Payment Details", "Heading3"); row.Cells[0].MergeRight = 3; } row = table.AddRow(); rowsCount++; paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("This is an Electronic ticket. Please carry a positive identification for Check in."); paragraph.Format.Font.Bold = true; row.Cells[0].MergeRight = 1; if (printPrice) { int totalPrice = Convert.ToInt32(dataset.Tables[tableFlightInfo].Rows[0]["amountfare"]) + Convert.ToInt32(dataset.Tables[tableFlightInfo].Rows[0]["amountgst"]) + Convert.ToInt32(dataset.Tables[tableFlightInfo].Rows[0]["amountsurcharge"]); row.Cells[0].MergeDown = 3; paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Fare", "Normal"); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableFlightInfo].Rows[0]["amountfare"].ToString(), "Normal"); row = table.AddRow(); rowsCount++; paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("K3/GST", "Normal"); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableFlightInfo].Rows[0]["amountgst"].ToString(), "Normal"); row = table.AddRow(); rowsCount++; paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Fee & Surcharge", "Normal"); paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText(dataset.Tables[tableFlightInfo].Rows[0]["amountsurcharge"].ToString(), "Normal"); row = table.AddRow(); rowsCount++; paragraph = row.Cells[2].AddParagraph(); paragraph.AddFormattedText("Total Amount"); paragraph.Format.Font.Bold = true; paragraph = row.Cells[3].AddParagraph(); paragraph.AddFormattedText(totalPrice.ToString()); paragraph.Format.Font.Bold = true; } table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.None, 0.5, Colors.SkyBlue); rowsCount = columnCount = 0; paragraph = section.AddParagraph("\n\n\n", "Normal"); /* ADD TERMINAL DETAILS HERE */ //paragraph = section.AddParagraph("<TERMINAL DETAILS TYPED HERE XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX>"); //paragraph.Format.Font.Color = Colors.Red; table = section.AddTable(); table.Borders.Visible = false; table.Borders.Width = 0.75; table.Borders.Color = Colors.SkyBlue; columnCount = 1; columnWidth = (21.0 - 2.0) / columnCount; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Left; row = table.AddRow(); rowsCount++; MyPdfDocuments.WriteFlightVoucherNote(row.Cells[0]); table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 0, Colors.SkyBlue); } PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always); try { /* try to save file */ renderer.Document = document; renderer.RenderDocument(); renderer.PdfDocument.Save(saveFileDialogItinerary.FileName); renderer.PdfDocument.Close(); Process.Start(saveFileDialogItinerary.FileName); Debug.WriteLine("File saved: " + saveFileDialogItinerary.FileName); } catch (Exception errSave) { MessageBox.Show("Error in saving file " + saveFileDialogItinerary.FileName + " because " + errSave.Message); Debug.WriteLine("Error in saving file " + saveFileDialogItinerary.FileName + " because " + errSave.Message); closeForm = false; } finally { System.IO.File.Delete(imagePath); } try { mySqlConnection.Close(); } catch (Exception errConnClose) { MessageBox.Show("Error in opening mysql connection because : " + errConnClose.Message); } } if (closeForm) { Close(); } }
public static void CreatePage(Document document, List <LInfo> list) { // Each MigraDoc document needs at least one section. Section section = document.AddSection(); // Put a logo in the header Image image = section.Headers.Primary.AddImage("../../PowerBooks.png"); image.Height = "2.5cm"; image.LockAspectRatio = true; image.RelativeVertical = RelativeVertical.Line; image.RelativeHorizontal = RelativeHorizontal.Margin; image.Top = ShapePosition.Top; image.Left = ShapePosition.Right; image.WrapFormat.Style = WrapStyle.Through; // Create footer Paragraph paragraph = section.Footers.Primary.AddParagraph(); paragraph.AddText("Na potoce 390/27 · Třebíč"); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center; // Create the text frame for the address TextFrame addressFrame = section.AddTextFrame(); addressFrame.Height = "3.0cm"; addressFrame.Width = "7.0cm"; addressFrame.Left = ShapePosition.Left; addressFrame.RelativeHorizontal = RelativeHorizontal.Margin; addressFrame.Top = "5.0cm"; addressFrame.RelativeVertical = RelativeVertical.Page; // Put sender in address frame paragraph = addressFrame.AddParagraph("Na potoce 390/27, Třebíč"); paragraph.Format.Font.Name = "Times New Roman"; paragraph.Format.Font.Size = 7; paragraph.Format.SpaceAfter = 3; // Add the print date field paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "8cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText(Lng.Get("Lended"), TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Třebíč, "); paragraph.AddDateField("dd.MM.yyyy"); // Create the item table Table table = section.AddTable(); table.Style = "Table"; //table.Borders.Color = TableBorder; table.Borders.Width = 0.25; table.Borders.Left.Width = 0.5; table.Borders.Right.Width = 0.5; table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns Column column = table.AddColumn("1cm"); column.Format.Alignment = ParagraphAlignment.Center; column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("6cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Center; // Create the header of the table Row row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; //row.Shading.Color = TableBlue; row.Cells[0].AddParagraph(Lng.Get("Number")); row.Cells[0].Format.Font.Bold = false; row.Cells[0].Format.Alignment = ParagraphAlignment.Left; row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom; row.Cells[1].AddParagraph(Lng.Get("Type")); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].AddParagraph(Lng.Get("ItemName", "Name")); row.Cells[2].Format.Alignment = ParagraphAlignment.Left; row.Cells[3].AddParagraph(Lng.Get("LendFrom", "Lend from")); row.Cells[3].Format.Alignment = ParagraphAlignment.Left; row.Cells[4].AddParagraph(Lng.Get("LendTo", "Lend to")); row.Cells[4].Format.Alignment = ParagraphAlignment.Left; //row.Cells[0].MergeDown = 1; //row.Cells[1].MergeRight = 3; // Fill Table int i = 0; if (list != null && list.Count > 0) { foreach (var item in list) { row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; row.Cells[0].AddParagraph((i + 1).ToString()); row.Cells[0].Format.Font.Bold = false; row.Cells[0].Format.Alignment = ParagraphAlignment.Left; row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom; row.Cells[1].AddParagraph(global.GetItemTypeName(item.ItemType)); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].AddParagraph(item.Name); row.Cells[2].Format.Alignment = ParagraphAlignment.Left; row.Cells[3].AddParagraph(item.LendFrom.ToShortDateString()); row.Cells[3].Format.Alignment = ParagraphAlignment.Left; row.Cells[4].AddParagraph(item.LendTo.ToShortDateString()); row.Cells[4].Format.Alignment = ParagraphAlignment.Left; i++; } } table.SetEdge(0, 0, 5, 1 + i, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); }
public void AddAircraftsSchedules(Section sec) { Table t = sec.AddTable(); t.LeftPadding = "0mm"; t.RightPadding = "0mm"; t.TopPadding = "0mm"; t.BottomPadding = "0mm"; Column c = t.AddColumn("28mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("50mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("50mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("60mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("2mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; Row r = t.AddRow(); r = t.AddRow(); Paragraph p = p = r.Cells[0].AddParagraph(); r.Cells[0].MergeRight = 3; r.Cells[0].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("SCHEDULE OF AIRCRAFT", TextFormat.Underline); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); r.Cells[1].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("Aircraft Type", TextFormat.Underline); p = r.Cells[2].AddParagraph(); r.Cells[2].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("Registration", TextFormat.Underline); p = r.Cells[3].AddParagraph(); r.Cells[3].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("Passenger Seats", TextFormat.Underline); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); r.Cells[1].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("Acrosport 1"); p = r.Cells[2].AddParagraph(); r.Cells[2].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("G-BSHY"); p = r.Cells[3].AddParagraph(); r.Cells[3].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("2"); r = t.AddRow(); r = t.AddRow(); p = r.Cells[0].AddParagraph(); p.AddFormattedText("INSURER:", TextFormat.Underline); p.AddLineBreak(); p = r.Cells[1].AddParagraph(); r.Cells[1].MergeRight = 2; p.AddText("Great Lakes Insurance SE a wholly owned subsidiary of the group Munich RE"); p.AddLineBreak(); r = t.AddRow(); r = t.AddRow(); p = r.Cells[0].AddParagraph(); p.AddFormattedText("POLICY NO:", TextFormat.Underline); p = r.Cells[1].AddParagraph(); p.AddText("X09898 / ABZ453"); }
public void AddGeographicalLimits(Section sec) { Table t = sec.AddTable(); t.LeftPadding = "0mm"; t.RightPadding = "0mm"; t.TopPadding = "0mm"; t.BottomPadding = "0mm"; Column c = t.AddColumn("10mm"); //0 c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("10mm"); //1 c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("102mm"); //1 c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("66mm"); //2 c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("2mm"); //3 c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; Row r = t.AddRow(); Paragraph p = r.Cells[3].AddParagraph(); p.AddFormattedText("F186583 / 0448", TextFormat.Bold); p.Format.Alignment = ParagraphAlignment.Right; r = t.AddRow(); p = r.Cells[0].AddParagraph(); p.AddText("8."); p = r.Cells[1].AddParagraph(); p.AddFormattedText("GEOGRAPHICAL LIMITS:", TextFormat.Bold); r.Cells[1].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); r.Cells[1].MergeRight = 2; p.AddText("Worldwide, excluding the following countries and regions:"); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(a)"); p = r.Cells[2].AddParagraph(); p.AddText("Algeria, Burundi, Cabinda, Central African Republic, Congo, Democratic Republic of Congo, Eritrea, Ethiopia, Ivory Coast, Liberia, Mauritania, Nigeria, Somalia, The Republic of Sudan, South Sudan;"); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(b)"); p = r.Cells[2].AddParagraph(); p.AddText("Colombia, Ecuador, Peru;"); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(c)"); p = r.Cells[2].AddParagraph(); p.AddText("Afghanistan, Jammu&Kashmir, Myanmar, NorthKorea, Pakistan;"); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(d)"); p = r.Cells[2].AddParagraph(); p.AddText("Georgia, Nagorno-Karabakh, North Caucasian Federal District, Ukraine;"); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(e)"); p = r.Cells[2].AddParagraph(); p.AddText("Iran, Iraq, Libya, Syria, Yemen;"); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(f)"); p = r.Cells[2].AddParagraph(); p.AddText("United States of America and Canada."); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("In addition coverage is granted:"); r.Cells[1].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(i)"); p = r.Cells[2].AddParagraph(); p.AddText("for the overflight of any excluded country or region where the flight is within an internationally recognised air corridor and is performed in accordance with I.C.A.O. recommendations; or"); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("(ii)"); p = r.Cells[2].AddParagraph(); p.AddText("in circumstances where an insured Aircraft has landed in an excluded country or region as a direct consequence and exclusively as a result of force majeure."); r.Cells[2].MergeRight = 2; r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("Notwithstanding the above,coverage is excluded for any flight into any country or region where such operation of the Aircraft is in breach of United Nations or European Union sanctions."); r.Cells[1].MergeRight = 3; }
private void createJobDetailsSection() { Section currentSection = (Section)serviceSheetDoc.Sections.LastObject; jobDetailsTable = currentSection.AddTable(); //Setup the table columns and borders Column tableColumnn = jobDetailsTable.AddColumn(COLUMN_ONE_WIDTH); tableColumnn = jobDetailsTable.AddColumn(COLUMN_TWO_WIDTH); jobDetailsTable.Borders.Color = tableBorderColour; jobDetailsTable.Borders.Width = borderWidth; Row row1Title = jobDetailsTable.AddRow(); row1Title.Cells[0].MergeRight = 1; Paragraph jobDetailsPara = row1Title.Cells[0].AddParagraph(); jobDetailsPara.AddFormattedText("J", "allCapsFirstLetter"); jobDetailsPara.AddFormattedText("OB ", "allCapsNextLetter"); jobDetailsPara.AddFormattedText("D", "allCapsFirstLetter"); jobDetailsPara.AddFormattedText("ETAILS ", "allCapsNextLetter"); row1Title.Cells[0].Shading.Color = headerGrey; addLineToJobDetails("Customer", currentSheet.Customer); addLineToJobDetails("Address Line 1", currentSheet.AddressLine1); addLineToJobDetails("Address Line 2", currentSheet.AddressLine2); //RT 7/9/17 - Adding USA formatting if (currentSheet.UkServiceSheet == true) { addLineToJobDetails("Town/City", currentSheet.TownCity); addLineToJobDetails("Postcode", currentSheet.Postcode); } else { addLineToJobDetails("City", currentSheet.TownCity); addLineToJobDetails("Zip code", currentSheet.Postcode); } addLineToJobDetails("Customer contact", currentSheet.CustomerContact); addLineToJobDetails("Customer phone number", currentSheet.CustomerPhoneNo); addLineToJobDetails("Machine make and model", currentSheet.MachineMakeModel); addLineToJobDetails("Machine serial number", currentSheet.MachineSerial); addLineToJobDetails("CNC controller", currentSheet.CncControl); //RT 7/9/17 - Adding USA date format if (currentSheet.UkServiceSheet == true) { addLineToJobDetails("Job start date", currentSheet.DtJobStart.ToString("dd/MM/yyyy")); } else { addLineToJobDetails("Job start date", currentSheet.DtJobStart.ToString("MM/dd/yyyy")); } addLineToJobDetails("Customer order no.", currentSheet.CustomerOrderNo); addLineToJobDetails("MTT job no.", currentSheet.MttJobNumber); addLineToJobDetails("Job description", currentSheet.JobDescription); //Add a line break between the tables currentSection.AddParagraph(); }
public void AddClientDetailsPage2(Section sec) { Table t = sec.AddTable(); t.LeftPadding = "0mm"; t.RightPadding = "0mm"; t.TopPadding = "0mm"; t.BottomPadding = "0mm"; Column c = t.AddColumn("1mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("29mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("9mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("150mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("1mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; Row r = t.AddRow(); r = t.AddRow(); r.Style = "Heading3"; r.TopPadding = row_padding; r.BottomPadding = row_padding; r = t.AddRow(); Paragraph p = r.Cells[1].AddParagraph(); p = r.Cells[2].AddParagraph(); r.Cells[2].MergeRight = 1; p.AddText("War and Allied Risks are also covered, in accordance with Special Provision 10 of the policy, which provides comparable coverage with Extended Coverage Endorsement (Aviation Liabilities) AVN52E for a limit of any one accident and in the annual aggregate"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("The amounts of insurance stated herein are in accordance with the minimum insurance cover requirements of Articles 6 and 7 of Regulation (EC) No 785/2004 based on:"); r = t.AddRow(); p = r.Cells[2].AddParagraph(); p.AddText("(a)"); p = r.Cells[3].AddParagraph(); p.AddText("The rates of exchange applicable to Special Drawing Rights at inception of the insurances,"); r = t.AddRow(); p = r.Cells[2].AddParagraph(); p.AddText("(b)"); p = r.Cells[3].AddParagraph(); p.AddText("Third Party War, terrorism and allied perils being insured on an aggregate basis as above, as permissible in accordance with Article 7.1 of EC Regulation 785/2004."); r = t.AddRow(); p = r.Cells[2].AddParagraph(); p.AddText("(c)"); p = r.Cells[3].AddParagraph(); p.AddText("It being understood that such aggregate limits may be reduced or exhausted during the policy period by virtue of claims made against aircraft or other operational interest covered by the insurances."); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddFormattedText("PERIOD:", TextFormat.Underline); p = r.Cells[2].AddParagraph(); r.Cells[2].MergeRight = 1; p.AddText("11th March 2019 to 10th March 2020 both days inclusive local standard time at the Insureds address as stated"); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); //p.AddSpace(1); p.AddFormattedText("PILOTS:", TextFormat.Underline); p = r.Cells[2].AddParagraph(); r.Cells[2].MergeRight = 1; p.AddText("Mr. A"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("In addition, whilst giving instructions to the aforementioned pilots, any qualified flying instructor/examiner is automatically included as an approved pilot hereon"); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); //p.AddSpace(1); p.AddFormattedText("USES:", TextFormat.Underline); p = r.Cells[2].AddParagraph(); r.Cells[2].MergeRight = 1; p.AddText(" (as more fully defined in our Certificate Wording)."); }
private void Estatisticas_Partida() { Document document = new Document(); document.Info.Title = DateTime.Now.ToString("dd-MM-yyyy") + "_" + eventoAtual["nome"].ToString() + "_" + duplaAtual["nomedupla"].ToString(); document.Info.Subject = "Relatório da partida."; Style style = document.Styles["Normal"]; style.Font.Name = "Helvetica"; Section section = document.AddSection(); Paragraph paragraph = new Paragraph(); paragraph.Format.Alignment = ParagraphAlignment.Center; paragraph.AddText("Página "); paragraph.AddPageField(); paragraph.AddText(" de "); paragraph.AddNumPagesField(); section.Headers.Primary.Add(paragraph); Paragraph title = section.AddParagraph(); title.Format.Alignment = ParagraphAlignment.Center; title.AddFormattedText(eventoAtual["nome"].ToString(), TextFormat.Bold); section.AddParagraph(); title = section.AddParagraph(); title.Format.Alignment = ParagraphAlignment.Center; title.AddFormattedText("Data: ", TextFormat.Bold); title.AddText(DateTime.Now.ToString("dd/MM/yyyy")); title.AddFormattedText("\t\tHora: ", TextFormat.Bold); title.AddText(DateTime.Now.ToString("HH:mm:ss")); title.AddFormattedText("\t\tCategoria: ", TextFormat.Bold); title.AddText(categoriaAtual["nome"].ToString()); section.AddParagraph(); #region tabela de cabeçalho //Tabela de Cabeçalho Table t = section.AddTable(); t.Style = "Normal"; t.Borders.Width = 0.25; t.Format.Font.Size = 10; t.Rows.Height = 14; t.AddColumn("4cm").Format.Alignment = ParagraphAlignment.Center; t.AddColumn("4cm").Format.Alignment = ParagraphAlignment.Center; t.AddColumn("4cm").Format.Alignment = ParagraphAlignment.Center; t.AddColumn("4cm").Format.Alignment = ParagraphAlignment.Center; Row r1 = t.AddRow(); r1.VerticalAlignment = VerticalAlignment.Center; r1.Cells[0].Format.Font.Color = Colors.Red; r1.Cells[0].AddParagraph("In: " + atleta1["apelido"].ToString()); r1.Cells[1].AddParagraph("Out: " + atleta2["apelido"].ToString()); r1.Cells[2].MergeRight = 1; r1.Cells[2].AddParagraph().AddFormattedText("Pontuação Total: " + string.Format("{0:0.00}", pontuacao)); Row r2 = t.AddRow(); r2.Cells[0].AddParagraph("Tempo de Jogo: " + label2.Text); r2.Cells[0].MergeRight = 1; r2.Cells[2].AddParagraph("Equilíbrio: " + string.Format("{0:0.00}", equilibrio)); r2.Cells[3].AddParagraph("Pontos: " + string.Format("{0:0.00}", equilibrio)); Row r3 = t.AddRow(); r3.Cells[0].Format.Font.Color = Colors.Red; r3.Cells[0].AddParagraph("Ataques In: " + ataquesAtleta1); r3.Cells[1].AddParagraph("Ataques Out: " + ataquesAtleta2); r3.Cells[2].AddParagraph("Total de Ataques: " + ataquesTotal); r3.Cells[3].AddParagraph("Pontos: " + string.Format("{0:0.00}", pontosAtaques)); Row r4 = t.AddRow(); r4.Cells[0].Format.Font.Color = Colors.Red; r4.Cells[0].AddParagraph("Potência In: " + string.Format("{0:0.00}", potenciaAtleta1)); r4.Cells[1].AddParagraph("Potência Out: " + string.Format("{0:0.00}", potenciaAtleta2)); r4.Cells[2].AddParagraph("Potência Média: " + string.Format("{0:0.00}", potenciaTotalMedia)); r4.Cells[3].AddParagraph("Pontos: " + string.Format("{0:0.00}", pontosPotencia)); Row r5 = t.AddRow(); r5.Cells[0].Format.Font.Color = Colors.Red; r5.Cells[0].AddParagraph("Nota Juiz In: " + notaJuizAtleta1); r5.Cells[1].AddParagraph("Nota Juiz Out: " + notaJuizAtleta2); r5.Cells[2].AddParagraph("Nota Juiz Total: " + (notaJuizAtleta1 + notaJuizAtleta2)); r5.Cells[3].AddParagraph("Pontos: " + (notaJuizAtleta1 + notaJuizAtleta2)); Row r6 = t.AddRow(); r6.Cells[1].MergeRight = 1; r6.Cells[1].AddParagraph("Número de Sequências: " + sequencias); r6.Cells[3].AddParagraph("Pontos: " + pontosSequencias); section.AddParagraph(); section.AddParagraph(); #endregion #region tabela de registros //Tabela de registros t = section.AddTable(); t.Style = "Normal"; t.Format.Font.Size = 10; t.Rows.Height = 14; t.AddColumn("5.33cm").Format.Alignment = ParagraphAlignment.Center; t.AddColumn("5.33cm").Format.Alignment = ParagraphAlignment.Center; t.AddColumn("5.33cm").Format.Alignment = ParagraphAlignment.Center; Row r = t.AddRow(); Table t1 = r.Cells[0].AddTextFrame().AddTable(); Table t2 = r.Cells[1].AddTextFrame().AddTable(); Table t3 = r.Cells[2].AddTextFrame().AddTable(); Table[] tables = new Table[3] { t1, t2, t3 }; foreach (Table tab in tables) { tab.Borders.Width = 0.25; tab.AddColumn("1.77cm").Format.Alignment = ParagraphAlignment.Center; tab.AddColumn("1.77cm").Format.Alignment = ParagraphAlignment.Center; tab.AddColumn("1.77cm").Format.Alignment = ParagraphAlignment.Center; r = tab.AddRow(); r.VerticalAlignment = VerticalAlignment.Center; r.Cells[0].AddParagraph("Tempo"); r.Cells[1].AddParagraph("In/Out"); r.Cells[2].AddParagraph("Km/h"); } int start = 0; int i = 0; int pagelimit = 44; int numberofpages = 0; bool newpage = false; foreach (SpeedRecord s in registrosRadar) { if (i != 0 && i % pagelimit == 0) { start++; newpage = true; } if (start != 0 && start % 3 == 0 && newpage == true) { numberofpages++; pagelimit = 55; i = (pagelimit * numberofpages); newpage = false; section.AddPageBreak(); t = section.AddTable(); t.Style = "Normal"; t.Format.Font.Size = 10; t.Rows.Height = 14; t.AddColumn("5.33cm").Format.Alignment = ParagraphAlignment.Center; t.AddColumn("5.33cm").Format.Alignment = ParagraphAlignment.Center; t.AddColumn("5.33cm").Format.Alignment = ParagraphAlignment.Center; r = t.AddRow(); t1 = r.Cells[0].AddTextFrame().AddTable(); t2 = r.Cells[1].AddTextFrame().AddTable(); t3 = r.Cells[2].AddTextFrame().AddTable(); tables[0] = t1; tables[1] = t2; tables[2] = t3; foreach (Table tab in tables) { tab.Borders.Width = 0.25; tab.AddColumn("1.77cm").Format.Alignment = ParagraphAlignment.Center; tab.AddColumn("1.77cm").Format.Alignment = ParagraphAlignment.Center; tab.AddColumn("1.77cm").Format.Alignment = ParagraphAlignment.Center; r = tab.AddRow(); r.VerticalAlignment = VerticalAlignment.Center; r.Cells[0].AddParagraph("Tempo"); r.Cells[1].AddParagraph("In/Out"); r.Cells[2].AddParagraph("Km/h"); } } Row x = tables[start % 3].AddRow(); if (s.IdEvento == -1) { x.Cells[0].AddParagraph("---"); x.Cells[1].AddParagraph("---"); x.Cells[2].AddParagraph("---"); } else { if (s.Direcao == 0) { x.Cells[0].Format.Font.Color = Colors.Red; x.Cells[1].Format.Font.Color = Colors.Red; x.Cells[2].Format.Font.Color = Colors.Red; x.Cells[1].AddParagraph("In"); } else { x.Cells[1].AddParagraph("Out"); } x.Cells[0].AddParagraph(new DateTime(s.Ticks).ToString("mm:ss.ff")); x.Cells[2].AddParagraph(s.Velocidade.ToString()); } i++; } #endregion //table.SetEdge(0, 0, 6, 2, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 0.75, MigraDoc.DocumentObjectModel.Color.Empty); PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); string fileName = "relatorios\\" + document.Info.Title + ".pdf"; System.IO.Directory.CreateDirectory("relatorios"); pdfRenderer.PdfDocument.Save(fileName); Process.Start(fileName); }
/// <summary> /// This will write static details in the tabular form /// </summary> /// <param name="section">content will be written in this section</param> public static void WriteItineraryLastStaticDetails(Section section, string tourIncContent, string tourNotesContent) { Table table = null; Column column = null; int columnCount = 0; double columnWidth = 0; Row row = null; int rowsCount = 0; Cell cell = null; Paragraph paragraph = null; table = section.AddTable(); table.Format.SpaceBefore = 5; table.Borders.Visible = false; table.Borders.Width = 0.75; table.Borders.Color = Colors.Transparent; columnCount = 1; columnWidth = (21.0 - 2.0) / columnCount; column = table.AddColumn(Unit.FromCentimeter(columnWidth)); column.Format.Alignment = ParagraphAlignment.Left; /* Print Notes */ if (tourNotesContent != null) { if (!tourNotesContent.Equals("")) { row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentListingBullets(cell, "Note:", tourNotesContent); } } /* Print Inclusions */ if (tourIncContent != null) { if (!tourIncContent.Equals("")) { row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentListingBullets(cell, "The tour cost includes:", tourIncContent); } } /* Print Important facts */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentListingBullets(cell, "Important Facts for Traveler’s:", itenaryImportantFacts); /* Print Payment policy */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentListingNumbers(cell, "Payment Policy:", itenaryPaymentPolicy); /* Print Bank Details */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; paragraph = cell.AddParagraph(); paragraph.AddFormattedText("OUR BANK DETAILS\n\n" + bankDetails, "Heading3"); paragraph.AddText("\n\nNOTE: After depositing the payment, please mail the Deposit details with the Invoice Number at [email protected] and [email protected] "); /* Print Amendment Rules */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentParagraph(cell, "Amendment Rules:", "Heading3", amendmentRules); /* Print Refund Rules */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentParagraph(cell, "Refund Rules:", "Heading3", refundRules); /* Print Cancellation info */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentParagraph(cell, "Cancellation:", cancellation); /* Print Cancellation Policy */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentParagraph(cell, "Cancellation Policy:", "Heading3", cancellationPolicy); paragraph = cell.AddParagraph(); paragraph.AddFormattedText("Please Note:", "Heading3"); paragraph.AddText(cancellationNote); WriteHdrContentListingNumbers(cell, "", cancellationPoints); /* Print Child policy */ row = table.AddRow(); rowsCount++; cell = row.Cells[0]; WriteHdrContentListingBullets(cell, "Child Policy:", childPolicy); paragraph = cell.AddParagraph(); paragraph.AddFormattedText("NOTE: Hotels are very strict with the child policy. Please carry the age proof so that it can be produced when asked for."); table.SetEdge(0, 0, columnCount, rowsCount, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 1.5, Colors.Transparent); }
void CreateDF(int nr) { Table table = document.LastSection.AddTable(); // int[, ,] lewy = InfoBridge.wylicz_DF(game.rozklady); for (int i = 0; i < 13; i++) { table.AddColumn(Unit.FromCentimeter(1.29)); } for (int i = 0; i < 3; i++) { table.AddRow(); } table[1, 0].AddParagraph("N"); table[2, 0].AddParagraph("S"); table[1, 7].AddParagraph("E"); table[2, 7].AddParagraph("W"); for (int i = 2; i < 6; i++) { Paragraph p = new Paragraph(); p.AddFormattedText(suits[6 - i].ToString(), znaki_kart[6 - i]); table[0, i].Add(p); table[1, i].AddParagraph(lewy[nr, 0, 5 - i].ToString()); table[2, i].AddParagraph(lewy[nr, 1, 5 - i].ToString()); } table[0, 1].AddParagraph("NT"); table[1, 1].AddParagraph(lewy[nr, 0, 4].ToString()); table[2, 1].AddParagraph(lewy[nr, 1, 4].ToString()); for (int i = 9; i < 13; i++) { Paragraph p = new Paragraph(); p.AddFormattedText(suits[13 - i].ToString(), znaki_kart[13 - i]); table[0, i].Add(p); table[1, i].AddParagraph(lewy[nr, 2, 12 - i].ToString()); table[2, i].AddParagraph(lewy[nr, 3, 12 - i].ToString()); } table[0, 8].AddParagraph("NT"); table[1, 8].AddParagraph(lewy[nr, 2, 4].ToString()); table[2, 8].AddParagraph(lewy[nr, 3, 4].ToString()); Row row = table.Rows[0]; row.Borders.Bottom.Width = 1.0; Column col = table.Columns[0]; col.Borders.Right.Width = 1.0; row.Borders.Right.Width = 0; table[0, 0].Borders.Right.Width = 1.0; table[0, 6].Borders.Bottom.Width = 0; col = table.Columns[7]; col.Borders.Right.Width = 1.0; table[0, 7].Borders.Right.Width = 1.0; table.Format.Alignment = ParagraphAlignment.Center; table.Rows.VerticalAlignment = VerticalAlignment.Center; table.Rows.Height = Unit.FromCentimeter(0.7); }
/// <summary> /// Creates the static parts of the invoice. /// </summary> void CreatePage() { // Each MigraDoc document needs at least one section. Section section = this.document.AddSection(); section.PageSetup.Orientation = Orientation.Landscape; // Put a logo in the header Image image = section.Headers.Primary.AddImage(header.LogoFile); image.Height = "2.5cm"; image.LockAspectRatio = true; image.RelativeVertical = RelativeVertical.Line; image.RelativeHorizontal = RelativeHorizontal.Margin; image.Top = ShapePosition.Top; image.Left = ShapePosition.Right; image.WrapFormat.Style = WrapStyle.Through; // Create footer Paragraph paragraph = section.Footers.Primary.AddParagraph(); paragraph.AddText(header.SupplierFullName); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center; // Create the text frame for the address this.addressFrame = section.AddTextFrame(); this.addressFrame.Height = "3.0cm"; this.addressFrame.Width = "7.0cm"; this.addressFrame.Left = ShapePosition.Right; this.addressFrame.RelativeHorizontal = RelativeHorizontal.Margin; this.addressFrame.Top = "5.0cm"; this.addressFrame.RelativeVertical = RelativeVertical.Page; // Put sender in address frame paragraph = this.addressFrame.AddParagraph(header.SupplierName); paragraph.Format.Font.Name = "Times New Roman"; paragraph.Format.Font.Size = 7; paragraph.Format.SpaceAfter = 3; paragraph = ApplyParagraphProperties(paragraph, header.SupplierNameProperties); // Add the print date field paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "8cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText($"{header.DocumentType} {generatorDocument.DocumentNumber}", TextFormat.Bold); paragraph.AddTab(); paragraph.AddText($"Taxpoint: {generatorDocument.DocumentDate}"); // paragraph.AddDateField("dd.MM.yyyy"); // Create the item table this.table = section.AddTable(); this.table.Style = "Table"; this.table.Borders.Color = TableBorder; this.table.Borders.Width = 0.25; this.table.Borders.Left.Width = 0.5; this.table.Borders.Right.Width = 0.5; this.table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns Column column = this.table.AddColumn("1cm"); // Line column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn("6cm"); // Description column.Format.Alignment = ParagraphAlignment.Left; column = this.table.AddColumn("1cm"); // Quantity column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn("2cm"); // Unit Price column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn("1cm"); // Discount (%) column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn("1cm"); // Taxable column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn("4cm"); // Extended Price column.Format.Alignment = ParagraphAlignment.Right; var row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; row.Shading.Color = TableBlue; row.Cells[0].AddParagraph(""); row.Cells[0].Format.Alignment = ParagraphAlignment.Left; row.Cells[1].AddParagraph("Description"); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].AddParagraph("Qty"); row.Cells[2].Format.Alignment = ParagraphAlignment.Left; var s = $"Unit\nPrice"; row.Cells[3].AddParagraph(s); row.Cells[3].Format.Alignment = ParagraphAlignment.Right; row.Cells[4].AddParagraph("Disc (%)"); row.Cells[4].Format.Alignment = ParagraphAlignment.Left; row.Cells[5].AddParagraph("Tax"); row.Cells[5].Format.Alignment = ParagraphAlignment.Left; row.Cells[6].AddParagraph("Line Value"); row.Cells[6].Format.Alignment = ParagraphAlignment.Left; this.table.SetEdge(0, 0, 6, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); }
public Document CreateTreningDOC() { Section section = document.AddSection(); PageSettings(section); Paragraph p = section.AddParagraph(); MakeTable11(); if (Ustawienia.deepfin) { lewy = InfoBridge.wylicz_DF(game.rozklady); } for (int i = 1; i < Ustawienia.ilosc_rozdan + 1; i++) { // if (i != 0) document.AddSection(); CreateBoard(i - 1, game.rozklady[i]); Paragraph pbreak = document.LastSection.AddParagraph(); pbreak.AddLineBreak(); pbreak.AddLineBreak(); pbreak.AddFormattedText("Liczba lew do wzięcia : ", font_normal); pbreak.AddLineBreak(); pbreak.AddLineBreak(); if (Ustawienia.deepfin) { CreateDF(i); } CreateBidding(i - 1); // WriteLineKontrakt(game.ContractList[i], vugraph.Vu_ContractList_Open[i], vugraph.Vu_ContractList_Closed[i]); WriteCommentTitle(); } MigraDoc.DocumentObjectModel.Shapes.Image reklama = new MigraDoc.DocumentObjectModel.Shapes.Image("images\\reklama.png"); reklama.Height = Unit.FromCentimeter(8.0); reklama.Width = Unit.FromCentimeter(12.0); reklama.WrapFormat.DistanceTop = Unit.FromCentimeter(1.0); reklama.WrapFormat.DistanceLeft = Unit.FromCentimeter(2.0); document.LastSection.Add(reklama); document.UseCmykColor = true; document.Info.Author = "Maciej Bielawski"; string ddl = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(document); /* * RtfDocumentRenderer renderer = new RtfDocumentRenderer(); * renderer.Render(document,"Test.doc", null); * * Process.Start("Test.doc");*/ return(document); }
void CreatePage() { // Each MigraDoc document needs at least one section. Section section = this.document.AddSection(); // Put a logo in the header byte[] imagea = LoadImage("prototype2.Resources.odclogo.png"); string imageFilename = MigraDocFilenameFromByteArray(imagea); Image image = section.Headers.Primary.AddImage(imageFilename); image.Height = "1cm"; image.LockAspectRatio = true; image.Top = ShapePosition.Center; image.Left = ShapePosition.Center; image.WrapFormat.Style = WrapStyle.TopBottom; Paragraph paragraph = section.Headers.Primary.AddParagraph("Suite 3A Amparo Garden Corperate Bldg., No. 2116 Amparo cor Felix St. Sta Ana, Manila, 1009 Philippines"); paragraph.AddLineBreak(); paragraph.AddText("Tel No: 742 - 4199 | 566 - 3153 | email: [email protected]"); paragraph.Format.Alignment = ParagraphAlignment.Center; // Create footer Paragraph paragraphFooter = section.Footers.Primary.AddParagraph(); paragraphFooter.AddText("Suite 3A Amparo Garden Corperate Bldg., No. 2116 Amparo cor Felix St. Sta Ana, Manila"); paragraphFooter.AddLineBreak(); paragraphFooter.AddText(" Tel No: 742 - 4199 | 566 - 3153 | email: [email protected]"); paragraphFooter.Format.Font.Size = 9; paragraphFooter.Format.Alignment = ParagraphAlignment.Center; headerName = section.AddParagraph(); headerName.Format.SpaceBefore = "1.0cm"; headerName.AddFormattedText("SALES INVOICE"); headerName.Format.Font.Name = "Calibri"; headerName.Format.Font.Bold = true; headerName.Format.Font.Size = 15; headerName.Format.SpaceAfter = "1.0cm"; headerName.Format.Alignment = ParagraphAlignment.Left; this.table = section.AddTable(); this.table.Style = "Table"; this.table.Borders.Color = TableBorder; this.table.Borders.Width = 0; table.Rows.Alignment = RowAlignment.Right; Column column = table.AddColumn("5cm"); Row row = table.AddRow(); row.Cells[0].AddParagraph("No.: " + MainVM.SalesInvoice.Count + 1); DateTime dateToday = new DateTime(); dateToday = DateTime.Now; row = table.AddRow(); row.Cells[0].AddParagraph("Date Issued:"); row.Cells[0].AddParagraph(dateToday.ToLongDateString()); date = section.AddParagraph(); customerName = section.AddParagraph(); addressFrame = section.AddParagraph(); tinNumber = section.AddParagraph(); terms = section.AddParagraph(); busStyle = section.AddParagraph(); signature = section.AddParagraph(); this.paragraph1 = section.AddParagraph(); customerName.AddFormattedText(MainVM.SelectedCustomerSupplier.CompanyName); customerName.Format.Font.Name = "Calibri"; customerName.Format.Font.Size = 11; customerName.Format.Font.Bold = true; addressFrame.AddFormattedText("Address:" + "\t" + MainVM.SelectedCustomerSupplier.CompanyAddress + "," + "\t" + MainVM.SelectedCustomerSupplier.CompanyCity + "," + "\t" + MainVM.SelectedCustomerSupplier.CompanyProvinceID); addressFrame.Format.Font.Name = "Calibri"; addressFrame.Format.Font.Size = 11; //date.AddText("DATE ISSSUED: "); //date.Format.Font.Name = "Calibri"; //date.Format.Font.Size = 11; //date.AddText(MainVM.SelectedSalesInvoice.dateOfIssue_.ToShortDateString()); //date.Format.Font.Name = "Calibri"; //date.Format.Font.Size = 11; //date.Format.Font.Bold = true; tinNumber.AddText("TIN: "); tinNumber.Format.Font.Name = "Calibri"; tinNumber.Format.Font.Size = 11; tinNumber.AddFormattedText(MainVM.SelectedSalesInvoice.tin_); tinNumber.Format.Font.Name = "Calibri"; tinNumber.Format.Font.Size = 11; tinNumber.Format.Font.Bold = true; terms.AddText("TERMS: "); terms.Format.Font.Name = "Calibri"; terms.Format.Font.Size = 11; terms.AddFormattedText(MainVM.SelectedSalesInvoice.terms_.ToString() + " Days"); terms.Format.Font.Name = "Calibri"; terms.Format.Font.Size = 11; terms.Format.Font.Bold = true; busStyle.AddText("BUS STYLE: "); busStyle.AddFormattedText(MainVM.SelectedSalesInvoice.busStyle_); busStyle.Format.Font.Name = "Calibri"; busStyle.Format.Font.Size = 11; busStyle.Format.Font.Bold = true; busStyle.Format.SpaceAfter = "1.0cm"; //signature.AddFormattedText("SIGNATURE: "); //signature.Format.Font.Name = "Calibri"; //signature.Format.Font.Size = 11; //signature.Format.SpaceAfter = "1.0cm"; // Create the item table this.table = section.AddTable(); this.table.Style = "Table"; this.table.Borders.Color = TableBorder; this.table.Borders.Width = 0.25; this.table.Borders.Left.Width = 0.5; this.table.Borders.Right.Width = 0.5; this.table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; // Create the header of the table row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; row.Shading.Color = TableBlue; row.Cells[0].AddParagraph("Line"); row.Cells[0].AddParagraph("No."); row.Cells[0].Format.Font.Bold = true; row.Cells[0].Format.Alignment = ParagraphAlignment.Left; row.Cells[0].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Bottom; row.Cells[1].AddParagraph("Item"); row.Cells[1].AddParagraph("Name"); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].AddParagraph("Description"); row.Cells[2].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Bottom; row.Cells[3].AddParagraph("Unit"); row.Cells[3].Format.Alignment = ParagraphAlignment.Left; row.Cells[3].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Bottom; row.Cells[4].AddParagraph("Qty"); row.Cells[4].Format.Alignment = ParagraphAlignment.Left; row.Cells[4].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Bottom; row.Cells[5].AddParagraph("Unit Price"); row.Cells[5].Format.Alignment = ParagraphAlignment.Left; row.Cells[5].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Bottom; row.Cells[6].AddParagraph("Total Amount"); row.Cells[6].Format.Alignment = ParagraphAlignment.Left; row.Cells[6].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Bottom; decimal totalPrice = 0; foreach (InvoiceItem item in MainVM.InvoiceItems) { row = table.AddRow(); row.Cells[0].AddParagraph(item.lineNo); row.Cells[1].AddParagraph(item.itemName); row.Cells[2].AddParagraph(item.desc); row.Cells[3].AddParagraph("na"); row.Cells[4].AddParagraph(item.qty.ToString()); row.Cells[5].AddParagraph(item.unitPrice.ToString()); row.Cells[6].AddParagraph(item.totalAmount.ToString()); totalPrice += item.totalAmount; } // this.table.SetEdge(0, 0, 2, 1, Edge.Box, BorderStyle.None, 0.25, Color.Empty); var filler = section.AddParagraph(); filler.AddLineBreak(); // Create the item table this.table = section.AddTable(); this.table.Style = "Table"; this.table.Borders.Color = TableBorder; this.table.Borders.Width = 0.25; this.table.Borders.Left.Width = 0.5; this.table.Borders.Right.Width = 0.5; this.table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; //non tabular invoice Paragraph inv = section.AddParagraph(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddLineBreak(); inv.AddText("Total Sale VAT Inclusive" + "\t\t" + " : " + "\t"); inv.AddText(MainVM.TotalSales.ToString()); inv.AddLineBreak(); inv.AddText("Less Vat" + "\t\t\t\t" + " : " + "\t"); inv.AddText(MainVM.VatAmount.ToString()); inv.AddLineBreak(); inv.AddText("Total" + "\t\t\t\t\t" + " : " + "\t"); inv.AddText(MainVM.TotalSalesNoVat.ToString()); inv.AddLineBreak(); inv.AddText("Vatable Sales" + "\t\t\t\t" + " : " + "\t"); inv.AddText(MainVM.VatableSale.ToString()); inv.AddLineBreak(); inv.AddText("Less: SC/PWD Discount" + "\t\t" + " : " + "\t"); inv.AddLineBreak(); inv.AddText("Zero - Rated Sales" + "\t\t\t" + " : " + "\t"); inv.AddLineBreak(); inv.AddText("Less: Withholding tax" + "\t\t" + " : " + "\t"); inv.AddLineBreak(); inv.AddText("VAT Amount" + "\t\t\t\t" + " : " + "\t"); inv.AddText(MainVM.VatAmount.ToString()); inv.AddLineBreak(); inv.AddText("Add: VAT" + "\t\t\t\t" + " : " + "\t"); inv.AddText(MainVM.VatAmount.ToString()); inv.Format.Font.Bold = true; inv.Format.Font.Size = 12; // tabular SI // Create the header of the table /* * row = table.AddRow(); * row.Cells[0].AddParagraph(""); * row.Cells[0].AddParagraph(""); * row.Cells[1].AddParagraph("Total Sale VAT Inclusive"); * row.Cells[1].AddParagraph(MainVM.TotalSales_.ToString()); * * row = table.AddRow(); * row.Cells[0].AddParagraph(""); * row.Cells[0].AddParagraph(""); * row.Cells[1].AddParagraph("Less: VAT"); * row.Cells[1].AddParagraph(MainVM.VatAmount_.ToString()); * * row = table.AddRow(); * row.Cells[0].AddParagraph(""); * row.Cells[0].AddParagraph(""); * row.Cells[1].AddParagraph("TOTAl "); * row.Cells[1].AddParagraph(MainVM.TotalSalesNoVat_.ToString()); * * row = table.AddRow(); * row.Cells[0].AddParagraph("Vatable Sales"); * row.Cells[0].AddParagraph(MainVM.VatableSale.ToString()); * row.Cells[1].AddParagraph("Less: SC/PWD Discount: "); * row.Cells[1].AddParagraph(""); * * row = table.AddRow(); * row.Cells[0].AddParagraph("Zero - Rated Sales"); * row.Cells[0].AddParagraph(); * row.Cells[1].AddParagraph("Less: Withholding Tax"); * row.Cells[1].AddParagraph(""); * * row = table.AddRow(); * row.Cells[0].AddParagraph("VAT Amount"); * row.Cells[0].AddParagraph(MainVM.VatAmount.ToString()); * row.Cells[1].AddParagraph("Add: VAT"); * row.Cells[1].AddParagraph(MainVM.VatAmount.ToString()); * * row = table.AddRow(); * row.Cells[0].AddParagraph("TOTAL SALES"); * row.Cells[0].AddParagraph(MainVM.TotalSales.ToString()); * row.Cells[1].AddParagraph("AMOUNT DUE"); * row.Cells[1].AddParagraph(MainVM.TotalDue.ToString()); * * this.table.SetEdge(0, 0, 2, 1, Edge.Box, BorderStyle.Single, 0.25, Color.Empty); */ this.paragraph2 = section.AddParagraph(); paragraph2.Format.Alignment = ParagraphAlignment.Right; paragraph2.AddLineBreak(); paragraph2.AddLineBreak(); paragraph2.AddLineBreak(); paragraph2.AddLineBreak(); paragraph2.AddFormattedText("_________________________________", TextFormat.Bold); paragraph2.AddLineBreak(); paragraph2.AddFormattedText("Authorized Representative", TextFormat.Italic); }
private void SetInfo(Order order, ref Section section) { TextFrame frame1 = section.AddTextFrame(); frame1.RelativeVertical = RelativeVertical.Page; frame1.Left = ShapePosition.Right; frame1.Top = new Unit(1.85, UnitType.Centimeter); frame1.Width = new Unit(10, UnitType.Centimeter); Paragraph p = frame1.AddParagraph(); p.Format.Font.Size = 16; p.Format.Alignment = ParagraphAlignment.Right; p.AddFormattedText("Order #" + order.Id, TextFormat.Bold); frame1 = section.AddTextFrame(); TextFrame frame2 = section.AddTextFrame(); if (!String.IsNullOrWhiteSpace(_ecommerceSettings.ReportLogoImage) && !_ecommerceSettings.ReportLogoImage.Contains("http")) { string logoUrl = _getLogoUrl.Get(); if (!String.IsNullOrWhiteSpace(logoUrl)) { MigraDoc.DocumentObjectModel.Shapes.Image logo = section.AddImage(logoUrl); logo.RelativeVertical = RelativeVertical.Page; logo.Left = ShapePosition.Left; logo.Top = new Unit(1.85, UnitType.Centimeter); logo.Height = new Unit(1.5, UnitType.Centimeter); frame1.MarginTop = new Unit(0.5, UnitType.Centimeter); frame2.MarginTop = new Unit(0.5, UnitType.Centimeter); } } frame1.RelativeVertical = RelativeVertical.Page; frame1.Left = ShapePosition.Left; frame1.Top = new Unit(3.5, UnitType.Centimeter); frame1.Width = new Unit(10, UnitType.Centimeter); frame2.RelativeVertical = RelativeVertical.Page; frame2.Left = ShapePosition.Right; frame2.Top = new Unit(3.5, UnitType.Centimeter); frame2.Width = new Unit(8, UnitType.Centimeter); //BILLING AND SHIPPING p = frame1.AddParagraph(); p.AddFormattedText("Bill to:", TextFormat.Bold); p = frame2.AddParagraph(); p.AddFormattedText("Ship to:", TextFormat.Bold); p = frame1.AddParagraph(); p.AddText(order.BillingAddress.Name); if (!string.IsNullOrEmpty(order.BillingAddress.Company)) { p = frame1.AddParagraph(); p.AddText(order.BillingAddress.Company); } if (order.ShippingAddress != null) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.Name); if (!string.IsNullOrEmpty(order.ShippingAddress.Company)) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.Company); } } if (!string.IsNullOrWhiteSpace(order.BillingAddress?.PhoneNumber)) { p = frame1.AddParagraph(); p.AddText(order.BillingAddress.PhoneNumber); } if (!string.IsNullOrWhiteSpace(order.ShippingAddress?.PhoneNumber)) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.PhoneNumber); } p = frame1.AddParagraph(); p.AddText(order.BillingAddress.Address1); if (order.ShippingAddress != null) { if (!string.IsNullOrWhiteSpace(order.ShippingAddress.Address1)) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.Address1); } } if (!string.IsNullOrWhiteSpace(order.BillingAddress.Address2)) { p = frame1.AddParagraph(); p.AddText(order.BillingAddress.Address2); } if (order.ShippingAddress != null) { if (!string.IsNullOrWhiteSpace(order.ShippingAddress.Address2)) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.Address2); } } if (!string.IsNullOrWhiteSpace(order.BillingAddress.City)) { p = frame1.AddParagraph(); p.AddText(order.BillingAddress.City); } if (order.ShippingAddress != null) { if (!string.IsNullOrWhiteSpace(order.ShippingAddress.City)) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.City); } } if (!string.IsNullOrWhiteSpace(order.BillingAddress.StateProvince)) { p = frame1.AddParagraph(); p.AddText(order.BillingAddress.StateProvince); } if (order.ShippingAddress != null) { if (!string.IsNullOrWhiteSpace(order.ShippingAddress.StateProvince)) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.StateProvince); } } string billingCountryName = order.BillingAddress.GetCountryName(); if (!string.IsNullOrWhiteSpace(billingCountryName)) { p = frame1.AddParagraph(); p.AddText(billingCountryName); } if (order.ShippingAddress != null) { string shippingCountryName = order.ShippingAddress.GetCountryName(); if (!string.IsNullOrWhiteSpace(shippingCountryName)) { p = frame2.AddParagraph(); p.AddText(shippingCountryName); } } if (!string.IsNullOrWhiteSpace(order.BillingAddress.PostalCode)) { p = frame1.AddParagraph(); p.AddText(order.BillingAddress.PostalCode); } if (order.ShippingAddress != null) { if (!string.IsNullOrWhiteSpace(order.ShippingAddress.PostalCode)) { p = frame2.AddParagraph(); p.AddText(order.ShippingAddress.PostalCode); } } frame1.AddParagraph("").AddLineBreak(); frame2.AddParagraph("").AddLineBreak(); //PAYMENT AND SHIPPING METHODS p = frame1.AddParagraph(); p.AddText(string.Format("Payment method: {0}", order.PaymentMethod.BreakUpString())); p = frame2.AddParagraph(); p.AddText(string.Format("Shipping method: {0}", order.ShippingMethodName)); }
/// <summary> /// This method creates the document layout for this pdf file /// </summary> /// <param name="document">A species information document object holding all the information that should be included in the pdf file</param> /// <returns>A formated pdf document</returns> private Document createPdfDocument(Data.ArtDatabankenService.SpeciesInformationDocument document) { Document pdfFile = new Document(); pdfFile.DefaultPageSetup.TopMargin = Unit.FromCentimeter(1.2); pdfFile.DefaultPageSetup.RightMargin = Unit.FromCentimeter(1.2); pdfFile.DefaultPageSetup.BottomMargin = Unit.FromCentimeter(2.6); pdfFile.DefaultPageSetup.FooterDistance = Unit.FromCentimeter(0.8); pdfFile.DefaultPageSetup.LeftMargin = Unit.FromCentimeter(1.2); pdfFile.DefaultPageSetup.DifferentFirstPageHeaderFooter = true; pdfFile.DefaultPageSetup.OddAndEvenPagesHeaderFooter = true; pdfFile.Info.Title = "Arfaktablad om " + document.Taxon.Label + " [DyntaxaTaxonId: " + document.Taxon.Id.ToString() + "]"; pdfFile.Info.Subject = "Arfaktablad med beskrivning, utbredningsuppgifter, ekologi, hot och naturvårdsåtgärder, litteratur"; pdfFile.Info.Author = document.AuthorAndYear; // Get the predefined style Normal. Style style = pdfFile.Styles["Normal"]; // Because all styles are derived from Normal, the next line changes the // font of the whole document. Or, more exactly, it changes the font of // all styles and paragraphs that do not redefine the font. style.Font.Name = "Arial"; style.Font.Size = Unit.FromPoint(10); //Colors MigraDoc.DocumentObjectModel.Color colorOfRedlistPeriodBox = Color.FromCmyk(35, 25, 25, 5); // light grey MigraDoc.DocumentObjectModel.Color colorOfRedlistCategoryBox = Color.FromCmyk(5, 95, 100, 0); // Red MigraDoc.DocumentObjectModel.Color colorOfFrameLine = Color.FromCmyk(50, 10, 75, 0); // light green MigraDoc.DocumentObjectModel.Color colorOfHeaderTitleText = Color.FromCmyk(80, 60, 70, 80); // dark grey MigraDoc.DocumentObjectModel.Color colorOfHeaderText = Color.FromCmyk(35, 25, 25, 5); // light grey Section section = pdfFile.AddSection(); // Create main frame first TextFrame firstMainFrame = section.Headers.FirstPage.AddTextFrame(); firstMainFrame.RelativeHorizontal = RelativeHorizontal.Margin; firstMainFrame.RelativeVertical = RelativeVertical.Margin; firstMainFrame.Height = "26cm"; firstMainFrame.Width = "18,6cm"; firstMainFrame.LineFormat.Width = 1.5; firstMainFrame.LineFormat.Color = colorOfFrameLine; // End header first // Create header odd TextFrame mainFrame = section.Headers.Primary.AddTextFrame(); mainFrame.RelativeHorizontal = RelativeHorizontal.Margin; mainFrame.RelativeVertical = RelativeVertical.Margin; mainFrame.Height = "26cm"; mainFrame.Width = "18,6cm"; mainFrame.LineFormat.Width = 1.5; mainFrame.LineFormat.Color = colorOfFrameLine; // End header odd // Create header even TextFrame evenMainFrame = section.Headers.EvenPage.AddTextFrame(); evenMainFrame.RelativeHorizontal = RelativeHorizontal.Margin; evenMainFrame.RelativeVertical = RelativeVertical.Margin; evenMainFrame.Height = "26cm"; evenMainFrame.Width = "18,6cm"; evenMainFrame.LineFormat.Width = 1.5; evenMainFrame.LineFormat.Color = colorOfFrameLine; // End header even //Create Line text on first page Paragraph borderLineTextFrameFirstPageText; TextFrame borderLineTextFrameFirstPage; borderLineTextFrameFirstPage = section.AddTextFrame(); borderLineTextFrameFirstPage.MarginTop = -7; borderLineTextFrameFirstPage.MarginLeft = "133mm"; borderLineTextFrameFirstPageText = borderLineTextFrameFirstPage.AddParagraph("ARTFAKTABLAD"); borderLineTextFrameFirstPageText.Format.Font.Color = colorOfFrameLine; borderLineTextFrameFirstPageText.Format.Font.Size = Unit.FromPoint(12); borderLineTextFrameFirstPage.Height = 0; // Header 1 Paragraph commonName; if (document.CommonName.IsNotEmpty()) { //Swedish name with first letter upper case in title commonName = section.AddParagraph(char.ToUpper(document.CommonName[0]) + document.CommonName.Substring(1)); commonName.Format.Font.Color = colorOfHeaderTitleText; } else { commonName = section.AddParagraph("(Svenskt namn saknas)"); commonName.Format.Font.Color = colorOfHeaderText; } commonName.Format.Font.Size = Unit.FromPoint(20); commonName.Format.Alignment = ParagraphAlignment.Left; commonName.Format.LeftIndent = "0.5cm"; commonName.Format.RightIndent = "0.5cm"; commonName.Format.SpaceAfter = "0.2cm"; commonName.Format.SpaceBefore = "1cm"; //Header2 Paragraph scientificName = section.AddParagraph(document.ScientificName); scientificName.Format.Font.Size = Unit.FromPoint(12); scientificName.Format.Font.Color = colorOfHeaderTitleText; scientificName.Format.Font.Italic = true; scientificName.Format.Alignment = ParagraphAlignment.Left; scientificName.Format.LeftIndent = "0.5cm"; scientificName.Format.RightIndent = "0.5cm"; scientificName.Format.SpaceAfter = "1.2cm"; scientificName.Format.SpaceBefore = "0.2cm"; if (document.Taxon.Author.IsNotEmpty()) { scientificName.AddFormattedText(" " + document.Taxon.Author, TextFormat.NotItalic); } //Redlist information Table redlistSpeciesInformation = section.AddTable(); //redlistSpeciesInformation.Format.LeftIndent = "0.5cm"; //redlistSpeciesInformation.Borders.Width = 1.5; //redlistSpeciesInformation.Borders.Color = colorOfFrameLine; Column columnLeft = redlistSpeciesInformation.AddColumn(Unit.FromCentimeter(9.2)); columnLeft.Format.Alignment = ParagraphAlignment.Left; Column columnRight = redlistSpeciesInformation.AddColumn(Unit.FromCentimeter(9.2)); columnRight.Format.Alignment = ParagraphAlignment.Left; Row row = redlistSpeciesInformation.AddRow(); Cell cellTaxonInfo = row.Cells[0]; Cell cellCriteria = row.Cells[1]; List <ParagraphItem> paragraphItems = null; //Taxonomic information cellTaxonInfo = row.Cells[0]; Paragraph taxonomicInformation = cellTaxonInfo.AddParagraph(); taxonomicInformation.Format.Font.Color = colorOfHeaderText; taxonomicInformation.Format.Font.Size = Unit.FromPoint(8); taxonomicInformation.Format.LeftIndent = "0.5cm"; taxonomicInformation.Format.RightIndent = "0.5cm"; taxonomicInformation.Format.SpaceAfter = "0.2cm"; cellTaxonInfo.VerticalAlignment = VerticalAlignment.Bottom; paragraphItems = GetParagraphItems(document.AutomaticTaxonomicParagraph, document.ItalicStringsInText); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { taxonomicInformation.AddFormattedText(item.Text, TextFormat.Italic); taxonomicInformation.AddText(" "); } else { taxonomicInformation.AddText(item.Text); taxonomicInformation.AddText(" "); } } //Redlist Criteria if (document.RedlistCriteria.IsNotEmpty()) { Paragraph redlistCriteriaText = cellCriteria.AddParagraph(document.RedlistCriteria); redlistCriteriaText.Format.Font.Color = colorOfHeaderText; redlistCriteriaText.Format.Font.Size = Unit.FromPoint(8); redlistCriteriaText.Format.LeftIndent = "4cm"; redlistCriteriaText.Format.SpaceAfter = "0.2cm"; redlistCriteriaText.Format.Alignment = ParagraphAlignment.Left; cellCriteria.VerticalAlignment = VerticalAlignment.Bottom; } // Create Image if (_taxonImage.IsNotNull()) { Paragraph taxonParagraph = section.AddParagraph(); taxonParagraph.Format.Alignment = ParagraphAlignment.Left; taxonParagraph.Format.LeftIndent = "0.5cm"; taxonParagraph.Format.RightIndent = "0.5cm"; taxonParagraph.Format.SpaceAfter = "0.2cm"; _taxonImage.Save("taxon.png"); Image taxonImage = taxonParagraph.AddImage("taxon.png"); taxonImage.Height = Unit.FromCentimeter(9); taxonImage.LockAspectRatio = true; taxonImage.WrapFormat.Style = WrapStyle.TopBottom; } // Create Map if (_mapImage.IsNotNull()) { Paragraph mapParagraph = section.AddParagraph(); mapParagraph.Format.Alignment = ParagraphAlignment.Right; mapParagraph.Format.LeftIndent = "0.5cm"; mapParagraph.Format.RightIndent = "0.5cm"; mapParagraph.Format.SpaceAfter = "0.2cm"; _mapImage.Save("map.png"); Image mapImage = mapParagraph.AddImage("map.png"); mapImage.Height = Unit.FromCentimeter(9); mapImage.LockAspectRatio = true; mapImage.WrapFormat.Style = WrapStyle.TopBottom; } //Main document paragraphs Paragraph paragraph; if (_document.DescriptionParagraph.IsNotEmpty()) { paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Format.LeftIndent = "0.5cm"; paragraph.Format.RightIndent = "0.5cm"; paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddFormattedText("Beskrivning".ToUpper(), TextFormat.Bold); paragraph.AddLineBreak(); paragraph.Format.Alignment = ParagraphAlignment.Justify; paragraphItems = GetParagraphItems(document.DescriptionParagraph, document.ItalicStringsInText); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { paragraph.AddFormattedText(item.Text, TextFormat.Italic); } else { paragraph.AddText(item.Text); } } } if (_document.DistributionParagraph.IsNotEmpty()) { paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Format.LeftIndent = "0.5cm"; paragraph.Format.RightIndent = "0.5cm"; paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddFormattedText("Utbredning och status".ToUpper(), TextFormat.Bold); paragraph.AddLineBreak(); paragraphItems = GetParagraphItems(document.DistributionParagraph, document.ItalicStringsInText); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { paragraph.AddFormattedText(item.Text, TextFormat.Italic); } else { paragraph.AddText(item.Text); } } } if (_document.EcologyParagraph.IsNotEmpty()) { paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Format.LeftIndent = "0.5cm"; paragraph.Format.RightIndent = "0.5cm"; paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddFormattedText("Ekologi".ToUpper(), TextFormat.Bold); paragraph.AddLineBreak(); paragraph.Format.Alignment = ParagraphAlignment.Justify; paragraphItems = GetParagraphItems(document.EcologyParagraph, document.ItalicStringsInText); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { paragraph.AddFormattedText(item.Text, TextFormat.Italic); } else { paragraph.AddText(item.Text); } } } if (_document.ThreatsParagraph.IsNotEmpty()) { paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Format.LeftIndent = "0.5cm"; paragraph.Format.RightIndent = "0.5cm"; paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddFormattedText("Hot".ToUpper(), TextFormat.Bold); paragraph.AddLineBreak(); paragraph.Format.Alignment = ParagraphAlignment.Justify; paragraphItems = GetParagraphItems(document.ThreatsParagraph, document.ItalicStringsInText); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { paragraph.AddFormattedText(item.Text, TextFormat.Italic); } else { paragraph.AddText(item.Text); } } } if (_document.MeasuresParagraph.IsNotEmpty()) { paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Format.LeftIndent = "0.5cm"; paragraph.Format.RightIndent = "0.5cm"; paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddFormattedText("Åtgärder".ToUpper(), TextFormat.Bold); paragraph.AddLineBreak(); paragraph.Format.Alignment = ParagraphAlignment.Justify; paragraphItems = GetParagraphItems(document.MeasuresParagraph, document.ItalicStringsInText); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { paragraph.AddFormattedText(item.Text, TextFormat.Italic); } else { paragraph.AddText(item.Text); } } } if (_document.ExtraParagraph.IsNotEmpty()) { paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Format.LeftIndent = "0.5cm"; paragraph.Format.RightIndent = "0.5cm"; paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddFormattedText("Övrigt".ToUpper(), TextFormat.Bold); paragraph.AddLineBreak(); paragraph.Format.Alignment = ParagraphAlignment.Justify; paragraphItems = GetParagraphItems(document.ExtraParagraph, document.ItalicStringsInText); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { paragraph.AddFormattedText(item.Text, TextFormat.Italic); } else { paragraph.AddText(item.Text); } } } //Reference list if (_document.ReferenceParagraph.IsNotEmpty()) { paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Format.LeftIndent = "0.5cm"; paragraph.Format.RightIndent = "0.5cm"; paragraph.Format.Alignment = ParagraphAlignment.Left; paragraph.AddFormattedText("Litteratur".ToUpper(), TextFormat.Bold); paragraph.AddLineBreak(); string[] references = _document.ReferenceParagraph.Split('\n'); foreach (string reference in references) { Paragraph referenceParagraph = section.AddParagraph(); referenceParagraph.Format.LeftIndent = "1cm"; referenceParagraph.Format.FirstLineIndent = "-1cm"; referenceParagraph.Format.Alignment = ParagraphAlignment.Justify; referenceParagraph.Format.Font.Size = Unit.FromPoint(10); paragraphItems = GetParagraphItems(reference, document.ItalicStringsInReferences); foreach (ParagraphItem item in paragraphItems) { if (item.Italic) { referenceParagraph.AddFormattedText(item.Text, TextFormat.Italic); } else { referenceParagraph.AddText(item.Text); } } } } paragraph = section.AddParagraph(LINE); paragraph.Format.SpaceBefore = "4mm"; //Author information Table authorInformationBox = section.AddTable(); //authorInformationBox.Format.SpaceBefore = "5mm"; authorInformationBox.Borders.Width = 0; //authorInformationBox.Borders.Top.Width = Unit.FromPoint(0.25); Column columnAuthor = authorInformationBox.AddColumn(Unit.FromCentimeter(16)); columnAuthor.Format.Alignment = ParagraphAlignment.Justify; row = authorInformationBox.AddRow(); cellTaxonInfo = row.Cells[0]; Paragraph authorParagraph = cellTaxonInfo.AddParagraph(); authorParagraph.AddText(getUpdateInformation()); // Create footer first page IOResources.IOResource.slu_logotyp_web1.Save("slu.png"); Image firstFooterImage = section.Footers.FirstPage.AddImage("slu.png"); firstFooterImage.Height = Unit.FromCentimeter(1.9); firstFooterImage.LockAspectRatio = true; firstFooterImage.RelativeVertical = RelativeVertical.Line; firstFooterImage.RelativeHorizontal = RelativeHorizontal.Margin; firstFooterImage.WrapFormat.Style = WrapStyle.None; Paragraph firstFooterParagraph = section.Footers.FirstPage.AddParagraph(); firstFooterParagraph.AddLineBreak(); firstFooterParagraph.AddText("ArtDatabanken"); firstFooterParagraph.Format.Font.Size = 16; firstFooterParagraph.Format.Font.Bold = true; firstFooterParagraph.Format.Font.Name = "Arial"; firstFooterParagraph.Format.Alignment = ParagraphAlignment.Right; // end footer first page // Create footer Paragraph footerParagraph = section.Footers.Primary.AddParagraph(); footerParagraph.AddText("www.slu.se/artdatabanken"); footerParagraph.Format.Font.Size = 13; footerParagraph.Format.Font.Bold = true; footerParagraph.Format.Alignment = ParagraphAlignment.Center; Paragraph footerPageNo = section.Footers.Primary.AddParagraph(); footerPageNo.AddPageField(); footerPageNo.Format.Font.Color = colorOfFrameLine; footerPageNo.Format.Font.Size = 13; footerPageNo.Format.Alignment = ParagraphAlignment.Right; // end footer // Create even footer Paragraph EvenFooterParagraph = section.Footers.EvenPage.AddParagraph(); EvenFooterParagraph.AddText("www.slu.se/artdatabanken"); EvenFooterParagraph.Format.Font.Size = 13; EvenFooterParagraph.Format.Font.Bold = true; EvenFooterParagraph.Format.Alignment = ParagraphAlignment.Center; Paragraph evenfooterPageNo = section.Footers.EvenPage.AddParagraph(); evenfooterPageNo.AddPageField(); evenfooterPageNo.Format.Font.Color = colorOfFrameLine; evenfooterPageNo.Format.Font.Size = 13; evenfooterPageNo.Format.Alignment = ParagraphAlignment.Left; // end even footer return(pdfFile); }
public leveringScreen() { InitializeComponent(); // Initialiseert bestellijst int x = 0; foreach (voorraadMgmt.stocknAantal data in levVar.checkMinVoorraad()) { int nodig = (int.Parse(data.minVoorraad) - data.aantal) + 1; TextBlock prodNaam = new TextBlock(); prodNaam.Text = data.omschrijving + " (voorraad: " + data.aantal + ")"; prodNaam.Name = "prod" + x; prodNaam.Height = 30; prodNaam.HorizontalAlignment = HorizontalAlignment.Left; prodNaam.VerticalAlignment = VerticalAlignment.Top; prodNaam.Margin = new Thickness(0, 30 * x, 0, 0); TextBox prodAantal = new TextBox(); prodAantal.Text = nodig.ToString(); prodAantal.HorizontalAlignment = HorizontalAlignment.Left; prodAantal.VerticalAlignment = VerticalAlignment.Top; prodAantal.Height = 25; prodAantal.Width = 50; prodAantal.Name = data.eenheid; prodAantal.Tag = data.artikelnr + " " + data.omschrijving; prodAantal.Margin = new Thickness(710, 30 * x, 0, 0); TextBlock prodEenheid = new TextBlock(); prodEenheid.Text = data.eenheid; prodEenheid.Name = "prod" + x; prodEenheid.HorizontalAlignment = HorizontalAlignment.Left; prodEenheid.VerticalAlignment = VerticalAlignment.Top; prodEenheid.Margin = new Thickness(765, 30 * x, 0, 0); BestelGrid.Children.Add(prodNaam); BestelGrid.Children.Add(prodEenheid); BestelGrid.Children.Add(prodAantal); x++; } exportBtn.Click += (s, e) => { List <TextBox> prodAantal = BestelGrid.Children.OfType <TextBox>().ToList(); Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); string date = digitsOnly.Replace(DateTime.Today.ToString("yyyy-MM-dd"), ""); string filename = "bestellijst" + date + ".pdf"; dlg.FileName = filename; // Default file name dlg.DefaultExt = ".pdf"; // Default file extension dlg.Filter = "PDF documents (.pdf)|*.pdf"; // Filter files by extension Nullable <bool> result = dlg.ShowDialog(); if (result == true) { Document document = new Document(); Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); FormattedText ft = paragraph.AddFormattedText("Bestellijst", TextFormat.Bold); ft.Font.Size = 26; section.AddParagraph("Gegenereerd door: " + Login.Login.Gebruiker); section.AddParagraph("Datum: " + DateTime.Now.ToString("dd-MM-yyyy H:m")); section.AddParagraph(""); foreach (TextBox row in prodAantal) { if (row.Text != "" && digitsOnly.Replace(row.Text, "") != "") { section.AddParagraph(row.Tag.ToString() + "\t\t" + row.Text + " " + row.Name); } } PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); try { pdfRenderer.PdfDocument.Save(dlg.FileName); Process.Start(dlg.FileName); } catch { MessageBox.Show("Bestand met deze naam bestaat al,\nen is op dit moment geopend.", "Succesvol", MessageBoxButton.OK, MessageBoxImage.Information); } } }; }
private void addDayToTimesheet(ServiceDayViewModel currentDay, int dayCounter, bool?UkSheet) { //Add the header of the day title //Day number is counter plus 1 int dayNumber = dayCounter + 1; Row row1Title = timesheetTable.AddRow(); row1Title.Cells[0].MergeRight = 1; Paragraph jobDetailsPara = row1Title.Cells[0].AddParagraph(); jobDetailsPara.AddFormattedText("D", "allCapsFirstLetter"); jobDetailsPara.AddFormattedText("AY " + dayNumber, "allCapsNextLetter"); row1Title.Cells[0].Shading.Color = timesheetDayGrey; //Keep the rows together row1Title.KeepWith = 14; //RT 7/9/17 - Adding USA date format if (UkSheet == true) { addLineToTimesheet("Date", currentDay.DtReport.ToString("dd/MM/yyyy")); } else { addLineToTimesheet("Date", currentDay.DtReport.ToString("MM/dd/yyyy")); } addLineToTimesheet("Day", currentDay.DtReport.ToString("dddd")); addLineToTimesheet("Travel start time", currentDay.TravelStartTime.ToShortTimeString()); addLineToTimesheet("Arrival time onsite", currentDay.ArrivalOnsiteTime.ToShortTimeString()); addLineToTimesheet("Departure time from site", currentDay.DepartureSiteTime.ToShortTimeString()); addLineToTimesheet("Travel end time", currentDay.TravelEndTime.ToShortTimeString()); addLineToTimesheet("Mileage", currentDay.Mileage.ToString()); //RT 5/7/16 - Changing the true/false for the allowances to 1 or 0 if (currentDay.DailyAllowance == true) { addLineToTimesheet("Daily allowance", "1"); } else if (currentDay.DailyAllowance == false) { addLineToTimesheet("Daily allowance", "0"); } else { new Exception("Daily allowance incorrect"); } //addLineToTimesheet("Daily allowance", currentDay.DailyAllowance.ToString()); if (currentDay.OvernightAllowance == true) { addLineToTimesheet("Overnight allowance", "1"); } else if (currentDay.OvernightAllowance == false) { addLineToTimesheet("Overnight allowance", "0"); } else { new Exception("Overnight allowance incorrect"); } //addLineToTimesheet("Overnight allowance", currentDay.OvernightAllowance.ToString()); //RT - If there are no barrier payments, then don't include them on the sheet double totalBarrierPayments = currentSheet.TotalBarrierPayments; if (totalBarrierPayments > 0) { //addLineToTimesheet("Barrier payment", currentDay.BarrierPayment.ToString()); if (currentDay.BarrierPayment == true) { addLineToTimesheet("Barrier payment", "1"); } else if (currentDay.BarrierPayment == false) { addLineToTimesheet("Barrier payment", "0"); } else { new Exception("Barrier payment incorrect"); } //MessageBox.Show("Remove barrier payment!"); } else { //Decrease the keepwith by 1 as we are removing a row row1Title.KeepWith = 13; } addLineToTimesheet("Total travel time", currentDay.TotalTravelTime.ToString()); addLineToTimesheet("Total time onsite", currentDay.TotalOnsiteTime.ToString()); addLineToTimesheet("Daily report", currentDay.DailyReport); addLineToTimesheet("Parts supplied today", currentDay.PartsSuppliedToday); }
/// <summary> /// Creates the static parts of the invoice. /// </summary> void CreatePage() { // Each MigraDoc document needs at least one section. Section sectionCoverPage = this.document.AddSection(); Section section = this.document.AddSection(); // Create header CreateHeader(ref sectionCoverPage); // Create footer CreateFooter(ref sectionCoverPage); // Create the text frame for the address this.addressFrame = sectionCoverPage.AddTextFrame(); this.addressFrame.Height = "3.0cm"; this.addressFrame.Width = "11.0cm"; this.addressFrame.Left = ShapePosition.Left; this.addressFrame.RelativeHorizontal = RelativeHorizontal.Margin; this.addressFrame.Top = "5.0cm"; this.addressFrame.RelativeVertical = RelativeVertical.Page; // Put sender in address frame Paragraph paragraph = this.addressFrame.AddParagraph("MAIL TO: "); paragraph.Format.Font.Name = "Arial"; paragraph.Format.Font.Size = 10; paragraph.Format.SpaceAfter = 8; // put a page break after the address page // sectionCoverPage.AddPageBreak(); // Add the print date field paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText("INVOICE", TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Cologne, "); paragraph.AddDateField("dd.MM.yyyy"); // Create the item table this.table = section.AddTable(); this.table.Style = "Table"; //this.table.Borders.Color = TableBorder; this.table.Borders.Width = 0.25; this.table.Borders.Left.Width = 0.5; this.table.Borders.Right.Width = 0.5; this.table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns Column column = this.table.AddColumn("1cm"); column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn("3.5cm"); column.Format.Alignment = ParagraphAlignment.Right; column = this.table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Center; column = this.table.AddColumn("4cm"); column.Format.Alignment = ParagraphAlignment.Right; // Create the header of the table Row row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; //row.Shading.Color = TableBlue; row.Cells[0].AddParagraph("Item"); row.Cells[0].Format.Font.Bold = false; row.Cells[0].Format.Alignment = ParagraphAlignment.Left; row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom; row.Cells[0].MergeDown = 1; row.Cells[1].AddParagraph("Title and Author"); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[1].MergeRight = 3; row.Cells[5].AddParagraph("Extended Price"); row.Cells[5].Format.Alignment = ParagraphAlignment.Left; row.Cells[5].VerticalAlignment = VerticalAlignment.Bottom; row.Cells[5].MergeDown = 1; row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; //row.Shading.Color = TableBlue; row.Cells[1].AddParagraph("Quantity"); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].AddParagraph("Unit Price"); row.Cells[2].Format.Alignment = ParagraphAlignment.Left; row.Cells[3].AddParagraph("Discount (%)"); row.Cells[3].Format.Alignment = ParagraphAlignment.Left; row.Cells[4].AddParagraph("Taxable"); row.Cells[4].Format.Alignment = ParagraphAlignment.Left; //this.table.SetEdge(0, 0, 6, 2, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); }
public void AddClientDetails(Section sec) { Table t = sec.AddTable(); t.LeftPadding = "0mm"; t.RightPadding = "0mm"; t.TopPadding = "0mm"; t.BottomPadding = "0mm"; Column c = t.AddColumn("1mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("29mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("1mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("158mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("1mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; Row r = t.AddRow(); Paragraph p = r.Cells[1].AddParagraph(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p = r.Cells[3].AddParagraph(); // r.Cells[3].Format.Alignment = ParagraphAlignment.Justify; p.AddText("Mr. T is/are insured as operator(s) in respect of the aircraft listed in the schedule of aircraft below for the period as stated hereunder for flights Worldwide, excluding the following countries and regions:"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("(a)"); p.AddTab(); p.AddText("Algeria, Burundi, Cabinda, Central African Republic, Congo, Democratic Republic of Congo, Eritrea, Ethiopia, Ivory Coast, Liberia, Mauritania, Nigeria, Somalia, The Republic of Sudan, South Sudan;"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("(b) "); p.AddTab(); p.AddText("Colombia, Ecuador, Peru;"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("(c)"); p.AddTab(); p.AddText("Afghanistan, Jammu&Kashmir, Myanmar, NorthKorea, Pakistan;"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("(d)"); p.AddTab(); p.AddText("Georgia, Nagorno-Karabakh, North Caucasian Federal District, Ukraine;"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("(e)"); p.AddTab(); p.AddText("Iran, Iraq, Libya, Syria, Yemen;"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("(f)"); p.AddTab(); p.AddText("United States of America and Canada."); p.AddLineBreak(); p.AddLineBreak(); p.AddText("In addition coverage is granted:"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("(i)"); p.AddTab(); p.AddText("for the overflight of any excluded country or region where the flight is within an internationally recognised air corridor and is performed in accordance with I.C.A.O. recommendations; or"); p.AddLineBreak(); p.AddLineBreak(); p.AddText("ii)"); p.AddTab(); p.AddText("in circumstances where an insured Aircraft has landed in an excluded country or region as a direct consequence and exclusively as a result of force majeure."); p.AddLineBreak(); p.AddLineBreak(); p.AddText("Notwithstanding the above,coverage is excluded for any flight into any country or region where such operation of the Aircraft is in breach of United Nations or European Union sanctions."); p.AddLineBreak(); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddFormattedText("RISKS INSURED:", TextFormat.Underline); p = r.Cells[3].AddParagraph(); // r.Cells[3].Format.Alignment = ParagraphAlignment.Justify; p.AddFormattedText("Rotors in Motion and Rotors Not in Motion / Transported – Sections I, II and III", TextFormat.Bold); p.AddLineBreak(); p.AddLineBreak(); p.AddFormattedText("Hull \"All Risks\" Insurance", TextFormat.Bold); p.AddLineBreak(); p.AddLineBreak(); p.AddText("Hull Deductible of Aircraft Value Each and Every Claim including Total Loss, subject to a maximum of GBP 30,000 (or currency equivalent) Each and Every Claim including Total Loss."); p.AddLineBreak(); p.AddLineBreak(); p.AddText("Includes the legal liability and/or as more fully described in the respective policies in respect of bodily injury and/or property damage to third parties including passengers up to the following limits of liability each aircraft."); p.AddText("Combined Single Limit (Third Party/Passenger Legal Liability) any one accident, " + "but unlimited in all during the currency of this policy and " + "including GBP 7, 500, 000 any one accident in respect of Crown Indemnity."); }
/// <summary> /// Creates the dynamic parts of the invoice. /// </summary> void FillContent() { // Fill address in address text frame XPathNavigator item = SelectItem("/invoice/to"); Paragraph paragraph = this.addressFrame.AddParagraph(); paragraph.AddText(GetValue(item, "name/singleName")); paragraph.AddLineBreak(); paragraph.AddText(GetValue(item, "address/line1")); paragraph.AddLineBreak(); paragraph.AddText(GetValue(item, "address/postalCode") + " " + GetValue(item, "address/city")); paragraph.AddLineBreak(); paragraph.AddText(GetValue(item, "address/country")); // Iterate the invoice items double totalExtendedPrice = 0; XPathNodeIterator iter = this.navigator.Select("/invoice/items/*"); while (iter.MoveNext()) { item = iter.Current; double quantity = GetValueAsDouble(item, "quantity"); double price = GetValueAsDouble(item, "price"); double discount = GetValueAsDouble(item, "discount"); // Each item fills two rows Row row1 = this.table.AddRow(); Row row2 = this.table.AddRow(); row1.TopPadding = 1.5; //row1.Cells[0].Shading.Color = TableGray; row1.Cells[0].VerticalAlignment = VerticalAlignment.Center; row1.Cells[0].MergeDown = 1; row1.Cells[1].Format.Alignment = ParagraphAlignment.Left; row1.Cells[1].MergeRight = 3; //row1.Cells[5].Shading.Color = TableGray; row1.Cells[5].MergeDown = 1; row1.Cells[0].AddParagraph(GetValue(item, "itemNumber")); paragraph = row1.Cells[1].AddParagraph(); paragraph.AddFormattedText(GetValue(item, "title"), TextFormat.Bold); paragraph.AddFormattedText(" by ", TextFormat.Italic); paragraph.AddText(GetValue(item, "author")); row2.Cells[1].AddParagraph(GetValue(item, "quantity")); row2.Cells[2].AddParagraph(price.ToString("0.00") + " €"); row2.Cells[3].AddParagraph(discount.ToString("0.0")); row2.Cells[4].AddParagraph(); row2.Cells[5].AddParagraph(price.ToString("0.00")); double extendedPrice = quantity * price; extendedPrice = extendedPrice * (100 - discount) / 100; row1.Cells[5].AddParagraph(extendedPrice.ToString("0.00") + " €"); row1.Cells[5].VerticalAlignment = VerticalAlignment.Bottom; totalExtendedPrice += extendedPrice; // this.table.SetEdge(0, this.table.Rows.Count - 2, 6, 2, Edge.Box, BorderStyle.Single, 0.75); } // Add an invisible row as a space line to the table Row row = this.table.AddRow(); row.Cells[0].MergeRight = 5; // Add an image with line to the cell Image image = row.Cells[0].AddImage(path + "/Scripts/spa/assets/img/line.png"); image.Height = "3.5cm"; // height will change according to the no of items display in the invoice image.Width = "15.8cm"; // 19.5 cm = 7.7 inch image.LockAspectRatio = true; image.RelativeVertical = RelativeVertical.Line; image.RelativeHorizontal = RelativeHorizontal.Margin; image.Top = ShapePosition.Top; image.Left = ShapePosition.Left; image.WrapFormat.Style = WrapStyle.Through; //row.Borders.Visible = true; // Add the total price row row = this.table.AddRow(); row.Cells[0].Borders.Visible = false; row.Cells[0].AddParagraph("Total Price"); row.Cells[0].Format.Font.Bold = true; row.Cells[0].Format.Alignment = ParagraphAlignment.Right; row.Cells[0].MergeRight = 4; row.Cells[5].AddParagraph(totalExtendedPrice.ToString("0.00") + " €"); // Add the VAT row row = this.table.AddRow(); row.Cells[0].Borders.Visible = false; row.Cells[0].AddParagraph("VAT (19%)"); row.Cells[0].Format.Font.Bold = true; row.Cells[0].Format.Alignment = ParagraphAlignment.Right; row.Cells[0].MergeRight = 4; row.Cells[5].AddParagraph((0.19 * totalExtendedPrice).ToString("0.00") + " €"); // Add the additional fee row row = this.table.AddRow(); row.Cells[0].Borders.Visible = false; row.Cells[0].AddParagraph("Shipping and Handling"); row.Cells[5].AddParagraph(0.ToString("0.00") + " €"); row.Cells[0].Format.Font.Bold = true; row.Cells[0].Format.Alignment = ParagraphAlignment.Right; row.Cells[0].MergeRight = 4; // Add the total due row row = this.table.AddRow(); row.Cells[0].AddParagraph("Total Due"); row.Cells[0].Borders.Visible = false; row.Cells[0].Format.Font.Bold = true; row.Cells[0].Format.Alignment = ParagraphAlignment.Right; row.Cells[0].MergeRight = 4; totalExtendedPrice += 0.19 * totalExtendedPrice; row.Cells[5].AddParagraph(totalExtendedPrice.ToString("0.00") + " €"); // Set the borders of the specified cell range // this.table.SetEdge(5, this.table.Rows.Count - 4, 1, 4, Edge.Box, BorderStyle.Single, 0.75); // Add the notes paragraph paragraph = this.document.LastSection.AddParagraph(); paragraph.Format.SpaceBefore = "1cm"; paragraph.Format.Borders.Width = 0.75; paragraph.Format.Borders.Distance = 3; //paragraph.Format.Borders.Color = TableBorder; //paragraph.Format.Shading.Color = TableGray; item = SelectItem("/invoice"); paragraph.AddText(GetValue(item, "notes")); }
public void AddLastParagraph(Section sec) { Table t = sec.AddTable(); t.LeftPadding = "0mm"; t.RightPadding = "0mm"; t.TopPadding = "0mm"; t.BottomPadding = "0mm"; Column c = t.AddColumn("1mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("35mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("153mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; c = t.AddColumn("1mm"); c.Format.Alignment = ParagraphAlignment.Left; c.Format.LeftIndent = "0mm"; c.Format.RightIndent = "0mm"; Row r = t.AddRow(); r = t.AddRow(); r.Cells[1].MergeRight = 1; Paragraph p = r.Cells[1].AddParagraph(); r.Cells[1].Format.Alignment = ParagraphAlignment.Center; p.AddFormattedText("COVERAGE IS AT ALL TIMES SUBJECT TO THE CERTIFICATE WORDING COVERAGE TERMS CONDITIONS LIMITATIONS AND EXCLUSIONS", "Heading4"); r = t.AddRow(); r = t.AddRow(); r.Cells[1].MergeRight = 1; p = r.Cells[1].AddParagraph(); p.AddText("For and on behalf of HAYWARD AVIATION (a trading name of JLT Specialty Limited)"); r = t.AddRow(); r = t.AddRow(); p = r.Cells[1].AddParagraph(); p.AddText("SIGNED ................."); Image image = r.Cells[2].AddImage(@"C:\images\Signature.png"); image.Width = "25mm"; image.Height = "20mm"; p.AddLineBreak(); r = t.AddRow(); r = t.AddRow(); p.AddLineBreak(); p = r.Cells[1].AddParagraph(); p.AddFormattedText("E.& O.E", TextFormat.Bold); }
///<summary>Supply pd so that we know the paper size and margins.</summary> public static void CreateDocument(FormRpStatement sender, MigraDoc.DocumentObjectModel.Document doc, PrintDocument pd, Family fam, Patient pat, DataSet dataSet, Statement Stmt) { //doc= new MigraDoc.DocumentObjectModel.Document();//don't do this or the reference to the original doc will be lost. doc.DefaultPageSetup.PageWidth = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100); doc.DefaultPageSetup.PageHeight = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100); doc.DefaultPageSetup.TopMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100); doc.DefaultPageSetup.LeftMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100); doc.DefaultPageSetup.RightMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100); doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100); MigraDoc.DocumentObjectModel.Section section = doc.AddSection(); //so that Swiss will have different footer for each patient. string text; MigraDoc.DocumentObjectModel.Font font; //GetPatGuar(PatNums[famIndex][0]); //Family fam=Patients.GetFamily(Stmt.PatNum); Patient PatGuar = fam.ListPats[0]; //.Copy(); //Patient pat=fam.GetPatient(Stmt.PatNum); DataTable tableMisc = dataSet.Tables["misc"]; //HEADING------------------------------------------------------------------------------ #region Heading Paragraph par = section.AddParagraph(); ParagraphFormat parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Center; par.Format = parformat; font = MigraDocHelper.CreateFont(14, true); text = "This statement was generated from the plug-in"; par.AddFormattedText(text, font); text = DateTime.Today.ToShortDateString(); font = MigraDocHelper.CreateFont(10); par.AddLineBreak(); par.AddFormattedText(text, font); text = Lan.g("FormRpStatement", "Account Number") + " "; if (PrefC.GetBool(PrefName.StatementAccountsUseChartNumber)) { text += PatGuar.ChartNumber; } else { text += PatGuar.PatNum; } par.AddLineBreak(); par.AddFormattedText(text, font); TextFrame frame; #endregion //Practice Address---------------------------------------------------------------------- #region Practice Address if (PrefC.GetBool(PrefName.StatementShowReturnAddress)) { font = MigraDocHelper.CreateFont(10); frame = section.AddTextFrame(); frame.RelativeVertical = RelativeVertical.Page; frame.RelativeHorizontal = RelativeHorizontal.Page; frame.MarginLeft = Unit.Zero; frame.MarginTop = Unit.Zero; frame.Top = TopPosition.Parse("0.5 in"); frame.Left = LeftPosition.Parse("0.3 in"); frame.Width = Unit.FromInch(3); if (!PrefC.GetBool(PrefName.EasyNoClinics) && Clinics.List.Length > 0 && //if using clinics Clinics.GetClinic(PatGuar.ClinicNum) != null) //and this patient assigned to a clinic { Clinic clinic = Clinics.GetClinic(PatGuar.ClinicNum); par = frame.AddParagraph(); par.Format.Font = font; par.AddText(clinic.Description); par.AddLineBreak(); par.AddText(clinic.Address); par.AddLineBreak(); if (clinic.Address2 != "") { par.AddText(clinic.Address2); par.AddLineBreak(); } if (CultureInfo.CurrentCulture.Name.EndsWith("CH")) //CH is for switzerland. eg de-CH { par.AddText(clinic.Zip + " " + clinic.City); } else { par.AddText(clinic.City + ", " + clinic.State + " " + clinic.Zip); } par.AddLineBreak(); text = clinic.Phone; if (text.Length == 10) { text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6); } par.AddText(text); par.AddLineBreak(); } else { par = frame.AddParagraph(); par.Format.Font = font; par.AddText(PrefC.GetString(PrefName.PracticeTitle)); par.AddLineBreak(); if (CultureInfo.CurrentCulture.Name == "en-AU") //English (Australia) { Provider defaultProv = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv)); par.AddText("ABN: " + defaultProv.NationalProvID); par.AddLineBreak(); } par.AddText(PrefC.GetString(PrefName.PracticeAddress)); par.AddLineBreak(); if (PrefC.GetString(PrefName.PracticeAddress2) != "") { par.AddText(PrefC.GetString(PrefName.PracticeAddress2)); par.AddLineBreak(); } if (CultureInfo.CurrentCulture.Name.EndsWith("CH")) //CH is for switzerland. eg de-CH { par.AddText(PrefC.GetString(PrefName.PracticeZip) + " " + PrefC.GetString(PrefName.PracticeCity)); } else { par.AddText(PrefC.GetString(PrefName.PracticeCity) + ", " + PrefC.GetString(PrefName.PracticeST) + " " + PrefC.GetString(PrefName.PracticeZip)); } par.AddLineBreak(); text = PrefC.GetString(PrefName.PracticePhone); if (text.Length == 10) { text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6); } par.AddText(text); par.AddLineBreak(); } } #endregion //AMOUNT ENCLOSED------------------------------------------------------------------------------------------------------ #region Amount Enclosed Table table; Column col; Row row; Cell cell; frame = MigraDocHelper.CreateContainer(section, 450, 110, 330, 29); if (!Stmt.HidePayment) { table = MigraDocHelper.DrawTable(frame, 0, 0, 29); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Color = Colors.Black; row.Shading.Color = Colors.LightGray; row.TopPadding = Unit.FromInch(0); row.BottomPadding = Unit.FromInch(0); font = MigraDocHelper.CreateFont(8, true); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "Amount Due"), font); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "Date Due"), font); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "Amount Enclosed"), font); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Left.Color = Colors.Gray; row.Borders.Bottom.Color = Colors.Gray; row.Borders.Right.Color = Colors.Gray; font = MigraDocHelper.CreateFont(9); double balTotal = PatGuar.BalTotal; if (!PrefC.GetBool(PrefName.BalancesDontSubtractIns)) //this is typical { balTotal -= PatGuar.InsEst; } for (int m = 0; m < tableMisc.Rows.Count; m++) { if (tableMisc.Rows[m]["descript"].ToString() == "payPlanDue") { balTotal += PIn.Double(tableMisc.Rows[m]["value"].ToString()); //payPlanDue;//PatGuar.PayPlanDue; } } text = balTotal.ToString("F"); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(text, font); if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1) { text = Lan.g("FormRpStatement", "Upon Receipt"); } else { text = DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate)).ToShortDateString(); } cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(text, font); } #endregion //Credit Card Info-------------------------------------------------------------------------------------------------------- #region Credit Card Info if (!Stmt.HidePayment) { if (PrefC.GetBool(PrefName.StatementShowCreditCard)) { float yPos = 60; font = MigraDocHelper.CreateFont(7, true); text = Lan.g("FormRpStatement", "CREDIT CARD TYPE"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); float rowHeight = 26; System.Drawing.Font wfont = new System.Drawing.Font("Arial", 7, FontStyle.Bold); System.Drawing.Image img = new Bitmap(500, 30); Graphics g = Graphics.FromImage(img); //just to measure strings MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "#"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "3 DIGIT CSV"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "EXPIRES"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "AMOUNT APPROVED"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "NAME"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos += rowHeight; text = Lan.g("FormRpStatement", "SIGNATURE"); MigraDocHelper.DrawString(frame, text, font, 0, yPos); MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width, yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g)); yPos -= rowHeight; text = Lan.g("FormRpStatement", "(As it appears on card)"); wfont = new System.Drawing.Font("Arial", 5); font = MigraDocHelper.CreateFont(5); MigraDocHelper.DrawString(frame, text, font, 625 - g.MeasureString(text, wfont).Width / 2 + 5, yPos + 13); g.Dispose(); img = null; } } #endregion //Patient's Billing Address--------------------------------------------------------------------------------------------- #region Patient Billing Address font = MigraDocHelper.CreateFont(11); frame = MigraDocHelper.CreateContainer(section, 62.5f + 12.5f, 225 + 1, 300, 200); par = frame.AddParagraph(); par.Format.Font = font; if (Stmt.SinglePatient) { par.AddText(fam.GetNameInFamFL(Stmt.PatNum)); } else { par.AddText(PatGuar.GetNameFLFormal()); } par.AddLineBreak(); par.AddText(PatGuar.Address); par.AddLineBreak(); if (PatGuar.Address2 != "") { par.AddText(PatGuar.Address2); par.AddLineBreak(); } if (CultureInfo.CurrentCulture.Name.EndsWith("CH")) //CH is for switzerland. eg de-CH { par.AddText(PatGuar.Zip + " " + PatGuar.City); } else { par.AddText(PatGuar.City + ", " + PatGuar.State + " " + PatGuar.Zip); } //perforated line------------------------------------------------------------------------------------------------------ //yPos=350;//3.62 inches from top, 1/3 page down frame = MigraDocHelper.CreateContainer(section, 0, 350, 850, 30); if (!Stmt.HidePayment) { MigraDocHelper.DrawLine(frame, System.Drawing.Color.LightGray, 0, 0, 850, 0); text = Lan.g("FormRpStatement", "PLEASE DETACH AND RETURN THE UPPER PORTION WITH YOUR PAYMENT"); font = MigraDocHelper.CreateFont(6, true, System.Drawing.Color.Gray); par = frame.AddParagraph(); par.Format.Alignment = ParagraphAlignment.Center; par.Format.Font = font; par.AddText(text); } #endregion //Australian Provider Legend #region Australian Provider Legend int legendOffset = 0; if (CultureInfo.CurrentCulture.Name == "en-AU") //English (Australia) { Providers.RefreshCache(); legendOffset = 25 + 15 * (1 + ProviderC.List.Length); MigraDocHelper.InsertSpacer(section, legendOffset); frame = MigraDocHelper.CreateContainer(section, 45, 390, 250, legendOffset); par = frame.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(8, true); par.AddLineBreak(); par.AddText("PROVIDERS:"); par = frame.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(8, false); for (int i = 0; i < ProviderC.List.Length; i++) //All non-hidden providers are added to the legend. { Provider prov = ProviderC.List[i]; string suffix = ""; if (prov.Suffix.Trim() != "") { suffix = ", " + prov.Suffix.Trim(); } par.AddText(prov.Abbr + " - " + prov.FName + " " + prov.LName + suffix + " - " + prov.MedicaidID); par.AddLineBreak(); } par.AddLineBreak(); } #endregion //Aging----------------------------------------------------------------------------------- #region Aging MigraDocHelper.InsertSpacer(section, 275); frame = MigraDocHelper.CreateContainer(section, 55, 390 + legendOffset, 250, 29); if (!Stmt.HidePayment) { table = MigraDocHelper.DrawTable(frame, 0, 0, 29); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); col = table.AddColumn(Unit.FromInch(1.1)); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Color = Colors.Black; row.Shading.Color = Colors.LightGray; row.TopPadding = Unit.FromInch(0); row.BottomPadding = Unit.FromInch(0); font = MigraDocHelper.CreateFont(8, true); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "0-30"), font); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "31-60"), font); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "61-90"), font); cell = row.Cells[3]; par = cell.AddParagraph(); par.AddFormattedText(Lan.g("FormRpStatement", "over 90"), font); row = table.AddRow(); row.Format.Alignment = ParagraphAlignment.Center; row.Borders.Left.Color = Colors.Gray; row.Borders.Bottom.Color = Colors.Gray; row.Borders.Right.Color = Colors.Gray; font = MigraDocHelper.CreateFont(9); text = PatGuar.Bal_0_30.ToString("F"); cell = row.Cells[0]; par = cell.AddParagraph(); par.AddFormattedText(text, font); text = PatGuar.Bal_31_60.ToString("F"); cell = row.Cells[1]; par = cell.AddParagraph(); par.AddFormattedText(text, font); text = PatGuar.Bal_61_90.ToString("F"); cell = row.Cells[2]; par = cell.AddParagraph(); par.AddFormattedText(text, font); text = PatGuar.BalOver90.ToString("F"); cell = row.Cells[3]; par = cell.AddParagraph(); par.AddFormattedText(text, font); } #endregion //Floating Balance, Ins info------------------------------------------------------------------- #region FloatingBalance frame = MigraDocHelper.CreateContainer(section, 460, 380 + legendOffset, 250, 200); //table=MigraDocHelper.DrawTable(frame,0,0,90); par = frame.AddParagraph(); parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Right; par.Format = parformat; font = MigraDocHelper.CreateFont(10, false); MigraDoc.DocumentObjectModel.Font fontBold = MigraDocHelper.CreateFont(10, true); if (PrefC.GetBool(PrefName.BalancesDontSubtractIns)) { text = Lan.g("FormRpStatement", "Balance:"); par.AddFormattedText(text, fontBold); //par.AddLineBreak(); //text = Lan.g(this, "Ins Pending:"); //par.AddFormattedText(text, font); //par.AddLineBreak(); //text = Lan.g(this, "After Ins:"); //par.AddFormattedText(text, font); //par.AddLineBreak(); } else //this is more common { if (PrefC.GetBool(PrefName.FuchsOptionsOn)) { text = Lan.g("FormRpStatement", "Balance:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "-Ins Estimate:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "=Owed Now:"); par.AddFormattedText(text, fontBold); par.AddLineBreak(); } else { text = Lan.g("FormRpStatement", "Total:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "-Ins Estimate:"); par.AddFormattedText(text, font); par.AddLineBreak(); text = Lan.g("FormRpStatement", "=Balance:"); par.AddFormattedText(text, fontBold); par.AddLineBreak(); } } frame = MigraDocHelper.CreateContainer(section, 730, 380 + legendOffset, 100, 200); //table=MigraDocHelper.DrawTable(frame,0,0,90); par = frame.AddParagraph(); parformat = new ParagraphFormat(); parformat.Alignment = ParagraphAlignment.Left; par.Format = parformat; font = MigraDocHelper.CreateFont(10, false); //numbers: if (PrefC.GetBool(PrefName.BalancesDontSubtractIns)) { text = PatGuar.BalTotal.ToString("c"); par.AddFormattedText(text, fontBold); //par.AddLineBreak(); //text = PatGuar.InsEst.ToString("c"); //par.AddFormattedText(text, font); //par.AddLineBreak(); //text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c"); //par.AddFormattedText(text, font); //par.AddLineBreak(); } else //more common { if (Stmt.SinglePatient) { double patInsEst = 0; for (int m = 0; m < tableMisc.Rows.Count; m++) { if (tableMisc.Rows[m]["descript"].ToString() == "patInsEst") { patInsEst = PIn.Double(tableMisc.Rows[m]["value"].ToString()); } } double patBal = pat.EstBalance - patInsEst; text = pat.EstBalance.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = patInsEst.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = patBal.ToString("c"); par.AddFormattedText(text, fontBold); } else { text = PatGuar.BalTotal.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = PatGuar.InsEst.ToString("c"); par.AddFormattedText(text, font); par.AddLineBreak(); text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c"); par.AddFormattedText(text, fontBold); par.AddLineBreak(); } } MigraDocHelper.InsertSpacer(section, 80); #endregion FloatingBalance //Bold note------------------------------------------------------------------------------- #region Bold note if (Stmt.NoteBold != "") { MigraDocHelper.InsertSpacer(section, 7); font = MigraDocHelper.CreateFont(10, true, System.Drawing.Color.DarkRed); par = section.AddParagraph(); par.Format.Font = font; par.AddText(Stmt.NoteBold); MigraDocHelper.InsertSpacer(section, 8); } #endregion Bold note //Payment plan grid definition--------------------------------------------------------------------------------- #region PayPlan grid definition ODGridColumn gcol; ODGridRow grow; ODGrid gridPP = new ODGrid(); //this.Controls.Add(gridPP); gridPP.BeginUpdate(); gridPP.Columns.Clear(); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Date"), 73); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Balance"), 60, HorizontalAlignment.Right); gridPP.Columns.Add(gcol); gridPP.Width = gridPP.WidthAllColumns + 20; gridPP.EndUpdate(); #endregion PayPlan grid definition //Payment plan grid. There will be only one, if any----------------------------------------------------------------- #region PayPlan grid DataTable tablePP = dataSet.Tables["payplan"]; ODGridCell gcell; if (tablePP.Rows.Count > 0) { //MigraDocHelper.InsertSpacer(section,5); par = section.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(10, true); par.Format.Alignment = ParagraphAlignment.Center; //par.Format.SpaceBefore=Unit.FromInch(.05); //par.Format.SpaceAfter=Unit.FromInch(.05); par.AddText(Lan.g("FormRpStatement", "Payment Plans")); MigraDocHelper.InsertSpacer(section, 2); gridPP.BeginUpdate(); gridPP.Rows.Clear(); for (int p = 0; p < tablePP.Rows.Count; p++) { grow = new ODGridRow(); grow.Cells.Add(tablePP.Rows[p]["date"].ToString()); grow.Cells.Add(tablePP.Rows[p]["description"].ToString()); grow.Cells.Add(tablePP.Rows[p]["charges"].ToString()); grow.Cells.Add(tablePP.Rows[p]["credits"].ToString()); gcell = new ODGridCell(tablePP.Rows[p]["balance"].ToString()); if (p == tablePP.Rows.Count - 1) { gcell.Bold = YN.Yes; } else if (tablePP.Rows[p + 1]["balance"].ToString() == "") //if next row balance is blank. { gcell.Bold = YN.Yes; } grow.Cells.Add(gcell); gridPP.Rows.Add(grow); } gridPP.EndUpdate(); MigraDocHelper.DrawGrid(section, gridPP); MigraDocHelper.InsertSpacer(section, 2); par = section.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(10, true); par.Format.Alignment = ParagraphAlignment.Right; par.Format.RightIndent = Unit.FromInch(0.25); double payPlanDue = 0; for (int m = 0; m < tableMisc.Rows.Count; m++) { if (tableMisc.Rows[m]["descript"].ToString() == "payPlanDue") { payPlanDue = PIn.Double(tableMisc.Rows[m]["value"].ToString()); } } par.AddText(Lan.g("FormRpStatement", "Payment Plan Amount Due: ") + payPlanDue.ToString("c")); //PatGuar.PayPlanDue.ToString("c")); MigraDocHelper.InsertSpacer(section, 10); } #endregion PayPlan grid //Body Table definition-------------------------------------------------------------------------------------------------------- #region Body Table definition ODGrid gridPat = new ODGrid(); //this.Controls.Add(gridPat); gridPat.BeginUpdate(); gridPat.Columns.Clear(); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Date"), 73); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Patient"), 100); gridPat.Columns.Add(gcol); //prov gcol = new ODGridColumn(Lan.g("FormRpStatement", "Code"), 45); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Tooth"), 42); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gcol = new ODGridColumn(Lan.g("FormRpStatement", "Balance"), 60, HorizontalAlignment.Right); gridPat.Columns.Add(gcol); gridPat.Width = gridPat.WidthAllColumns + 20; gridPat.EndUpdate(); #endregion Body Table definition //Loop through each table. Could be one intermingled, or one for each patient----------------------------------------- DataTable tableAccount; string tablename; long patnum; for (int i = 0; i < dataSet.Tables.Count; i++) { tableAccount = dataSet.Tables[i]; tablename = tableAccount.TableName; if (!tablename.StartsWith("account")) { continue; } par = section.AddParagraph(); par.Format.Font = MigraDocHelper.CreateFont(10, true); par.Format.SpaceBefore = Unit.FromInch(.05); par.Format.SpaceAfter = Unit.FromInch(.05); patnum = 0; if (tablename != "account") //account123 etc. { patnum = PIn.Long(tablename.Substring(7)); } if (patnum != 0) { par.AddText(fam.GetNameInFamFLnoPref(patnum)); } //if(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript!=""){ // par=section.AddParagraph(); // par.Format.Font=MigraDocHelper.CreateFont(9);//same as body font // par.AddText(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript); //} gridPat.BeginUpdate(); gridPat.Rows.Clear(); //lineData=FamilyStatementDataList[famIndex].PatDataList[i].PatData; for (int p = 0; p < tableAccount.Rows.Count; p++) { grow = new ODGridRow(); grow.Cells.Add(tableAccount.Rows[p]["date"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["patient"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["ProcCode"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["tth"].ToString()); if (CultureInfo.CurrentCulture.Name == "en-AU") //English (Australia) { if (tableAccount.Rows[p]["prov"].ToString().Trim() != "") { grow.Cells.Add(tableAccount.Rows[p]["prov"].ToString() + " - " + tableAccount.Rows[p]["description"].ToString()); } else //No provider on this account row item, so don't put the extra leading characters. { grow.Cells.Add(tableAccount.Rows[p]["description"].ToString()); } } else //Assume English (United States) { grow.Cells.Add(tableAccount.Rows[p]["description"].ToString()); } grow.Cells.Add(tableAccount.Rows[p]["charges"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["credits"].ToString()); grow.Cells.Add(tableAccount.Rows[p]["balance"].ToString()); gridPat.Rows.Add(grow); } gridPat.EndUpdate(); MigraDocHelper.DrawGrid(section, gridPat); //Total frame = MigraDocHelper.CreateContainer(section); font = MigraDocHelper.CreateFont(9, true); float totalPos = ((float)(doc.DefaultPageSetup.PageWidth.Inch //-doc.DefaultPageSetup.LeftMargin.Inch //-doc.DefaultPageSetup.RightMargin.Inch) ) * 100f) / 2f + (float)gridPat.WidthAllColumns / 2f + 7; RectangleF rectF = new RectangleF(0, 0, totalPos, 16); if (patnum != 0) { MigraDocHelper.DrawString(frame, " ", //I decided this was unnecessary: //dataSet.Tables["patient"].Rows[fam.GetIndex(patnum)]["balance"].ToString(), font, rectF, ParagraphAlignment.Right); //MigraDocHelper.DrawString(frame,FamilyStatementDataList[famIndex].PatAboutList[i].Balance.ToString("F"),font,rectF, // ParagraphAlignment.Right); } } gridPat.Dispose(); //Future appointments--------------------------------------------------------------------------------------------- #region Future appointments font = MigraDocHelper.CreateFont(9); DataTable tableAppt = dataSet.Tables["appts"]; if (tableAppt.Rows.Count > 0) { par = section.AddParagraph(); par.Format.Font = font; par.AddText(Lan.g("FormRpStatement", "Scheduled Appointments:")); } for (int i = 0; i < tableAppt.Rows.Count; i++) { par.AddLineBreak(); par.AddText(tableAppt.Rows[i]["descript"].ToString()); } if (tableAppt.Rows.Count > 0) { MigraDocHelper.InsertSpacer(section, 10); } #endregion Future appointments //Note------------------------------------------------------------------------------------------------------------ font = MigraDocHelper.CreateFont(9); par = section.AddParagraph(); par.Format.Font = font; par.AddText(Stmt.Note); //bold note if (Stmt.NoteBold != "") { MigraDocHelper.InsertSpacer(section, 10); font = MigraDocHelper.CreateFont(10, true, System.Drawing.Color.DarkRed); par = section.AddParagraph(); par.Format.Font = font; par.AddText(Stmt.NoteBold); } //return doc; }
public string GenerateDocument() { table_color = Tools.GetTableColorByRetailer(""); document = new Document(); document.Info.Title = "Certificate Of Insurance"; document.DefaultPageSetup.PageHeight = page_height; document.DefaultPageSetup.PageWidth = page_width; document.DefaultPageSetup.TopMargin = margin; document.DefaultPageSetup.LeftMargin = margin; document.DefaultPageSetup.RightMargin = margin; document.DefaultPageSetup.BottomMargin = bottom_margin; DefineStyle(); Section sec = document.AddSection(); Tools.AddMainFooter(ref sec); // PdfSharpCore. // MigraDocCore.DocumentObjectModel.MigraDoc.DocumentObjectModel.Shapes.ImageSource image = new Image // System.Drawing.Image img = System.Drawing.Image.FromFile(""); Image image = new Image(); //img.Width = "190cm"; // img.Height = "50cm"; image = sec.AddImage(Tools.GetMainPageHeader()); image.Width = "190mm"; image.Height = "50mm"; image.Left = ShapePosition.Center; Table t = sec.AddTable(); Column c = t.AddColumn("95mm"); c.Format.Alignment = ParagraphAlignment.Left; c = t.AddColumn("95mm"); c.Format.Alignment = ParagraphAlignment.Right; Row r = t.AddRow(); Paragraph p = r.Cells[0].AddParagraph(); r = t.AddRow(); p = r.Cells[0].AddParagraph(); p.Style = "Heading2"; p.AddText("TO WHOM IT MAY CONCERN"); p = r.Cells[1].AddParagraph(); p.Format.Alignment = ParagraphAlignment.Right; p.Style = "Heading2"; p.AddText("Date: " + System.DateTime.Today.Date.ToLongDateString()); r = t.AddRow(); r = t.AddRow(); p = r.Cells[0].AddParagraph(); //p.Style = "Heading2"; r.Cells[0].MergeRight = 1; p.AddFormattedText("IT IS HEREBY CERTIFIED THAT:", TextFormat.Underline); p = sec.AddParagraph(); AddClientDetails(sec); // AddGeographicalLimits(sec); sec = document.AddSection(); Tools.AddNoFooter(ref sec); AddHeader(sec); AddClientDetailsPage2(sec); AddAircraftsSchedules(sec); AddLastParagraph(sec); return(SaveDocument(document)); }
protected override void CreatePage() { // Each MigraDoc document needs at least one section. Section section = Document.AddSection(); // Create header Table = section.Headers.Primary.AddTable(); Table.Style = "Table"; Column column = Table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Right; //2 column = Table.AddColumn("6cm"); column.Format.Alignment = ParagraphAlignment.Left; //3 column = Table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Right; //4 column = Table.AddColumn("6cm"); column.Format.Alignment = ParagraphAlignment.Left; Row row = Table.AddRow(); row.BottomPadding = 2; row.TopPadding = 2; row.Cells[0].AddParagraph("Agent:"); row.Cells[0].Format.Font.Bold = true; row.Cells[1].AddParagraph(invoice.Agent.Name); row.Cells[2].AddParagraph("Customer:"); row.Cells[2].Format.Font.Bold = true; row.Cells[3].AddParagraph(invoice.Customer.Name); row = Table.AddRow(); row.BottomPadding = 2; row.TopPadding = 2; row.Cells[0].AddParagraph("Shipper:"); row.Cells[0].Format.Font.Bold = true; if (invoice.Shipper != null) { row.Cells[1].AddParagraph(invoice.Shipper.Name); } row.Cells[2].AddParagraph("Address:"); row.Cells[2].Format.Font.Bold = true; row.Cells[3].AddParagraph(invoice.Customer.Address); row = Table.AddRow(); row.BottomPadding = 2; row.TopPadding = 2; row.Cells[0].AddParagraph("Destination:"); row.Cells[0].Format.Font.Bold = true; row.Cells[1].AddParagraph(invoice.Customer.Town.Name); if (invoice.ShippedOn != null) { row = Table.AddRow(); row.BottomPadding = 2; row.TopPadding = 2; row.Cells[0].AddParagraph("Shipped on:"); row.Cells[0].Format.Font.Bold = true; row.Cells[1].AddParagraph(invoice.ShippedOn.Value.ToShortDateString()); } row = Table.AddRow(); row.BottomPadding = 2; row.TopPadding = 2; row.Cells[0].AddParagraph("Status:"); row.Cells[0].Format.Font.Bold = true; row.Cells[1].AddParagraph(invoice.Status.ToString()); // Create footer Paragraph paragraph = section.Footers.Primary.AddParagraph(); paragraph.AddText("Billing - BiH - " + DateTime.UtcNow.Year); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center; // Create the text frame for the address AddressFrame = section.AddTextFrame(); AddressFrame.Height = "3.0cm"; AddressFrame.Width = "7.0cm"; AddressFrame.Left = ShapePosition.Left; AddressFrame.RelativeHorizontal = RelativeHorizontal.Margin; AddressFrame.Top = "5.0cm"; AddressFrame.RelativeVertical = RelativeVertical.Page; // Add the print date field paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "4cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText("INVOICE " + invoice.InvoiceNo, TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Date: "); paragraph.AddDateField("dd.MM.yyyy"); // Create the item table Table = section.AddTable(); Table.Style = "Table"; Table.Borders.Width = 0.25; Table.Borders.Left.Width = 0.5; Table.Borders.Right.Width = 0.5; Table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns //1 column = Table.AddColumn("1cm"); column.Format.Alignment = ParagraphAlignment.Center; //2 column = Table.AddColumn("5cm"); column.Format.Alignment = ParagraphAlignment.Center; //3 column = Table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Center; //4 column = Table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Center; //5 column = Table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Center; //6 column = Table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Center; // Create the header of the table row = Table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; row.Cells[0].AddParagraph("#"); row.Cells[0].Format.Alignment = ParagraphAlignment.Center; row.Cells[1].AddParagraph("Name"); row.Cells[1].Format.Alignment = ParagraphAlignment.Center; row.Cells[2].AddParagraph("Unit"); row.Cells[2].Format.Alignment = ParagraphAlignment.Center; row.Cells[3].AddParagraph("Quantity"); row.Cells[3].Format.Alignment = ParagraphAlignment.Center; row.Cells[4].AddParagraph("Price"); row.Cells[4].Format.Alignment = ParagraphAlignment.Center; row.Cells[5].AddParagraph("Total"); row.Cells[5].Format.Alignment = ParagraphAlignment.Center; }
private void CreatePage() { //Each MigraDoc document needs at least one section. Section section = this.document.AddSection(); //// Put a logo in the header //Image image = section.Headers.Primary.AddImage("./Images/easyres.png"); //image.Height = "2.5cm"; //image.LockAspectRatio = true; //image.RelativeVertical = RelativeVertical.Line; //image.RelativeHorizontal = RelativeHorizontal.Margin; //image.Top = ShapePosition.Top; //image.Left = ShapePosition.Left; //image.WrapFormat.Style = WrapStyle.Through; // Create footer Paragraph paragraph = section.Footers.Primary.AddParagraph(); paragraph.AddText("© EasyRes Inc"); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center; // Create the text frame for the general information this.generalFrame = section.AddTextFrame(); this.generalFrame.Height = "3.0cm"; this.generalFrame.Width = "5.0cm"; this.generalFrame.Left = ShapePosition.Right; this.generalFrame.RelativeHorizontal = RelativeHorizontal.Margin; this.generalFrame.Top = "1.75cm"; this.generalFrame.RelativeVertical = RelativeVertical.Page; // Add the title of the restaurant paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "1.25cm"; paragraph.Style = "Titel"; paragraph.AddFormattedText(factuur.Restaurant.Naam, TextFormat.Bold); // Add the title on top of the table paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "0.5cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText("Bestellingen", TextFormat.Bold); // Create the bestelling table this.table = section.AddTable(); this.table.Style = "Table"; this.table.Borders.Color = TableBorder; this.table.Borders.Width = 0.25; this.table.Borders.Left.Width = 0.5; this.table.Borders.Right.Width = 0.5; this.table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns Column column = this.table.AddColumn("7cm"); column.Format.Alignment = ParagraphAlignment.Left; Column column1 = this.table.AddColumn("1.5cm"); column1.Format.Alignment = ParagraphAlignment.Left; Column column2 = this.table.AddColumn("2.5cm"); column2.Format.Alignment = ParagraphAlignment.Left; Column column3 = this.table.AddColumn("1.5cm"); column3.Format.Alignment = ParagraphAlignment.Left; Column column4 = this.table.AddColumn("2.5cm"); column4.Format.Alignment = ParagraphAlignment.Left; // Create head of table Row row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = false; row.Shading.Color = TableGray; row.TopPadding = 3; row.BottomPadding = 3; row.Cells[0].AddParagraph("Omschrijving"); row.Cells[0].Format.Font.Bold = true; row.Cells[0].Format.Alignment = ParagraphAlignment.Left; row.Cells[0].VerticalAlignment = VerticalAlignment.Center; row.Cells[1].AddParagraph("Aantal"); row.Cells[1].Format.Font.Bold = true; row.Cells[1].Format.Alignment = ParagraphAlignment.Left; row.Cells[1].VerticalAlignment = VerticalAlignment.Center; row.Cells[2].AddParagraph("Prijs/stuk"); row.Cells[2].Format.Font.Bold = true; row.Cells[2].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].VerticalAlignment = VerticalAlignment.Center; row.Cells[3].AddParagraph("Btw %"); row.Cells[3].Format.Font.Bold = true; row.Cells[3].Format.Alignment = ParagraphAlignment.Left; row.Cells[3].VerticalAlignment = VerticalAlignment.Center; row.Cells[4].AddParagraph("Bedrag"); row.Cells[4].Format.Font.Bold = true; row.Cells[4].Format.Alignment = ParagraphAlignment.Left; row.Cells[4].VerticalAlignment = VerticalAlignment.Center; //this.table.SetEdge(0, 0, 5, 2, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); }
void Pages() { //Document doc = new Document(); Section sec = doc.AddSection(); // // create a table var table = sec.AddTable(); table.AddColumn("7cm"); table.AddColumn("13cm"); var row = table.AddRow(); table.Rows.LeftIndent = "0.5cm"; var image = row.Cells[0].AddImage("Resources/logo.png"); image.Height = "19mm"; var cell = row.Cells[1].AddParagraph("Energy Service Report\n"); //cell.AddBookmark("Energy Service Report"); //cell.Format.Font.Name = "SegoeUIGrass"; cell.Format.Font.Size = 22; cell.Format.Font.Bold = true; cell.Format.Font.Color = MigraDoc.DocumentObjectModel.Color.Parse("#103058"); cell.Format.SpaceAfter = "3mm"; var cell2 = row.Cells[1].AddParagraph("Cordium: Real - time heat control"); cell2.Format.Font.Size = 18; cell2.Format.Font.Color = MigraDoc.DocumentObjectModel.Color.Parse("#02BBE6"); Paragraph line = sec.AddParagraph(); line.Format.Borders.Distance = "-3pt"; line.Format.Borders.Bottom = new Border() { Width = "2pt", Color = Colors.DarkGray }; //line.Format.SpaceAfter = "2mm"; Paragraph Period = sec.AddParagraph("Period: ", "Heading1"); Period.Format.TabStops.ClearAll(); Period.Format.TabStops.AddTabStop(Unit.FromMillimeter(176), MigraDoc.DocumentObjectModel.TabAlignment.Right); Period.AddTab(); Period.Format.Alignment = ParagraphAlignment.Left; string DateMY = DateTime.Now.ToString("MMMM, yyyy", System.Globalization.CultureInfo.CreateSpecificCulture("en-US")); Period.AddFormattedText(DateMY).Color = MigraDoc.DocumentObjectModel.Color.Parse("#838383"); Paragraph ProjectDetails = sec.AddParagraph("Project Details:", "Heading1"); var cordium = sec.AddImage("Resources/cordium.png"); cordium.Left = ShapePosition.Center; cordium.Width = "17 cm"; DotListAdd2(doc, "Project Manager: Frank Louwet", "Location: Crutzestraat, Hasselt"); //для списка с точкой //string[] items = "Project Manager: Frank Louwet |Location: Crutzestraat, Hasselt ".Split('|'); //for (int idx = 0; idx < items.Length; ++idx) //{ // ListInfo listinfo = new ListInfo(); // listinfo.ContinuePreviousList = idx > 0; // listinfo.ListType = ListType.BulletList1; // cordium = sec.AddParagraph(items[idx]); // cordium.Style = "MyBulletList"; // cordium.Format.ListInfo = listinfo; //} //void DotListAdd(Document doc, Paragraph par, string str) //{ // ListInfo listinfo = new ListInfo(); // listinfo.ContinuePreviousList = false; // listinfo.ListType = ListType.BulletList1; // par = sec.AddParagraph(str); // par.Style = "MyBulletList"; // par.Format.ListInfo = listinfo; //} void DotListAdd2(Document doc, params string[] arrstr) { //string[] items = "Project Manager: Frank Louwet |Location: Crutzestraat, Hasselt ".Split('|'); for (int idx = 0; idx < arrstr.Length; ++idx) { sec.AddParagraph(arrstr[idx], "BulletList"); } } //doc.Styles.AddStyle("Bulletlist", "Normal"); //var style = Styles["BulletList"]; //style.ParagraphFormat.RightIndent = 12; //style.ParagraphFormat.TabStops.ClearAll(); //style.ParagraphFormat.TabStops.AddTabStop(Unit.FromCentimeter(2.5), TabAlignment.Left); //style.ParagraphFormat.LeftIndent = "2.5cm"; //style.ParagraphFormat.FirstLineIndent = "-0.5cm"; //style.ParagraphFormat.SpaceBefore = 0; //style.ParagraphFormat.SpaceAfter = 0; Paragraph ExecutiveSummary = sec.AddParagraph("Executive Summary:", "Heading1"); Paragraph ContentExecutiveSummary = sec.AddParagraph("This month there were a total of 345 degree days", "Text"); ContentExecutiveSummary.Format.SpaceBefore = "5mm"; sec.AddParagraph("Phase 1 heating energy:", "Text"); sec.AddParagraph("2196 kWh of gas consumed(0.32 kWh per apartment per degree day)", "BulletList"); sec.AddParagraph("Phase 2 heating energy: ", "Text"); DotListAdd2(doc, "14515 kWh of gas consumed(2.1 kWh per apartment per degree day)", "3.5 kWh of electricity consumed(0.00051 kWh per apartment per degree day)"); sec.AddParagraph("Phase 3 heating energy: ", "Text"); DotListAdd2(doc, "17791 kWh of gas consumed (1.8 kWh per apartment per degree day)", "650 kWh of electricity produced"); Paragraph ProjectOverview = sec.AddParagraph("Project Overview:", "Heading1"); Paragraph ContentProjectOverview = sec.AddParagraph("The advanced control strategy is implemented in a district " + "heating system for social housing in Crutzestraat, Hasselt. The social housing is operated " + "by Cordium, the operating manager for social housing in Flemish region. The project consists" + " of three phases or buildings with 20, 20 and 28 apartments in each phase. Each building " + "has its own central heating system with various technologies installed. Furthermore, " + "central heating systems are interconnected by an internal heat transfer network. " + "i.Leco developed the control strategy which sends hourly setpoints fo: maximum and " + "minimum temperature setpoint in each building and/or distribution circuit, operation " + "modes of installed technologies, and distribution state settings between building/heating " + "systems.", "Text"); ContentProjectOverview.Format.SpaceAfter = "-5 mm"; doc.LastSection.AddPageBreak(); //2 Paragraph phase1 = sec.AddParagraph("Phase 1", "Heading1"); phase1.Format.Borders.Bottom.Visible = false; sec.AddParagraph("Installed technologies:", "Text"); sec.AddParagraph("Geothermal/water gas absorption heat pumps – 2 pcs", "BulletList"); //Paragraph fig1 = sec.AddParagraph("","figure"); var img1 = sec.AddImage("Resources/2.1.jpg"); //img1.Height = "10cm"; img1.Top = "10mm"; img1.LockAspectRatio = true; img1.Left = ShapePosition.Center; sec.AddParagraph("\nFigure 1: Phase 1 Energy Diagram", "figure"); sec.AddParagraph("This month 20 MWh of heating energy was provided to the phase 1 building by heat pumps." + " Consumption of gas compared with previous months is shown below.", "Text2"); var img2 = sec.AddImage("Resources/2.2.jpg"); img2.Left = ShapePosition.Center; sec.AddParagraph("Figure 2: Phase 1 Energy Consumption monthly comparison", "figure"); Paragraph fig3 = sec.AddParagraph("", "figure"); fig3.AddImage("Resources/2.3.jpg"); fig3.AddFormattedText("\nFigure 3: Phase 1 Control (" + DateMY + ")", "Text"); sec.AddParagraph("The minimum return water temperature this month was 39.4 °C", "Text"); doc.LastSection.AddPageBreak(); Paragraph phase2 = sec.AddParagraph("Phase 2", "Heading1"); phase2.Format.Borders.Bottom.Visible = false; sec.AddParagraph("Installed technologies:", "Text"); DotListAdd2(doc, "Electrical air/water heat pump", "Electrical geothermal/water heat pump", "Geothermal / water gas absorption heat pump", "Gas condensing boiler"); Paragraph fig4 = sec.AddParagraph("", "figure"); fig4.Format.SpaceBefore = "10mm"; fig4.AddImage("Resources/4.1.jpg"); fig4.AddFormattedText("\nFigure 4: Phase 2 Energy Diagram", "Text"); sec.AddParagraph("The electrical and gas energy consumed by the " + "installed technologies this month is shown below:", "Text"); //Paragraph fig5 = sec.AddParagraph("", "figure"); var img5 = sec.AddImage("Resources/4.2.jpg"); img5.Left = ShapePosition.Center; sec.AddParagraph("Figure 5: Phase 2 Energy Consumption", "figure"); sec.AddParagraph("This month 19.5 MWh of heating energy was provided to the phase 2 " + "building by heat pumps and the gas boiler.Consumption of electricity " + "and gas compared with previous months is shown below.", "Text"); var img6 = sec.AddImage("Resources/5.1.jpg"); img6.Left = ShapePosition.Center; sec.AddParagraph("Figure 6: Phase 2 Energy Consumption monthly comparison", "figure"); var img7 = sec.AddImage("Resources/5.2.jpg"); img7.Left = ShapePosition.Center; sec.AddParagraph("Figure 7: Phase 2 Control (" + DateMY + ")", "figure"); sec.AddParagraph("The minimum return water temperature this month was 35.6 °C", "Text"); doc.LastSection.AddPageBreak(); Paragraph phase3 = sec.AddParagraph("Phase 3", "Heading1"); phase3.Format.Borders.Bottom.Visible = false; sec.AddParagraph("Installed technologies:", "Text"); DotListAdd2(doc, "Combined heat and power", "Gas boilers – 3 pcs"); var img8 = sec.AddImage("Resources/6.1.jpg"); img8.Left = ShapePosition.Center; img8.Top = "8mm"; sec.AddParagraph("\nFigure 8: Phase 3 Energy Diagram", "figure"); sec.AddParagraph("The gas energy consumed by the installed technologies this month is shown below:", "Text"); var img9 = sec.AddImage("Resources/6.2.jpg"); img9.Left = ShapePosition.Center; sec.AddParagraph("Figure 9: Phase 3 Energy Consumption", "figure"); sec.AddParagraph("This month 29 MWh of heating energy was provided to the phase 3 building by gas boilers and the combined heat & " + "power plant.Consumption of gas and electricity production compared with previous months is shown below.", "Text"); //7 var img10 = sec.AddImage("Resources/7.1.jpg"); img10.Left = ShapePosition.Center; sec.AddParagraph("Figure 10: Phase 3 Energy Consumption/production monthly comparison", "figure"); var img11 = sec.AddImage("Resources/7.2.jpg"); img11.Left = ShapePosition.Center; sec.AddParagraph("Figure 11: Phase 3 Control (" + DateMY + ")", "figure"); sec.AddParagraph("The minimum return water temperature this month was 45.9 °C", "Text"); // Create footer Paragraph footer = sec.Footers.Primary.AddParagraph(); footer.AddText("i.Leco © "); footer.AddDateField("dd/MM/yyyy"); // Clear all existing tab stops, and add our calculated tab stop, on the right footer.Format.TabStops.ClearAll(); footer.Format.TabStops.AddTabStop(Unit.FromMillimeter(178), MigraDoc.DocumentObjectModel.TabAlignment.Right); footer.AddTab(); footer.AddPageField(); footer.AddText("/"); footer.AddNumPagesField(); }
private void Fill() { Section section = _document.AddSection(); Image img = section.AddImage(_path + "/img/logo/logo.png"); img.Height = "4cm"; Paragraph paragraph = section.AddParagraph(); paragraph.AddLineBreaks(count: 2); Table table = CreateTableWithHeading("Приобретенные товары:"); Row row = table.AddRow(); row.Height = 25; row.Borders.Bottom = new Border() { Width = "1pt", Color = Colors.DarkGray }; row.Cells[0].AddParagraph("Артикул:"); row.Cells[1].AddParagraph("Название:"); row.Cells[2].AddParagraph("Количество:"); row.Cells[3].AddParagraph("Цена:"); foreach (var od in _orderHeader.OrderDetails) { row = table.AddRow(); row.Height = 20; row.Cells[0].AddParagraph(od.VendorCode); row.Cells[1].AddParagraph(od.Furniture.Name); row.Cells[2].AddParagraph($"{od.Quantity} шт."); row.Cells[3].AddParagraph($"{(int)od.Furniture.Price} грн"); } row = table.AddRow(); row.Borders.Top = new Border() { Width = "1pt", Color = Colors.DarkGray }; // row = table.AddRow(); row.Borders.Bottom = new Border() { Width = "1pt", Color = Colors.DarkGray }; paragraph = row.Cells[3].AddParagraph(); FormattedText text = paragraph.AddFormattedText("Итог:", TextFormat.Bold); text.Color = Colors.Black; row.Height = 25; // row = table.AddRow(); row.Cells[3].AddParagraph($"{_orderHeader.GetSum()} грн"); paragraph = section.AddParagraph(); paragraph.AddLineBreaks(count: 4); paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Color.FromCmyk(100, 30, 20, 50); paragraph.AddTextLines( $"Дата: {DateTime.Now.ToString("d")}", $"Покупатель: {_orderHeader.AppUser.Name}"); paragraph.Format.Alignment = ParagraphAlignment.Right; paragraph = section.AddParagraph(); paragraph.AddLineBreaks(count: 2); paragraph.Format.Alignment = ParagraphAlignment.Center; paragraph.AddTextLines("Будем рады Вас видеть, FurnitureShop!"); }
private void CreateBidding(int nr) { Section section = document.LastSection; Paragraph tp = section.AddParagraph(); tp.AddLineBreak(); tp.AddLineBreak(); tp.AddFormattedText("LICYTACJA", font_tytuly); tp.AddLineBreak(); tp.AddLineBreak(); Table table = new Table(); table.Format.Font.Name = "Cambria"; table.Format.Font.Size = 8; table.Format.Alignment = ParagraphAlignment.Center; for (int i = 0; i < 4; i++) { Column col = table.AddColumn(Unit.FromCentimeter(bidding_szerokosckolumny)); col.Borders.Width = szerokosc_krawedzi; } Row row = table.AddRow(); row = CreateBidding_FirstRow(row); row = table.AddRow(); row = CreateBidding_Surname(row); row = table.AddRow(); int idx = 1; if (game.cztery_rece) { while (game.licytacja_[nr][idx] != null) { if ((idx - 1 + nr) % 4 == 0) { if (idx != 1) { row = table.AddRow(); } Paragraph p = row.Cells[(idx - 1 + nr) % 4].AddParagraph(); p = WriteOdzywka(p, game.licytacja_[nr][idx]); } else { Paragraph p = row.Cells[(idx - 1 + nr) % 4].AddParagraph(); p = WriteOdzywka(p, game.licytacja_[nr][idx]); } idx++; } } else { int test = 0; while (game.licytacja_[nr][idx] != null) { if ((idx - 1 + test) % 4 == 0) { if (idx != 1) { row = table.AddRow(); } Paragraph p = row.Cells[(idx - 1 + test) % 4].AddParagraph(); p = WriteOdzywka(p, game.licytacja_[nr][idx]); } else { Paragraph p = row.Cells[(idx - 1 + test) % 4].AddParagraph(); p = WriteOdzywka(p, game.licytacja_[nr][idx]); } idx++; } } table.Rows.Height = Unit.FromCentimeter(0.6); table.Rows.VerticalAlignment = VerticalAlignment.Center; table.SetEdge(0, 0, 4, 1, Edge.Box, BorderStyle.Single, 1.0, Colors.Black); /* * table[0, 4].Borders.Bottom.Width = 0; * table[0, 5].Borders.Bottom.Width = 0; * table[0, 4].Borders.Top.Width = 0; * table[0, 5].Borders.Top.Width = 0; * table[0, 4].Borders.Right.Width = 0; * table[0, 4].Shading.Color = Colors.White; * table[0, 5].Shading.Color = Colors.White; */ document.LastSection.Add(table); }
public static void CreatePage(Document document, string Name, string[,] data) { // Each MigraDoc document needs at least one section. Section section = document.AddSection(); // Put a logo in the header Image image = section.Headers.Primary.AddImage("../../PowerBooks.png"); image.Height = "2.5cm"; image.LockAspectRatio = true; image.RelativeVertical = RelativeVertical.Line; image.RelativeHorizontal = RelativeHorizontal.Margin; image.Top = ShapePosition.Top; image.Left = ShapePosition.Right; image.WrapFormat.Style = WrapStyle.Through; // Create footer Paragraph paragraph = section.Footers.Primary.AddParagraph(); paragraph.AddText("Na potoce 390/27 · Třebíč"); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center; // Create the text frame for the address TextFrame addressFrame = section.AddTextFrame(); addressFrame.Height = "3.0cm"; addressFrame.Width = "7.0cm"; addressFrame.Left = ShapePosition.Left; addressFrame.RelativeHorizontal = RelativeHorizontal.Margin; addressFrame.Top = "5.0cm"; addressFrame.RelativeVertical = RelativeVertical.Page; // Put sender in address frame paragraph = addressFrame.AddParagraph("Na potoce 390/27, Třebíč"); paragraph.Format.Font.Name = "Times New Roman"; paragraph.Format.Font.Size = 7; paragraph.Format.SpaceAfter = 3; // Add the print date field paragraph = section.AddParagraph(); paragraph.Format.SpaceBefore = "8cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText(Name, TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Třebíč, "); paragraph.AddDateField("dd.MM.yyyy"); if (data != null && data.GetLength(0) >= 2) { // Create the item table Table table = section.AddTable(); table.Style = "Table"; //table.Borders.Color = TableBorder; table.Borders.Width = 0.25; table.Borders.Left.Width = 0.5; table.Borders.Right.Width = 0.5; table.Rows.LeftIndent = 0; // Before you can add a row, you must define the columns Column column; for (int i = 0; i < data.GetLength(1); i++) { column = table.AddColumn(data[0, i]); column.Format.Alignment = ParagraphAlignment.Center; } // Create the header of the table Row row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; //row.Shading.Color = TableBlue; for (int i = 0; i < data.GetLength(1); i++) { row.Cells[i].AddParagraph(data[1, i]); row.Cells[i].Format.Alignment = ParagraphAlignment.Left; row.Cells[i].VerticalAlignment = VerticalAlignment.Bottom; } //row.Cells[0].MergeDown = 1; //row.Cells[1].MergeRight = 3; table.SetEdge(0, 0, data.GetLength(1), 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); // Fill Table for (int i = 2; i < data.GetLength(0); i++) { row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = false; for (int j = 0; j < data.GetLength(1); j++) { row.Cells[j].AddParagraph(data[i, j]); row.Cells[j].Format.Alignment = ParagraphAlignment.Left; row.Cells[j].VerticalAlignment = VerticalAlignment.Bottom; } } table.SetEdge(0, 0, data.GetLength(1), data.GetLength(0) - 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); } }
public void overtime_pays() { paragraph = section.AddParagraph(); paragraph.AddFormattedText("OVERTIME PAYS", TextFormat.Bold); paragraph = section.AddParagraph(); paragraph.Format.SpaceAfter = "0cm"; paragraph.AddFormattedText("Payroll Period: ", TextFormat.Bold); paragraph.AddFormattedText(dtFrom.ToString(" MMM dd yyyy ")); paragraph.AddFormattedText(" - ", TextFormat.Bold); paragraph.AddFormattedText(dtTo.ToString(" MMM dd yyyy")); paragraph.Format.SpaceAfter = "0.2cm"; Table table = section.AddTable(); table.Style = "Tables"; table.Borders.Width = "0.25"; table.Borders.Left.Width = 0.5; table.Borders.Right.Width = 0.5; table.Rows.LeftIndent = 0; // EMPLOYEE NO. Column column = table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Center; column.Shading.Color = Colors.DarkBlue; column.Format.Font.Color = Colors.White; // EMPLOYEE NAME column = table.AddColumn("8cm"); column.Format.Alignment = ParagraphAlignment.Center; column.Shading.Color = Colors.DarkBlue; column.Format.Font.Color = Colors.White; // REGULAR OVERTIME column = table.AddColumn("4cm"); column.Format.Alignment = ParagraphAlignment.Center; column.Shading.Color = Colors.DarkBlue; column.Format.Font.Color = Colors.White; //REGULAR REST DAY column = table.AddColumn("5cm"); column.Format.Alignment = ParagraphAlignment.Center; column.Shading.Color = Colors.DarkBlue; column.Format.Font.Color = Colors.White; //SPECIAL NON-WORKING HOLIDAY column = table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Center; column.Shading.Color = Colors.DarkBlue; column.Format.Font.Color = Colors.White; //REGULAR HOLIDAY column = table.AddColumn("3cm"); column.Format.Alignment = ParagraphAlignment.Center; column.Shading.Color = Colors.DarkBlue; column.Format.Font.Color = Colors.White; //REMARKS column = table.AddColumn("2.5cm"); column.Format.Alignment = ParagraphAlignment.Center; column.Shading.Color = Colors.DarkBlue; column.Format.Font.Color = Colors.White; Row row = table.AddRow(); row.HeadingFormat = true; row.Format.Alignment = ParagraphAlignment.Center; row.Format.Font.Bold = true; row.Cells[0].AddParagraph(""); row.Cells[0].Format.Font.Bold = true; row.Cells[0].Format.Font.Size = 8; row.Cells[0].Format.Alignment = ParagraphAlignment.Center; row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom; row.Cells[1].AddParagraph("Employee Name"); row.Cells[1].Format.Font.Bold = true; row.Cells[1].Format.Font.Size = 8; row.Cells[1].Format.Alignment = ParagraphAlignment.Center; row.Cells[1].VerticalAlignment = VerticalAlignment.Center; row.Cells[2].AddParagraph("Regular Overtime"); row.Cells[2].Format.Font.Bold = true; row.Cells[2].Format.Font.Size = 8; row.Cells[2].Format.Alignment = ParagraphAlignment.Center; row.Cells[2].VerticalAlignment = VerticalAlignment.Center; row.Cells[3].AddParagraph("Regular Rest Day"); row.Cells[3].Format.Font.Bold = true; row.Cells[3].Format.Font.Size = 8; row.Cells[3].Format.Alignment = ParagraphAlignment.Center; row.Cells[3].VerticalAlignment = VerticalAlignment.Center; row.Cells[4].AddParagraph("SPECIAL NON-WORKING HOLIDAY"); row.Cells[4].Format.Font.Bold = true; row.Cells[4].Format.Font.Size = 8; row.Cells[4].Format.Alignment = ParagraphAlignment.Center; row.Cells[4].VerticalAlignment = VerticalAlignment.Center; row.Cells[5].AddParagraph("REGULAR HOLIDAY"); row.Cells[5].Format.Font.Bold = true; row.Cells[5].Format.Font.Size = 8; row.Cells[5].Format.Alignment = ParagraphAlignment.Center; row.Cells[5].VerticalAlignment = VerticalAlignment.Center; row.Cells[6].AddParagraph("REMARKS"); row.Cells[6].Format.Font.Bold = true; row.Cells[6].Format.Font.Size = 8; row.Cells[6].Format.Alignment = ParagraphAlignment.Center; row.Cells[6].VerticalAlignment = VerticalAlignment.Center; Table table2 = section.AddTable(); table2.Style = "Tables"; table2.Borders.Width = "0.25"; table2.Borders.Left.Width = 0.5; table2.Borders.Right.Width = 0.5; table2.Rows.LeftIndent = 0; //EMPLOYEE NO COLUMN Column column1 = table2.AddColumn("2cm"); column1.Shading.Color = Colors.LightSteelBlue; column1.Format.Alignment = ParagraphAlignment.Center; //LAST NAME COLUMN column1 = table2.AddColumn("4cm"); column1.Format.Alignment = ParagraphAlignment.Center; //FIRST NAME COLUMN column1 = table2.AddColumn("4cm"); column1.Format.Alignment = ParagraphAlignment.Center; //REGULAR OVERTIME COLUMNS column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; //REGULAR REST DAY COLUMNS column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; //SPECIAL NON-WORKING HOLIDAY COLUMNS column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; //REGULAR HOLIDAY COLUMNS column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; column1 = table2.AddColumn("1cm"); column1.Format.Alignment = ParagraphAlignment.Center; //REMARKS COLUMN column1 = table2.AddColumn("2.5cm"); column1.Format.Alignment = ParagraphAlignment.Center; Row row2 = table2.AddRow(); //EMPLOYEE NO COLUMN NAME row2.Cells[0].AddParagraph(""); row2.Cells[0].Format.Font.Bold = true; row2.Cells[0].Format.Font.Size = 7; row2.Cells[0].Format.Alignment = ParagraphAlignment.Center; row2.Cells[0].VerticalAlignment = VerticalAlignment.Center; //EMPLOYEE LAST NAME COLUMN NAME row2.Cells[1].AddParagraph("Last Name"); row2.Cells[1].Format.Font.Bold = true; row2.Cells[1].Format.Font.Size = 7; row2.Cells[1].Format.Alignment = ParagraphAlignment.Center; row2.Cells[1].VerticalAlignment = VerticalAlignment.Center; //EMPLOYEE FIRST NAME COLUMN NAME row2.Cells[2].AddParagraph("First Name"); row2.Cells[2].Format.Font.Bold = true; row2.Cells[2].Format.Font.Size = 7; row2.Cells[2].Format.Alignment = ParagraphAlignment.Center; row2.Cells[2].VerticalAlignment = VerticalAlignment.Center; /////////////REGULAR OVERTIME COLUMNS///////// //1st 8 hrs row2.Cells[3].AddParagraph("1st 8 hrs"); row2.Cells[3].Format.Font.Bold = true; row2.Cells[3].Format.Font.Size = 7; row2.Cells[3].Format.Alignment = ParagraphAlignment.Center; row2.Cells[3].VerticalAlignment = VerticalAlignment.Center; //after 8 hrs row2.Cells[4].AddParagraph("after 8 hrs"); row2.Cells[4].Format.Font.Bold = true; row2.Cells[4].Format.Font.Size = 7; row2.Cells[4].Format.Alignment = ParagraphAlignment.Center; row2.Cells[4].VerticalAlignment = VerticalAlignment.Center; //OTHER OT row2.Cells[5].AddParagraph("OTHER OT"); row2.Cells[5].Format.Font.Bold = true; row2.Cells[5].Format.Font.Size = 7; row2.Cells[5].Format.Alignment = ParagraphAlignment.Center; row2.Cells[5].VerticalAlignment = VerticalAlignment.Center; // W/ NIGHT DIFF. row2.Cells[6].AddParagraph("w/ Night Diff."); row2.Cells[6].Format.Font.Bold = true; row2.Cells[6].Format.Font.Size = 7; row2.Cells[6].Format.Alignment = ParagraphAlignment.Center; row2.Cells[6].VerticalAlignment = VerticalAlignment.Center; /////////REGULAR REST DAY COLUMNS//////// //1st 8 hrs row2.Cells[7].AddParagraph("1st 8 hrs"); row2.Cells[7].Format.Font.Bold = true; row2.Cells[7].Format.Font.Size = 7; row2.Cells[7].Format.Alignment = ParagraphAlignment.Center; row2.Cells[7].VerticalAlignment = VerticalAlignment.Center; //after 8 hrs row2.Cells[8].AddParagraph("after 8 hrs"); row2.Cells[8].Format.Font.Bold = true; row2.Cells[8].Format.Font.Size = 7; row2.Cells[8].Format.Alignment = ParagraphAlignment.Center; row2.Cells[8].VerticalAlignment = VerticalAlignment.Center; //1st 8 hrs w/ ND row2.Cells[9].AddParagraph("1st 8 hrs w/ ND"); row2.Cells[9].Format.Font.Bold = true; row2.Cells[9].Format.Font.Size = 7; row2.Cells[9].Format.Alignment = ParagraphAlignment.Center; row2.Cells[9].VerticalAlignment = VerticalAlignment.Center; //after 8 hrs row2.Cells[10].AddParagraph("after 8 hrs"); row2.Cells[10].Format.Font.Bold = true; row2.Cells[10].Format.Font.Size = 7; row2.Cells[10].Format.Alignment = ParagraphAlignment.Center; row2.Cells[10].VerticalAlignment = VerticalAlignment.Center; //after 8 hrs w/ ND row2.Cells[11].AddParagraph("after 8 hrs w/ ND"); row2.Cells[11].Format.Font.Bold = true; row2.Cells[11].Format.Font.Size = 7; row2.Cells[11].Format.Alignment = ParagraphAlignment.Center; row2.Cells[11].VerticalAlignment = VerticalAlignment.Center; /////////SPECIAL NON-WORKING HOLIDAY//////// //1st 8 hrs row2.Cells[12].AddParagraph("1st 8 hrs"); row2.Cells[12].Format.Font.Bold = true; row2.Cells[12].Format.Font.Size = 7; row2.Cells[12].Format.Alignment = ParagraphAlignment.Center; row2.Cells[12].VerticalAlignment = VerticalAlignment.Center; // after 8 hrs row2.Cells[13].AddParagraph("after 8 hrs"); row2.Cells[13].Format.Font.Bold = true; row2.Cells[13].Format.Font.Size = 7; row2.Cells[13].Format.Alignment = ParagraphAlignment.Center; row2.Cells[13].VerticalAlignment = VerticalAlignment.Center; //after 8 hrs w/ ND row2.Cells[14].AddParagraph("after 8 hrs w/ ND"); row2.Cells[14].Format.Font.Bold = true; row2.Cells[14].Format.Font.Size = 7; row2.Cells[14].Format.Alignment = ParagraphAlignment.Center; row2.Cells[14].VerticalAlignment = VerticalAlignment.Center; /////////REGULAR HOLIDAY//////// //1st 8 hrs row2.Cells[15].AddParagraph("1st 8 hrs"); row2.Cells[15].Format.Font.Bold = true; row2.Cells[15].Format.Font.Size = 7; row2.Cells[15].Format.Alignment = ParagraphAlignment.Center; row2.Cells[15].VerticalAlignment = VerticalAlignment.Center; // after 8 hrs row2.Cells[16].AddParagraph("after 8 hrs"); row2.Cells[16].Format.Font.Bold = true; row2.Cells[16].Format.Font.Size = 7; row2.Cells[16].Format.Alignment = ParagraphAlignment.Center; row2.Cells[16].VerticalAlignment = VerticalAlignment.Center; //after 8 hrs w/ ND row2.Cells[17].AddParagraph("after 8 hrs w/ ND"); row2.Cells[17].Format.Font.Bold = true; row2.Cells[17].Format.Font.Size = 7; row2.Cells[17].Format.Alignment = ParagraphAlignment.Center; row2.Cells[17].VerticalAlignment = VerticalAlignment.Center; Row contents; for (int x = 0; x < num.Count(); x++) { contents = table2.AddRow(); if (num[x] == clsCluster.getClusterName(num[x])) { contents.Cells[0].AddParagraph(num[x]); contents.Cells[0].Format.Font.Bold = true; contents.Cells[0].Format.Font.Size = 7; contents.Cells[0].Format.Font.Color = Colors.Black; contents.Cells[0].Format.Alignment = ParagraphAlignment.Left; contents.Cells[0].VerticalAlignment = VerticalAlignment.Center; contents.Cells[0].Shading.Color = Colors.Aqua; } else { contents.Cells[0].AddParagraph(num[x]); contents.Cells[0].Format.Font.Bold = false; contents.Cells[0].Format.Font.Size = 7; contents.Cells[0].Format.Alignment = ParagraphAlignment.Left; contents.Cells[0].VerticalAlignment = VerticalAlignment.Center; } contents.Cells[1].AddParagraph(empLname[x]); contents.Cells[1].Format.Font.Bold = false; contents.Cells[1].Format.Font.Size = 7; contents.Cells[1].Format.Alignment = ParagraphAlignment.Left; contents.Cells[1].VerticalAlignment = VerticalAlignment.Center; contents.Cells[2].AddParagraph(empFname[x]); contents.Cells[2].Format.Font.Bold = false; contents.Cells[2].Format.Font.Size = 7; contents.Cells[2].Format.Alignment = ParagraphAlignment.Left; contents.Cells[2].VerticalAlignment = VerticalAlignment.Center; contents.Cells[3].AddParagraph(reg_ot_1st_8hrs[x]); contents.Cells[3].Format.Font.Bold = false; contents.Cells[3].Format.Font.Size = 7; contents.Cells[3].Format.Alignment = ParagraphAlignment.Left; contents.Cells[3].VerticalAlignment = VerticalAlignment.Center; contents.Cells[4].AddParagraph(reg_ot_aft_8hrs[x]); contents.Cells[4].Format.Font.Bold = false; contents.Cells[4].Format.Font.Size = 7; contents.Cells[4].Format.Alignment = ParagraphAlignment.Left; contents.Cells[4].VerticalAlignment = VerticalAlignment.Center; contents.Cells[5].AddParagraph(reg_ot_other_ot[x]); contents.Cells[5].Format.Font.Bold = false; contents.Cells[5].Format.Font.Size = 7; contents.Cells[5].Format.Alignment = ParagraphAlignment.Left; contents.Cells[5].VerticalAlignment = VerticalAlignment.Center; contents.Cells[6].AddParagraph(reg_ot_ND[x]); contents.Cells[6].Format.Font.Bold = false; contents.Cells[6].Format.Font.Size = 7; contents.Cells[6].Format.Alignment = ParagraphAlignment.Left; contents.Cells[6].VerticalAlignment = VerticalAlignment.Center; contents.Cells[7].AddParagraph(reg_rest_1st_8hrs[x]); contents.Cells[7].Format.Font.Bold = false; contents.Cells[7].Format.Font.Size = 7; contents.Cells[7].Format.Alignment = ParagraphAlignment.Left; contents.Cells[7].VerticalAlignment = VerticalAlignment.Center; contents.Cells[8].AddParagraph(reg_rest_aft_8hrs[x]); contents.Cells[8].Format.Font.Bold = false; contents.Cells[8].Format.Font.Size = 7; contents.Cells[8].Format.Alignment = ParagraphAlignment.Left; contents.Cells[8].VerticalAlignment = VerticalAlignment.Center; contents.Cells[9].AddParagraph(reg_rest_1st_8hrs_ND[x]); contents.Cells[9].Format.Font.Bold = false; contents.Cells[9].Format.Font.Size = 7; contents.Cells[9].Format.Alignment = ParagraphAlignment.Left; contents.Cells[9].VerticalAlignment = VerticalAlignment.Center; contents.Cells[10].AddParagraph(reg_rest_aft_8hrs_2[x]); contents.Cells[10].Format.Font.Bold = false; contents.Cells[10].Format.Font.Size = 7; contents.Cells[10].Format.Alignment = ParagraphAlignment.Left; contents.Cells[10].VerticalAlignment = VerticalAlignment.Center; contents.Cells[11].AddParagraph(reg_rest_aft_8hrs_ND[x]); contents.Cells[11].Format.Font.Bold = false; contents.Cells[11].Format.Font.Size = 7; contents.Cells[11].Format.Alignment = ParagraphAlignment.Left; contents.Cells[11].VerticalAlignment = VerticalAlignment.Center; contents.Cells[12].AddParagraph(spech_1st_8hrs[x]); contents.Cells[12].Format.Font.Bold = false; contents.Cells[12].Format.Font.Size = 7; contents.Cells[12].Format.Alignment = ParagraphAlignment.Left; contents.Cells[12].VerticalAlignment = VerticalAlignment.Center; contents.Cells[13].AddParagraph(spech_aft_8hrs[x]); contents.Cells[13].Format.Font.Bold = false; contents.Cells[13].Format.Font.Size = 7; contents.Cells[13].Format.Alignment = ParagraphAlignment.Left; contents.Cells[13].VerticalAlignment = VerticalAlignment.Center; contents.Cells[14].AddParagraph(spech_aft_8hrs_ND[x]); contents.Cells[14].Format.Font.Bold = false; contents.Cells[14].Format.Font.Size = 7; contents.Cells[14].Format.Alignment = ParagraphAlignment.Left; contents.Cells[14].VerticalAlignment = VerticalAlignment.Center; contents.Cells[15].AddParagraph(regh_1st_8hrs[x]); contents.Cells[15].Format.Font.Bold = false; contents.Cells[15].Format.Font.Size = 7; contents.Cells[15].Format.Alignment = ParagraphAlignment.Left; contents.Cells[15].VerticalAlignment = VerticalAlignment.Center; contents.Cells[16].AddParagraph(regh_aft_8hrs[x]); contents.Cells[16].Format.Font.Bold = false; contents.Cells[16].Format.Font.Size = 7; contents.Cells[16].Format.Alignment = ParagraphAlignment.Left; contents.Cells[16].VerticalAlignment = VerticalAlignment.Center; contents.Cells[17].AddParagraph(regh_aft_8hrs_ND[x]); contents.Cells[17].Format.Font.Bold = false; contents.Cells[17].Format.Font.Size = 7; contents.Cells[17].Format.Alignment = ParagraphAlignment.Left; contents.Cells[17].VerticalAlignment = VerticalAlignment.Center; contents.Cells[18].AddParagraph(""); contents.Cells[18].Format.Font.Bold = false; contents.Cells[18].Format.Font.Size = 7; contents.Cells[18].Format.Alignment = ParagraphAlignment.Left; contents.Cells[18].VerticalAlignment = VerticalAlignment.Center; } }