public static void DefCover(Document document) { Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); var image = paragraph.AddImage($"images/1.jpg"); image.Width = "6cm"; image.Height = "3cm"; paragraph.Format.SpaceAfter = "-3cm"; paragraph.Format.SpaceBefore = "-2cm"; paragraph.Format.Borders.Bottom = new Border { Width = "2pt", Color = Colors.DarkGray }; paragraph = section.AddParagraph("Energy Service Report", "Zero"); paragraph.Format.Font.Color = Colors.DarkBlue; paragraph.Format.Font.Size = 22; paragraph.Format.Font.Bold = true; paragraph.Format.LeftIndent = "7cm"; paragraph = section.AddParagraph("Cordium: Real-time heat control", "Zero"); paragraph.Format.Font.Color = Colors.LightBlue; paragraph.Format.SpaceBefore = "1cm"; paragraph.Format.LeftIndent = "7cm"; paragraph.Format.Font.Size = 18; paragraph = section.AddParagraph("Period:", "Title"); paragraph = section.AddParagraph(); var data = paragraph.AddDateField(); data.Format = "MM, yyyy"; paragraph.Format.Font.Size = 16; paragraph.Format.SpaceBefore = "-1.3cm"; paragraph.Format.Alignment = ParagraphAlignment.Right; ProjectDetails(section); ExecutiveSum(section); ProjectOverview(section); }
/// <summary> /// Defines the cover page. /// </summary> public static void DefineCover(Document document, Project currentProject) { try { Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceAfter = "3cm"; Image image = section.AddImage(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\\logo.jpg"); image.Width = "6cm"; paragraph = section.AddParagraph("Report generated using Cameratrap Manager\nfor the project:\n" + currentProject.Name); paragraph.Format.Font.Size = 16; paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceBefore = "6cm"; paragraph.Format.SpaceAfter = "3cm"; paragraph = section.AddParagraph("Creation date: " + currentProject.StartDate.ToString()); paragraph = section.AddParagraph("Last modified: " + currentProject.CompletionDate.ToString()); paragraph = section.AddParagraph("Rendering date: "); paragraph.AddDateField(); } catch (Exception ex) { throw ex; } }
private void CreateHeader() { // Create the text frame for the address headerFrame = section.AddTextFrame(); headerFrame.Height = "1.0cm"; headerFrame.Width = "7.0cm"; headerFrame.Left = ShapePosition.Left; headerFrame.RelativeHorizontal = RelativeHorizontal.Margin; headerFrame.Top = "1.0cm"; headerFrame.RelativeVertical = RelativeVertical.Page; // Put sender in address frame Paragraph paragraph = headerFrame.AddParagraph(Definition.Title.Text); paragraph.Style = "Reference"; 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 = "1cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText(Definition.SubTitle.Text, TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Beep Reports, "); paragraph.AddDateField("dd.MM.yyyy"); }
static void DefineContentSection(Document document) { var section = document.AddSection(); section.PageSetup.OddAndEvenPagesHeaderFooter = false; section.PageSetup.StartingNumber = 1; //HeaderFooter header = section.Headers.Primary; //header.AddParagraph("\tOdd Page Header"); //header = section.Headers.EvenPage; //header.AddParagraph("Even Page Header"); // Create a paragraph with centered page number. See definition of style "Footer". var paragraph = new Paragraph(); paragraph.AddDateField(); paragraph.AddTab(); paragraph.AddPageField(); // Add paragraph to footer for odd pages. section.Footers.Primary.Add(paragraph); //// Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must //// not belong to more than one other object. If you forget cloning an exception is thrown. //section.Footers.EvenPage.Add(paragraph.Clone()); }
/// <summary> /// Defines page setup, headers, and footers /// </summary> /// <param name="document">MigraDoc document created via Documents.CreateDocument()</param> public static void DefineContentSection(Document document) { Section section = document.AddSection(); section.PageSetup.TopMargin = "5cm"; section.PageSetup.StartingNumber = 1; section.PageSetup.Orientation = Orientation.Landscape; // Create header HeaderFooter header = section.Headers.Primary; // Add logo Image image = header.AddImage(Report.logoPath); image.Width = "8cm"; image.WrapFormat.Style = WrapStyle.Through; // Add company name Paragraph h1 = new Paragraph(); h1.AddText(Report.companyName); h1.Format.Font.Color = Colors.SlateGray; h1.Format.Font.Size = 24; h1.Format.Font.Bold = true; header.Add(h1); // Add report name Paragraph h2 = new Paragraph(); h2.Format.Font.Color = Colors.SlateGray; h2.AddText("Welfare Check Breach Report"); h2.Format.Font.Size = 18; h2.Format.Borders.Width = 0; h2.Format.Borders.Bottom.Width = 1; h2.Format.Borders.Color = Colors.LightSlateGray; h2.Format.Borders.Distance = 4; header.Add(h2); // Add current date Paragraph h3 = new Paragraph(); h3.Format.Font.Size = 12; h3.Format.Font.Italic = true; h3.Format.Borders.Distance = 6; h3.AddDateField(); header.Add(h3); // Create a paragraph with centered page number. See definition of style "Footer". Paragraph footer = new Paragraph(); footer.Format.Borders.Width = 0; footer.Format.Borders.Top.Width = 1; footer.Format.Borders.Color = Colors.LightSlateGray; footer.Format.Borders.Distance = 10; footer.AddPageField(); // Add paragraph to footer section.Footers.Primary.Add(footer); }
protected void CreatePage() { // Each MigraDoc document needs at least one section. Section currentSection = this._document.LastSection; if (currentSection == null) { currentSection = this._document.AddSection(); } else { currentSection.AddPageBreak(); } this._pageNumber += 1; // Put a logo in the header Image image = currentSection.Headers.Primary.AddImage(this._info.LogoPath); 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 = currentSection.Footers.Primary.AddParagraph(); paragraph.AddText(CompanyABC.Utility.PDFReportGeneration.Constants.CompanyInfo.COMPANY_FOOTER); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center; // Add the print date field paragraph = currentSection.AddParagraph(); paragraph.Format.SpaceBefore = "2cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText("EXPORTED RESULTS", TextFormat.Bold); paragraph.AddTab(); paragraph.AddTab(); paragraph.AddTab(); paragraph.AddTab(); paragraph.AddText("Date Generated: "); paragraph.AddDateField("MM-dd-yyyy"); // Create the item table this._table = currentSection.AddTable(); this._table.Style = "Table"; this._table.Borders.Color = CompanyABC.Utility.PDFReportGeneration.Constants.ColorScheme.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; }
/// <summary> /// define the header content of the healthcare-form /// </summary> /// <param name="name">the name of the person</param> /// <param name="taj">the taj-number of the person</param> private void adjustHeader(SetOfUserDetails userDet) { string headerText1 = "Kémiai-egészségügyi adatlap"; string headerText2 = userDet.userLastName + " " + userDet.userFirstName + " TAJ-szám: " + userDet.userTaj; thePage = new Section(); thePage = doc.AddSection(); paragraph = thePage.Headers.FirstPage.AddParagraph(); //this is a problematic line!! paragraph = thePage.AddParagraph(); paragraph.AddFormattedText(headerText1, StyleNames.Header); paragraph.AddLineBreak(); paragraph.AddFormattedText(headerText2, StyleNames.Header); paragraph.AddLineBreak(); paragraph.AddFormattedText("Nyomtatás ideje: ", StyleNames.Header); paragraph.AddDateField(); paragraph.AddLineBreak(); paragraph.AddLineBreak(); }
/// <summary> /// define the header content of the healthcare-form /// </summary> /// <param name="name">the name of the person</param> /// <param name="taj">the taj-number of the person</param> private void adjustHeader(SetOfUserDetails userDet) { string headerText1 = "Rendelési lista"; string headerText2 = userDet.userLastName + " " + userDet.userFirstName + " Beosztás: " + userDet.userPosition; thePage = new Section(); thePage = doc.AddSection(); paragraph = thePage.Headers.FirstPage.AddParagraph(); //this is a problematic line!! paragraph = thePage.AddParagraph(); paragraph.AddFormattedText(headerText1, StyleNames.Header); paragraph.AddLineBreak(); paragraph.AddFormattedText(headerText2, StyleNames.Header); paragraph.AddLineBreak(); paragraph.AddFormattedText("Nyomtatás ideje: ", StyleNames.Header); paragraph.AddDateField(); paragraph.AddLineBreak(); paragraph.AddLineBreak(); }
/// Defines the cover page. DONE static void DefineCover(Document document) { Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph("Cover Sheet", "Hidden"); paragraph.Format.OutlineLevel = OutlineLevel.Level1; paragraph.Format.SpaceAfter = "3cm"; // adding the LOGO Image image = section.AddImage("NorcoLogo.png"); image.Width = "10cm"; image.Left = ShapePosition.Center; // report title paragraph = section.AddParagraph("Battery Resistance Testing Report"); paragraph.Format.Alignment = ParagraphAlignment.Center; paragraph.Format.Font.Size = 30; paragraph.Format.Font.Color = Colors.Black; paragraph.Format.Font.Bold = true; paragraph.Format.Font.Underline = Underline.Single; paragraph.Format.SpaceBefore = "3cm"; paragraph.Format.SpaceAfter = "1cm"; // test location paragraph = section.AddParagraph(currentResult.location); paragraph.Format.Alignment = ParagraphAlignment.Center; paragraph.Format.Font.Size = 22; paragraph.Format.Font.Color = Colors.Black; paragraph.Format.SpaceBefore = "3cm"; paragraph.Format.SpaceAfter = "1cm"; // test battery system paragraph = section.AddParagraph(currentResult.batteryName); paragraph.Format.Alignment = ParagraphAlignment.Center; paragraph.Format.Font.Size = 22; paragraph.Format.Font.Color = Colors.Black; //paragraph.Format.SpaceBefore = "3cm"; paragraph.Format.SpaceAfter = "5cm"; paragraph = section.AddParagraph("Report Generated on : "); paragraph.AddDateField(); }
/// <summary> /// Defines the cover page. /// </summary> public static void DefineCover(Document document) { Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceAfter = "3cm"; //Image image = section.AddImage("../../images/Logo landscape.png"); //image.Width = "10cm"; paragraph = section.AddParagraph(" Data Migration \n list Notes Summary"); paragraph.Format.Font.Size = 16; paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceBefore = "8cm"; paragraph.Format.SpaceAfter = "3cm"; paragraph = section.AddParagraph("Rendering date: "); paragraph.AddDateField(); }
public static void Fields(string outputFile) { Document document = new Document(); Section section = document.AddSection(); Paragraph par = section.AddParagraph(); par.AddText("Section: "); par.AddSectionField().Format = "ALPHABETIC"; par.AddLineBreak(); par.AddText("SectionPages: "); par.AddSectionField().Format = "alphabetic"; par.AddLineBreak(); par.AddText("Page: "); par.AddPageField().Format = "ROMAN"; par.AddLineBreak(); par.AddText("NumPages: "); par.AddNumPagesField(); par.AddLineBreak(); par.AddText("Date: "); par.AddDateField(); par.AddLineBreak(); par.AddText("Bookmark: "); par.AddBookmark("Egal"); par.AddLineBreak(); par.AddText("PageRef: "); par.AddPageRefField("Egal"); PdfDocumentRenderer printer = new PdfDocumentRenderer() { Document = document }; printer.RenderDocument(CancellationToken.None); printer.PdfDocument.Save(outputFile); }
private void DefineCover(Document document) { Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceAfter = "3cm"; Image image = section.AddImage($"{_imagesPath}\\logo.jpg"); image.Width = "4cm"; paragraph = section.AddParagraph("A sample document that demonstrates the\ncapabilities of MigraDoc"); paragraph.Format.Font.Size = 16; paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceBefore = "8cm"; paragraph.Format.SpaceAfter = "3cm"; paragraph = section.AddParagraph("Rendering date: "); paragraph.AddDateField(); }
private void DefineCover(Document document, PdfData pdfData) { Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceAfter = "3cm"; Image image = section.AddImage($"{_imagesPath}\\logo.png"); image.Width = "4cm"; paragraph = section.AddParagraph("Career Development Plan document for " + pdfData.User.Name); paragraph.Format.Font.Size = 18; paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceBefore = "2cm"; paragraph.Format.SpaceAfter = "10cm"; paragraph = section.AddParagraph("Auto Generate Date: "); paragraph.AddDateField(); }
private void SetHeader(ref Section section) { TextFrame frame1 = section.Headers.Primary.AddTextFrame(); frame1.RelativeVertical = RelativeVertical.Page; frame1.Left = ShapePosition.Left; frame1.MarginTop = new Unit(1, UnitType.Centimeter); frame1.Width = new Unit(10, UnitType.Centimeter); TextFrame frame2 = section.Headers.Primary.AddTextFrame(); frame2.RelativeVertical = RelativeVertical.Page; frame2.Left = ShapePosition.Right; frame2.MarginTop = new Unit(1, UnitType.Centimeter); frame2.Width = new Unit(2, UnitType.Centimeter); Paragraph p = frame1.AddParagraph(); p.AddFormattedText(CurrentRequestData.CurrentSite.Name, TextFormat.Bold); p = frame2.AddParagraph(); p.AddDateField("dd/MM/yyyy"); }
// [UnitTestFunction] public static void TestFields() { Document doc = new Document(); doc.Info.Author = "K.P."; Section sec = doc.Sections.AddSection(); Paragraph par = sec.AddParagraph(); par.AddBookmark("myBookmark1"); PageRefField prf = par.AddPageRefField("myBookmark1"); prf.Format = "ALPHABETIC"; PageField pf = par.AddPageField(); pf.Format = "ROMAN"; SectionField sf = par.AddSectionField(); sf.Format = "roman"; SectionPagesField spf = par.AddSectionPagesField(); spf.Format = "roman"; NumPagesField npf = par.AddNumPagesField(); npf.Format = "alphabetic"; InfoField inf = par.AddInfoField(InfoFieldType.Author); DateField df = par.AddDateField("D"); df = par.AddDateField("d"); df = par.AddDateField("s"); df = par.AddDateField("r"); df = par.AddDateField("G"); df = par.AddDateField("dddd dd.MM.yyyy"); DocumentRenderer docRndrr = new DocumentRenderer(); docRndrr.Render(doc, "RtfFields.txt", null); File.Copy("RtfFields.txt", "RtfFields.rtf", true); System.Diagnostics.Process.Start("RtfFields.txt"); }
// create the details for the main cover sheet of the report void CreateCoverSheet(Document doc, TestResult testResult) { Section section = doc.AddSection(); Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceAfter = "1cm"; Image image = section.AddImage("NorcoLogo.png"); image.Width = "8cm"; paragraph = section.AddParagraph("Battery Resistance Testing DataSet for :"); paragraph.Format.Font.Size = 16; paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceBefore = "3cm"; paragraph.Format.SpaceAfter = "1cm"; paragraph = section.AddParagraph(testResult.location + ", " + testResult.batteryName); paragraph.Format.Font.Size = 12; paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceAfter = "5cm"; paragraph = section.AddParagraph("Rendering date: "); paragraph.AddDateField(); }
/// <summary> /// Defines the cover page. /// </summary> public static void DefineCover(Document document) { Section section = document.AddSection(); Paragraph paragraph = section.AddParagraph(); paragraph.Format.SpaceAfter = "3cm"; var workingPath = Directory.GetCurrentDirectory(); var filePath = Path.Combine(workingPath, "logo_landscape.png"); Image image = section.AddImage(filePath); image.Width = "10cm"; paragraph = section.AddParagraph("A sample document that demonstrates the\ncapabilities of MigraDoc"); paragraph.Format.Font.Size = 16; paragraph.Format.Font.Color = Colors.DarkRed; paragraph.Format.SpaceBefore = "8cm"; paragraph.Format.SpaceAfter = "3cm"; paragraph = section.AddParagraph("Rendering date: "); paragraph.AddDateField(); }
void CreatePage() { // Each MigraDoc document needs at least one section. Section section = this.document.AddSection(); // Put a logo in the header Image iqimage = section.AddImage(IqLogo); iqimage.Top = ShapePosition.Top; iqimage.Left = ShapePosition.Left; iqimage.WrapFormat.Style = WrapStyle.Through; Image ciLogo = section.AddImage(cilogo); ciLogo.Top = ShapePosition.Top; ciLogo.Left = ShapePosition.Right; ciLogo.WrapFormat.Style = WrapStyle.Through; // Create footer Paragraph paragraph = section.Footers.Primary.AddParagraph(); paragraph.AddText(CompanyName); 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.Left; this.addressFrame.RelativeHorizontal = RelativeHorizontal.Margin; this.addressFrame.Top = "5.0cm"; this.addressFrame.RelativeVertical = RelativeVertical.Page; // Put sender in address frame paragraph = this.addressFrame.AddParagraph(Address); 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 = "6cm"; paragraph.Style = "Reference"; paragraph.AddFormattedText("Question Information", TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Date, "); 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; int j = 0; // Before you can add a row, you must define the columns Column column; foreach (DataColumn col in dt.Columns) { if (j == 0) { column = this.table.AddColumn(Unit.FromCentimeter(1)); } else if (j == 1) { column = this.table.AddColumn(Unit.FromCentimeter(4)); } else if (j == 2) { column = this.table.AddColumn(Unit.FromCentimeter(7)); } else { column = this.table.AddColumn(Unit.FromCentimeter(4)); } column.Format.Alignment = ParagraphAlignment.Center; j++; } // 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 < dt.Columns.Count; i++) { row.Cells[i].AddParagraph(dt.Columns[i].ColumnName); row.Cells[i].Format.Font.Bold = false; row.Cells[i].Format.Alignment = ParagraphAlignment.Left; row.Cells[i].VerticalAlignment = VerticalAlignment.Bottom; } this.table.SetEdge(0, 0, dt.Columns.Count, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); }
void CreatePage() { // Each MigraDoc document needs at least one section. Section section = document.AddSection(); // Create footer Paragraph paragraph = section.Footers.Primary.AddParagraph(); paragraph.AddText("PowerBooks Inc · Sample Street 42 · 56789 Cologne · Germany"); 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; // Put sender in address frame paragraph = addressFrame.AddParagraph("PowerBooks Inc · Sample Street 42 · 56789 Cologne"); 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("INVOICE", TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Cologne, "); paragraph.AddDateField("dd.MM.yyyy"); // Create the item table table = section.AddTable(); table.Style = "Table"; table.Borders.Color = Color.Empty; 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("3cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("3.5cm"); column.Format.Alignment = ParagraphAlignment.Right; column = table.AddColumn("2cm"); column.Format.Alignment = ParagraphAlignment.Center; column = 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 = Color.Empty; 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 = Color.Empty; 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; table.SetEdge(0, 0, 6, 2, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); }
private Document createPage(Document doc, TextFrame addressFrame, Table table) { Section section = doc.AddSection(); /* * // Put a logo in the header TODO ako stignes * 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(POLICY_NAME); paragraph.Format.Font.Size = 10; 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; // Put sender in address frame paragraph = addressFrame.AddParagraph(POLICY_NAME + " · Trg sveprisutnih 1 · 21000 Novi Sad"); 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("POLISA", TextFormat.Bold); paragraph.AddTab(); paragraph.AddText("Subotica, "); paragraph.AddDateField("dd.MM.yyyy"); // Create the item table table = section.AddTable(); table.Style = "Table"; table.Borders.Color = new Color(81, 125, 192); 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("1.5cm");//broj stavke column.Format.Alignment = ParagraphAlignment.Center; column = table.AddColumn("11cm");//stavka - Ime, prezime, JMBG, broj pasosa column.Format.Alignment = ParagraphAlignment.Center; column = table.AddColumn("3.5cm");//cena 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 = new Color(235, 240, 249); row.Cells[0].AddParagraph("Broj"); 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("Stavka"); row.Cells[1].Format.Alignment = ParagraphAlignment.Left; //row.Cells[1].MergeRight = 3; row.Cells[2].AddParagraph("Cena"); row.Cells[2].Format.Alignment = ParagraphAlignment.Left; row.Cells[2].VerticalAlignment = VerticalAlignment.Bottom; //row.Cells[2].MergeDown = 1; table.SetEdge(0, 0, 6, 2, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); return(doc); }