Beispiel #1
0
        private void PageSettings(Section section)
        {
            Paragraph naglowek = section.Headers.Primary.AddParagraph();

            naglowek.Format.Font.Underline = Underline.Single;
            //  vugraph.tytul = "EJCH";
            naglowek.AddFormattedText("European Youth Bridge Championship");
            // string tekst = vugraph.tytul;

            //   if (tekst.Count() > 40)
            //        tekst = tekst.Substring(0, 40);

            naglowek.AddSpace(5);
            naglowek.AddImage("images\\mini_b24dwa.jpg");
            naglowek.AddSpace(10);
            naglowek.AddFormattedText(game.data.ToShortDateString());

            Paragraph stopka = section.Footers.Primary.AddParagraph();

            stopka.Format.Borders.Top.Width = Unit.FromCentimeter(0.1);
            stopka.AddFormattedText(mail);
            stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab();
            stopka.Format.Alignment = ParagraphAlignment.Justify;
            stopka.AddFormattedText("Strona ");
            stopka.AddPageField();
            stopka.AddFormattedText(" z " + (Ustawienia.ilosc_rozdan + 2).ToString());
        }
Beispiel #2
0
        private Paragraph Organisation(CompetitionInfosViewModel zusatzInfos)
        {
            Paragraph paragraph = new Paragraph();

            var ft = paragraph.AddFormattedText($"{Resources.LanguageFiles.DictPluginMain.Organization}:", TextFormat.Bold);

            ft.Underline = Underline.Single;
            paragraph.AddLineBreak();

            paragraph.AddFormattedText("Protokoll: ", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText(zusatzInfos.Protokollfuehrer);
            paragraph.AddLineBreak();

            paragraph.AddFormattedText("Punktzettel: ", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText(zusatzInfos.ErgebnislistenSchreiber);

            foreach (var ordner in zusatzInfos.Ordner)
            {
                paragraph.AddLineBreak();
                paragraph.AddFormattedText("Ordner: ", TextFormat.Bold);
                paragraph.AddTab();
                paragraph.AddText(ordner);
            }

            return(paragraph);
        }
Beispiel #3
0
        private void PageSettings(Section section)
        {
            Paragraph naglowek = section.Headers.Primary.AddParagraph();

            naglowek.Format.Font.Underline = Underline.Single;

            naglowek.AddFormattedText("Trening licytacyjny");


            naglowek.AddSpace(22);
            naglowek.AddImage("images\\mini_b24dwa.jpg");
            naglowek.AddSpace(15);
            naglowek.AddFormattedText(DateTime.Now.ToShortDateString());


            Paragraph stopka = section.Footers.Primary.AddParagraph();

            stopka.Format.Borders.Top.Width = Unit.FromCentimeter(0.1);
            stopka.AddFormattedText(mail);
            stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab();
            stopka.AddSpace(4);
            stopka.Format.Alignment = ParagraphAlignment.Justify;
            stopka.AddFormattedText("Strona ");
            stopka.AddPageField();
            stopka.AddFormattedText(" z " + (Ustawienia.ilosc_rozdan + 1).ToString());
        }
Beispiel #4
0
        private void PageSettings(Section section)
        {
            Paragraph naglowek = section.Headers.Primary.AddParagraph();

            naglowek.Format.Font.Underline = Underline.Single;

            naglowek.AddFormattedText(vugraph1.tytul);
            string tekst = vugraph1.tytul;

            if (tekst.Count() > 40)
            {
                tekst = tekst.Substring(0, 40);
            }

            naglowek.AddSpace(40 - vugraph1.tytul.Count());
            naglowek.AddImage("images\\mini_b24dwa.jpg");
            naglowek.AddSpace(15);
            naglowek.AddFormattedText(DateTime.Now.ToShortDateString());


            Paragraph stopka = section.Footers.Primary.AddParagraph();

            stopka.Format.Borders.Top.Width = Unit.FromCentimeter(0.1);
            stopka.AddFormattedText(mail);
            stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab(); stopka.AddTab();
            stopka.AddSpace(4);
            stopka.Format.Alignment = ParagraphAlignment.Justify;
            stopka.AddFormattedText("Strona ");
            stopka.AddPageField();
            stopka.AddFormattedText(" z " + (Ustawienia.ilosc_rozdan + 1).ToString());
        }
        void SetHeaderText(string header)
        {
            Paragraph paragraph = m_document?.LastSection.Headers.Primary.AddParagraph("");

            paragraph.AddTab();
            paragraph.AddText(header);
            paragraph = m_document?.LastSection.Headers.EvenPage.AddParagraph("");
            paragraph.AddTab();
            paragraph.AddText(header);
        }
Beispiel #6
0
        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;
        }
Beispiel #7
0
        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");
        }
Beispiel #8
0
        /// <summary>
        /// Defines page setup, headers, and footers.
        /// </summary>
        static void DefineContentSection(Document document)
        {
            Section section = document.AddSection();

            section.PageSetup.OddAndEvenPagesHeaderFooter = true;
            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".
            Paragraph paragraph = new Paragraph();

            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());
        }
Beispiel #9
0
        static void section(Document document)
        {
            Section section = document.AddSection();

            section.PageSetup.OddAndEvenPagesHeaderFooter = true;
            section.PageSetup.StartingNumber = 1;


            Table table = new Table();

            table.Borders.Width = 0.2;

            Column column = table.AddColumn(Unit.FromCentimeter(2));

            column = table.AddColumn(Unit.FromCentimeter(4));
            column = table.AddColumn(Unit.FromCentimeter(4));
            column = table.AddColumn(Unit.FromCentimeter(4));


            column.Format.Alignment = ParagraphAlignment.Center;

            table.AddColumn(Unit.FromCentimeter(4));

            Paragraph paragraph = new Paragraph();

            paragraph.AddTab();
            paragraph.AddPageField();

            section.Footers.Primary.Add(table);
        }
Beispiel #10
0
        public static Paragraph etiquetaYValor(string etiqueta, string valor)
        {
            Paragraph parrafo = new Paragraph();

            parrafo.Style = "Texto";
            parrafo.AddFormattedText(etiqueta + ":", "Texto Negrita");
            parrafo.AddTab();
            parrafo.AddText(valor);
            return(parrafo);
        }
        /// <summary>
        /// Defines page setup, headers, and footers.
        /// </summary>
        private void DefineContentSection(Document document, Report report)
        {
            Section section = document.AddSection();

            section.PageSetup.OddAndEvenPagesHeaderFooter = true;
            section.PageSetup.StartingNumber = 1;
            section.PageSetup.Orientation    = (this.Landscape ? Orientation.Landscape : Orientation.Portrait);

            HeaderFooter header = section.Headers.Primary;

            header.AddParagraph(report.TextFields.Footer);

            header = section.Headers.EvenPage;
            header.AddParagraph(report.TextFields.Footer);

            // Create a paragraph with centered page number. See definition of style "Footer".
            Paragraph paragraph = new Paragraph();

            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());

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment  = ParagraphAlignment.Center;
            paragraph.Format.Font.Bold  = true;
            paragraph.Format.Font.Color = Colors.DarkBlue;
            paragraph.Format.Font.Size  = 14;
            paragraph.AddText(report.TextFields.Title);

            paragraph = document.LastSection.AddParagraph();
            paragraph.AddText("");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment  = ParagraphAlignment.Center;
            paragraph.Format.Font.Bold  = true;
            paragraph.Format.Font.Size  = 12;
            paragraph.Format.Font.Color = Colors.DarkBlue;
            paragraph.AddText(report.TextFields.SubTitle);

            paragraph = document.LastSection.AddParagraph();
            paragraph.AddText("");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.Format.Font.Bold = true;
            paragraph.AddText(report.TextFields.Header);

            paragraph = document.LastSection.AddParagraph();
            paragraph.AddText("");
        }
Beispiel #12
0
        static void ProjectOverview(Section section)
        {
            var paragraph = section.AddParagraph("Project Overview", "Title");

            paragraph = section.AddParagraph("Theadvanced control strategy is implemented in a district heating system for social housing in Crutzestraat, Hasselt. " +
                                             "Thesocial 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 areinterconnected by an" +
                                             "internal heat transfer network.i.Leco developed thecontrol strategy which sends hourly setpoints fo: maximum and" +
                                             "minimum temperaturesetpoint in each building and/or distribution circuit, operation modes of installed technologies," +
                                             "and distribution statesettings between building/heating systems", "Zero");
            section.PageSetup.DifferentFirstPageHeaderFooter = false;
            section.Footers.Primary.AddParagraph("i.Leco © 29/01/2021");
            var number = new Paragraph();

            number.AddTab();
            number.AddTab();
            number.AddPageField();
            section.Footers.Primary.Add(number);
        }
Beispiel #13
0
        private Paragraph zrob_kolor(int idx, Paragraph p, string karty)
        {
            p.AddLineBreak();
            p.AddTab(); p.AddSpace(5);

            p.AddFormattedText(suits[idx].ToString(), znaki_kart[idx]);


            p.AddText(" " + karty);

            return(p);
        }
Beispiel #14
0
        void CreateBodyPrintDate(Section section)
        {
            // Add the print date field
            Paragraph paragraph = section.AddParagraph();

            paragraph.Format.SpaceBefore = "8cm";
            paragraph.Style = "Reference";
            paragraph.AddFormattedText("INVOICE", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText("Cologne, ");
            paragraph.AddDateField("yyyy-MM-dd");
        }
Beispiel #15
0
        private HeaderFooter AddHeaderFooter(HeaderFooter hf, object left, object centered, object right, bool clear)
        {
            if (clear)
            {
                hf.Elements.Clear();
                hf.Format.TabStops.ClearAll();
                var bodywidth = BodyWidth();
                hf.Format.TabStops.AddTabStop(bodywidth / 2, TabAlignment.Center);
                hf.Format.TabStops.AddTabStop(bodywidth, TabAlignment.Right);
            }

            Paragraph paragraph = null;

            if (left != null)
            {
                AddHeaderFooterItem(ref paragraph, left);
            }

            if (centered != null || right != null)
            {
                paragraph = paragraph ?? new Paragraph();
                paragraph.AddTab();
                AddHeaderFooterItem(ref paragraph, centered);
                if (right != null)
                {
                    paragraph.AddTab();
                    AddHeaderFooterItem(ref paragraph, right);
                }
            }
            if (paragraph != null)
            {
                hf.Add(paragraph);
            }

            return(hf);
        }
        private static Paragraph AddInfoRow(Section section, string infoName, string infoData)
        {
            Table table = section.AddTable();

            table.AddColumn(Unit.FromCentimeter(s_PageWidthCM / 2f));
            Row       row       = table.AddRow();
            Paragraph paragraph = row.Cells[0].AddParagraph();

            paragraph.AddFormattedText(infoName, TextFormat.Bold);
            paragraph.Format.SpaceBefore = 5;
            paragraph.Format.ClearAll();
            paragraph.Format.AddTabStop(Unit.FromCentimeter(4));
            paragraph.AddTab();
            paragraph.AddText(infoData);
            return(paragraph);
        }
        void AddSummary(Document document, Section section, BusinessTrip trip)
        {
            section.AddParagraph("3. Podsumowanie", "SectionHeader");

            Paragraph p1 = new Paragraph();

            p1.AddFormattedText("Całkowita", "SummaryLabel");
            p1.AddTab();
            p1.AddFormattedText(trip.CountTotal() + " PLN", "Summary");
            section.Add(p1);


            Paragraph p2 = new Paragraph();

            p2.AddFormattedText("Do Zwrotu", "SummaryLabel");
            p2.AddTab();
            p2.AddFormattedText(trip.CountTotalToReturn() + " PLN", "SummaryToReturn");
            section.Add(p2);
        }
Beispiel #18
0
        /// <summary>
        /// Defines page setup, headers, and footers.
        /// </summary>
        static void DefineContentSection(Document document, ArticlesWithWordMigra article)
        {
            Section section = document.AddSection();

            section.PageSetup.OddAndEvenPagesHeaderFooter = false;
            section.PageSetup.StartingNumber = 1;

            HeaderFooter header = section.Headers.Primary;

            header.AddParagraph(article.EditionName + "\t" + article.Url);

            // Create a paragraph with centered page number. See definition of style "Footer".
            Paragraph paragraph = new Paragraph();

            paragraph.AddTab();
            paragraph.AddPageField();

            // Add paragraph to footer for odd pages.
            section.Footers.Primary.Add(paragraph);
        }
Beispiel #19
0
        /// <summary>
        /// Export name to a section in a document
        /// </summary>
        /// <param name="toExport">The data to export from</param>
        /// <param name="sect">The section to write on</param>
        /// <returns>The section with appended data</returns>
        public override Section Export(Leerlijn toExport, Section sect)
        {
            base.Export(toExport, sect);

            //custom code
            Paragraph p = sect.AddParagraph("Modules in deze leerlijn", "Heading2");

            p.AddLineBreak();

            p = sect.AddParagraph();
            p.AddFormattedText("De leerlijnen zijn klikbaar in PDF viewers").Font.Color = Colors.DarkGray;
            p.AddLineBreak();
            p.AddLineBreak();

            foreach (Module m in toExport.Module)
            {
                p.AddFormattedText((m.Naam ?? "Data niet gevonden")).Font.Bold = true;
                p.AddLineBreak();

                p.AddFormattedText("Komt ook voor in:").Font.Color = Colors.DarkGray;
                p.AddLineBreak();

                List <Leerlijn> otherLines = m.Leerlijn.ToList();
                foreach (Leerlijn l in otherLines)
                {
                    if (!l.Naam.Equals(toExport.Naam))
                    {
                        p.AddTab();
                        Hyperlink hyperlink = p.AddHyperlink((l.Naam ?? "Data niet gevonden"));
                        hyperlink.AddText((l.Naam ?? "Data niet gevonden") + ", zie ook pagina ");
                        hyperlink.AddPageRefField((l.Naam ?? "Data niet gevonden"));
                        hyperlink.Font.Underline = Underline.Single;

                        p.AddLineBreak();
                    }
                }
                p.AddLineBreak();
            }

            return(sect);
        }
Beispiel #20
0
        private static void addScopeBranch(TECScopeBranch branch, Document document, Paragraph paragraph, int tabs, string tabChar = "• ")
        {
            string scopeString = branch.Label;

            for (int i = 0; i < tabs; i++)
            {
                paragraph.AddTab();
            }
            paragraph.AddFormattedText(tabChar);
            if (tabChar != "• ")
            {
                paragraph.AddSpace(2);
            }
            paragraph.AddFormattedText(scopeString);

            foreach (TECScopeBranch childBranch in branch.Branches)
            {
                paragraph = document.LastSection.AddParagraph();
                addScopeBranch(childBranch, document, paragraph, (tabs + 1));
            }
        }
Beispiel #21
0
        /// <summary>
        /// Defines page setup, headers, and footers.
        /// </summary>
        static void DefineContentSection(Document document)
        {
            Section section = document.AddSection();

            section.PageSetup.StartingNumber = 1;

            HeaderFooter header = section.Headers.Primary;

            header.Format.Alignment = ParagraphAlignment.Right;
            header.AddParagraph("\t Page Header");


            // Create a paragraph with centered page number. See definition of style "Footer".
            Paragraph paragraph = new Paragraph();

            paragraph.AddTab();
            paragraph.AddPageField();

            // Add paragraph to footer for odd pages.
            section.Footers.Primary.Add(paragraph);
        }
Beispiel #22
0
        private Paragraph Wettkampf(MannschaftskampfViewModel mannschaftskampfViewModel)
        {
            Paragraph paragraph = new Paragraph();

            var ft = paragraph.AddFormattedText($"{Resources.LanguageFiles.DictPluginMain.Bout}:", TextFormat.Bold);

            ft.Underline = Underline.Single;

            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Geplanter Beginn: ", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddFormattedText($"{mannschaftskampfViewModel.GeplanterKampfbeginn:hh':'mm} Uhr");
            paragraph.AddLineBreak();

            DateTime ersterKampf  = DateTime.Now;
            DateTime letzterKampf = DateTime.Now;

            try
            {
                //ersterKampf = mannschaftskampfViewModel.Children.Min(li => li.Wertungspunkte.Min(na => na.Zeit.Value));
                //letzterKampf = mannschaftskampfViewModel.Children.Max(li => li.Wertungspunkte.Max(na => na.Zeit.Value));
            }
            catch (Exception)
            {
                //TODO: Kampfzeiten konnten nicht ermittelt werden, weil na.Zeit == null war.
                LoggerMessage.Send(new LogEntry(LogEntryType.Error, "Kampfzeiten konnten nicht ermittelt werden"));
            }

            paragraph.AddFormattedText("Erster Kampf: ", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddTab();
            paragraph.AddFormattedText($"{ersterKampf.ToShortTimeString()} Uhr");
            paragraph.AddLineBreak();

            paragraph.AddFormattedText("Letzter Kampf: ", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddTab();
            paragraph.AddFormattedText($"{letzterKampf.ToShortTimeString()} Uhr");
            paragraph.AddLineBreak();

            paragraph.AddFormattedText("Anzahl Zuschauer: ", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddFormattedText($"{mannschaftskampfViewModel.AnzahlZuschauer}");
            paragraph.AddLineBreak();

            return(paragraph);
        }
Beispiel #23
0
        private static void AddCompetitionAndLogo(Client.DataAccess c, Section sec)
        {
            String    competitionName = "Competition: " + c.SelectedCompetition.Name;
            Paragraph pg = sec.AddParagraph();

            pg.Format.Alignment    = ParagraphAlignment.Left;
            pg.Format.KeepTogether = false;
            pg.Format.KeepWithNext = false;
            pg.Format.AddTabStop(Unit.FromCentimeter(21));

            FormattedText ft = pg.AddFormattedText(competitionName);

            ft.Bold = true;
            ft.Size = Unit.FromPoint(16);
            pg.AddTab();


            MigraDoc.DocumentObjectModel.Shapes.Image logo = pg.AddImage(@"Resources\ANR_LOGO.jpg");
            logo.Height          = Unit.FromCentimeter(1.912);
            logo.Width           = Unit.FromCentimeter(2.873);
            logo.LockAspectRatio = true;
            logo.Left            = Unit.FromCentimeter(24);
            logo.Top             = Unit.FromCentimeter(0);
        }
        void StartSection()
        {
            //Add new section
            Section section = m_document.AddSection();

            section.PageSetup.OddAndEvenPagesHeaderFooter = true;
            if (bFirstSection)
            {
                section.PageSetup.StartingNumber = 1;
                bFirstSection = false;
            }

            // Create a paragraph with centered page number. See definition of style "Footer".
            Paragraph paragraph = new Paragraph();

            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());
        }
Beispiel #25
0
        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();
        }
Beispiel #26
0
        //------//-----------//----------//---------//----------//----------//--------//

        /// <summary>
        /// Creates the static parts of the invoice.
        /// </summary>
        void CreatePage()
        {
            string date = DateTime.Now.ToString(); // dont think i need this line anymore

            // Each MigraDoc document needs at least one section.
            Section section = this.document.AddSection();

            //----------------------------------------------------------------------------

            // Put a logo in the header
#if DEBUG
            Image image = section.Headers.Primary.AddImage("../../logo2.PNG");
#else
            Image image = section.Headers.Primary.AddImage("logo2.PNG");
#endif
            image.Width           = "18cm";
            image.LockAspectRatio = false;
            //image.Height = "2.5cm";
            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("Charbonneau Vendette Solutions ");
            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                = "3.5cm";
            this.addressFrame.RelativeVertical   = RelativeVertical.Page;

            //----------------------------------------------------------------------------

            // Put sender in address frame
            paragraph = this.addressFrame.AddParagraph("     Tents For All Events");
            paragraph.Format.Font.Name   = "Calibri";
            paragraph.Format.Font.Bold   = true;
            paragraph.Format.Font.Color  = Colors.Black;
            paragraph.Format.Font.Size   = 13;
            paragraph.Format.SpaceBefore = "0.075cm";
            paragraph.Format.SpaceAfter  = 3;

            //----------------------------------------------------------------------------
            paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "2cm";
            paragraph.Style = "Reference";
            if (Driver == null)
            {
                paragraph.AddText("Driver: __________________");
            }
            else
            {
                paragraph.AddText(string.Format("Driver: {0}", Driver));
            }

            paragraph.AddTab();
            // TODO: Revisit exceptions (like not having a trailer)
            paragraph.AddText(string.Format("Vehicle: {0}, Trailer: {1}, ", Truck, Trailer));
            paragraph.AddText(InstallDate);
            paragraph.Format.Font.Size = 14;

            // Add the print date field
            //paragraph = section.AddParagraph();
            //paragraph.Format.SpaceBefore = "0.5cm";
            //paragraph.Style = "Reference";
            //paragraph.AddFormattedText("List Of Materials", TextFormat.Bold);
            //paragraph.Format.Font.Size = 14;
            //paragraph.AddTab();


            //--------------------------------------------------------------------------//
            //------//-----------//----     Metal Table      -----//----------//--------//
            //--------------------------------------------------------------------------//

            // Create the item table
            this.table                     = section.AddTable();
            table.Rows.Alignment           = RowAlignment.Center;
            this.table.Style               = "Table";
            this.table.Borders.Color       = Colors.Black;
            this.table.Borders.Width       = 0.5;
            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("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("0.75cm");
            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    = Colors.LightGray;

            // Makes the new rows for the Metal
            row.Cells[0].AddParagraph("Metal");
            row.Cells[0].Format.Font.Bold  = true;
            row.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
            row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row.Cells[0].MergeRight        = 8;

            // Get count of metal items
            int MetalTableSize = Counts.Metal.Count;

            // Extract metal list to small variable name ;)
            List <TentItems> metal = Counts.Metal;

            int b = 0;
            int r = 0;

            if (metal != null)
            {
                for (int i = 0; i < MetalTableSize; ++i)  //max number of rows for one page before cutting into other tings is 33 (or 32 for i)
                {
                    if (i == 0 || i % 3 == 0)
                    {
                        row = table.AddRow();
                        row.HeadingFormat    = true;
                        row.Format.Alignment = ParagraphAlignment.Center;
                        row.Format.Font.Bold = true;
                        row.Shading.Color    = Colors.White;
                        b = 0;
                        r++;
                    }


                    row.Cells[b].AddParagraph("□");
                    row.Cells[b].Format.Font.Bold  = true;
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[0].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(metal[i].Type);
                    row.Cells[b].Format.Alignment = ParagraphAlignment.Center;
                    //row.Cells[1].MergeRight = 0;
                    //row.Cells[1].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(metal[i].Qty.ToString());
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[2].MergeDown = 1;
                    //row.Cells[b].Format.Borders.Right.Width = 2;
                    b++;
                }
            }
            this.table.SetEdge(0, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
            this.table.SetEdge(3, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
            this.table.SetEdge(0, 0, 9, r + 1, Edge.Box, BorderStyle.Single, 1, Colors.Black);
            //this.table.SetEdge(0, 0, 9, r + 1, Edge.Top, BorderStyle.Single, 1, Colors.Black);

            //--------------------------------------------------------------------------//
            //------//-----------//--    End Metal Table      ----//----------//--------//
            //--------------------------------------------------------------------------//

            //--------------------------------------------------------------------------//
            //------//-----------//----     Covers Table     -----//----------//--------//
            //--------------------------------------------------------------------------//

            // Create the item table
            this.table                     = section.AddTable();
            table.Rows.Alignment           = RowAlignment.Center;
            this.table.Style               = "Table";
            this.table.Borders.Color       = Colors.Black;
            this.table.Borders.Width       = 0.5;
            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 column2 = this.table.AddColumn("0.5cm");
            column2.Format.Alignment = ParagraphAlignment.Center;

            column2 = this.table.AddColumn("4.08cm");
            column2.Format.Alignment = ParagraphAlignment.Right;

            column2 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column2 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column2 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column2 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column2 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column2 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column2 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            //----------------------------------------------------------------------------

            // Create the header of the table
            Row row2 = table.AddRow();
            row2.HeadingFormat    = true;
            row2.Format.Alignment = ParagraphAlignment.Center;
            row2.Format.Font.Bold = true;
            row2.Shading.Color    = Colors.LightGray;

            row2.Cells[0].AddParagraph("Covers");
            row2.Cells[0].Format.Font.Bold  = true;
            row2.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
            row2.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row2.Cells[0].MergeRight        = 8;

            // Extract to smaller variable name
            List <TentItems> cover = Counts.Covers;

            // Get the size
            int CoverTableSize = cover.Count;

            // Reset b to zero
            b = 0;
            r = 0;

            if (cover != null)
            {
                for (int i = 0; i < CoverTableSize; ++i)  //max number of rows for one page before cutting into other tings is 33 (or 32 for i)
                {
                    if (i == 0 || i % 3 == 0)
                    {
                        row = table.AddRow();
                        row.HeadingFormat    = true;
                        row.Format.Alignment = ParagraphAlignment.Center;
                        row.Format.Font.Bold = true;
                        row.Shading.Color    = Colors.White;
                        b = 0;
                        r++;
                    }


                    row.Cells[b].AddParagraph("□");
                    row.Cells[b].Format.Font.Bold  = true;
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[0].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(cover[i].Type);
                    row.Cells[b].Format.Alignment = ParagraphAlignment.Center;
                    //row.Cells[1].MergeRight = 0;
                    //row.Cells[1].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(cover[i].Qty.ToString());
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[2].MergeDown = 1;
                    b++;
                }
                this.table.SetEdge(0, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
                this.table.SetEdge(3, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
                this.table.SetEdge(0, 0, 9, r + 1, Edge.Left, BorderStyle.Single, 1, Colors.Black);
                this.table.SetEdge(0, 0, 9, r + 1, Edge.Right, BorderStyle.Single, 1, Colors.Black);
            }

            //--------------------------------------------------------------------------//
            //------//-----------//----     Walls  Table     -----//----------//--------//
            //--------------------------------------------------------------------------//

            // Create the item table
            this.table                     = section.AddTable();
            table.Rows.Alignment           = RowAlignment.Center;
            this.table.Style               = "Table";
            this.table.Borders.Color       = Colors.Black;
            this.table.Borders.Width       = 0.5;
            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 column3 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column3 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column3 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column3 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column3 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column3 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column3 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column3 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column3 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            //----------------------------------------------------------------------------

            // Create the header of the table
            Row row3 = table.AddRow();
            row3.HeadingFormat    = true;
            row3.Format.Alignment = ParagraphAlignment.Center;
            row3.Format.Font.Bold = true;
            row3.Shading.Color    = Colors.LightGray;

            row3.Cells[0].AddParagraph("Walls");
            row3.Cells[0].Format.Font.Bold  = true;
            row3.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
            row3.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row3.Cells[0].MergeRight        = 8;

            // Extract to smaller variable name
            List <TentItems> walls = Counts.Walls;

            // Get the size
            int WallsTableSize = walls.Count;

            // Reset b to zero
            b = 0;
            r = 0;

            if (cover != null)
            {
                for (int i = 0; i < WallsTableSize; ++i)  //max number of rows for one page before cutting into other tings is 33 (or 32 for i)
                {
                    if (i == 0 || i % 3 == 0)
                    {
                        row = table.AddRow();
                        row.HeadingFormat    = true;
                        row.Format.Alignment = ParagraphAlignment.Center;
                        row.Format.Font.Bold = true;
                        row.Shading.Color    = Colors.White;
                        b = 0;
                        r++;
                    }


                    row.Cells[b].AddParagraph("□");
                    row.Cells[b].Format.Font.Bold  = true;
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[0].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(walls[i].Type);
                    row.Cells[b].Format.Alignment = ParagraphAlignment.Center;
                    //row.Cells[1].MergeRight = 0;
                    //row.Cells[1].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(walls[i].Qty.ToString());
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[2].MergeDown = 1;
                    b++;
                }
                this.table.SetEdge(0, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
                this.table.SetEdge(3, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
                this.table.SetEdge(0, 0, 9, r + 1, Edge.Box, BorderStyle.Single, 1, Colors.Black);
            }
            //--------------------------------------------------------------------------//
            //------//-----------//----  Tie Downs Table     -----//----------//--------//
            //--------------------------------------------------------------------------//

            // Create the item table
            this.table                     = section.AddTable();
            table.Rows.Alignment           = RowAlignment.Center;
            this.table.Style               = "Table";
            this.table.Borders.Color       = Colors.Black;
            this.table.Borders.Width       = 0.5;
            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 column4 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column4 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column4 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column4 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column4 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column4 = this.table.AddColumn("0.75cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column4 = this.table.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column4 = this.table.AddColumn("4.08cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column4 = this.table.AddColumn("0.75cm");
            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    = Colors.LightGray;

            row.Cells[0].AddParagraph("Tie-Downs");
            row.Cells[0].Format.Font.Bold  = true;
            row.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
            row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row.Cells[0].MergeRight        = 8;

            // Get count of tie down items
            int TieDownTableSize = Counts.TieDowns.Count;

            // Extract to smaller list
            List <TentItems> TieDown = Counts.TieDowns;

            b = 0;
            r = 0;

            for (int i = 0; i < TieDownTableSize; ++i)
            {
                if (i == 0 || i % 3 == 0)
                {
                    row = table.AddRow();
                    row.HeadingFormat    = true;
                    row.Format.Alignment = ParagraphAlignment.Center;
                    row.Format.Font.Bold = true;
                    row.Shading.Color    = Colors.White;
                    b = 0;
                    r++;
                }

                row.Cells[b].AddParagraph("□");
                row.Cells[b].Format.Font.Bold  = true;
                row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                //row.Cells[0].MergeDown = 1;
                b++;
                row.Cells[b].AddParagraph(TieDown[i].Type);
                row.Cells[b].Format.Alignment = ParagraphAlignment.Center;
                //row.Cells[1].MergeRight = 0;
                //row.Cells[1].MergeDown = 1;
                b++;
                row.Cells[b].AddParagraph(TieDown[i].Qty.ToString());
                row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                //row.Cells[2].MergeDown = 1;
                b++;
            }

            this.table.SetEdge(0, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
            this.table.SetEdge(3, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
            this.table.SetEdge(0, 0, 9, r + 1, Edge.Left, BorderStyle.Single, 1, Colors.Black);
            this.table.SetEdge(0, 0, 9, r + 1, Edge.Right, BorderStyle.Single, 1, Colors.Black);
            //this.table.SetEdge(0, 0, 9, r + 1, Edge.Box, BorderStyle.Single, 0.5, Colors.Black);

            if (Acc == null)
            {
                //adds an invisible row to space out the two tables
                this.table.SetEdge(0, 0, 9, r + 1, Edge.Bottom, BorderStyle.Single, 1, Colors.Black);
                row = table.AddRow();
                row.Borders.Visible = false;
            }
            //--------------------------------------------------------------------------//
            //------//-----------//----   Accessories Table  -----//----------//--------//
            //--------------------------------------------------------------------------//
            if (Acc != null)
            {
                // Create the item table
                this.table                     = section.AddTable();
                table.Rows.Alignment           = RowAlignment.Center;
                this.table.Style               = "Table";
                this.table.Borders.Color       = Colors.Black;
                this.table.Borders.Width       = 0.5;
                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 column5 = this.table.AddColumn("0.5cm");
                column.Format.Alignment = ParagraphAlignment.Center;

                column5 = this.table.AddColumn("4.08cm");
                column.Format.Alignment = ParagraphAlignment.Right;

                column5 = this.table.AddColumn("0.75cm");
                column.Format.Alignment = ParagraphAlignment.Right;

                column5 = this.table.AddColumn("0.5cm");
                column.Format.Alignment = ParagraphAlignment.Center;

                column5 = this.table.AddColumn("4.08cm");
                column.Format.Alignment = ParagraphAlignment.Right;

                column5 = this.table.AddColumn("0.75cm");
                column.Format.Alignment = ParagraphAlignment.Right;

                column5 = this.table.AddColumn("0.5cm");
                column.Format.Alignment = ParagraphAlignment.Center;

                column5 = this.table.AddColumn("4.08cm");
                column.Format.Alignment = ParagraphAlignment.Right;

                column5 = this.table.AddColumn("0.75cm");
                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    = Colors.LightGray;

                row.Cells[0].AddParagraph("Accessories");
                row.Cells[0].Format.Font.Bold  = true;
                row.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
                row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
                row.Cells[0].MergeRight        = 8;

                // Get count of accessories
                int AccTableSize = Acc.Count;

                b = 0;
                r = 0;
                for (int i = 0; i < AccTableSize; ++i)
                {
                    if (i == 0 || i % 3 == 0)
                    {
                        row = table.AddRow();
                        row.HeadingFormat    = true;
                        row.Format.Alignment = ParagraphAlignment.Center;
                        row.Format.Font.Bold = true;
                        row.Shading.Color    = Colors.White;
                        b = 0;
                        r++;
                    }
                    row.Cells[b].AddParagraph("□");
                    row.Cells[b].Format.Font.Bold  = true;
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[0].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(Acc[i].Item);
                    row.Cells[b].Format.Alignment = ParagraphAlignment.Center;
                    //row.Cells[1].MergeRight = 0;
                    //row.Cells[1].MergeDown = 1;
                    b++;
                    row.Cells[b].AddParagraph(Acc[i].Qty.ToString());
                    row.Cells[b].Format.Alignment  = ParagraphAlignment.Center;
                    row.Cells[b].VerticalAlignment = VerticalAlignment.Center;
                    //row.Cells[2].MergeDown = 1;
                    b++;
                }

                this.table.SetEdge(0, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
                this.table.SetEdge(3, 1, 3, r, Edge.Right, BorderStyle.Single, 2, Colors.Black);
                this.table.SetEdge(0, 0, 9, r + 1, Edge.Box, BorderStyle.Single, 0.5, Colors.Black); // check this out later *****
                //adds an invisible row to space out the two tables
                row = table.AddRow();
                row.Borders.Visible = false;
            }

            // not sure what this does yet but pretty sure it makes an edge that surrounds the table kind of like thick borders
            //this.table.SetEdge(0, 0, 3, 1, Edge.Box, BorderStyle.Single, 1, Color.Empty);

            //--------------------------------------------------------------------------//
            //------//-----------//---- Stuff After Tables  ------//----------//--------//
            //--------------------------------------------------------------------------//

            //section.AddPageBreak();

            //document.AddSection();

            //MigraDoc.DocumentObjectModel.Paragraph paragraph1 = section.AddParagraph();
            //paragraph1.Format.LineSpacingRule = MigraDoc.DocumentObjectModel.LineSpacingRule.Exactly;
            //paragraph1.Format.LineSpacing = MigraDoc.DocumentObjectModel.Unit.FromMillimeter(40);

            //--------------------------------------------------------------------------//
            //------//-----------//---  Unforgetables Table  -----//----------//--------//
            //--------------------------------------------------------------------------//

            // Create the item table
            //this.document.LastSection.AddSection();
            this.table1           = section.AddTable();
            table1.Rows.Alignment = RowAlignment.Center;
            //table1.Rows.Alignment = VerticalAlignment.Bottom;
            this.table1.Style               = "Table";
            this.table1.Borders.Color       = Colors.Black;
            this.table1.Borders.Width       = 0.5;
            this.table1.Borders.Left.Width  = 0.5;
            this.table1.Borders.Right.Width = 0.5;
            this.table1.Rows.LeftIndent     = 0;

            //----------------------------------------------------------------------------

            // Before you can add a row, you must define the columns
            Column column6 = this.table1.AddColumn("0.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column6 = this.table1.AddColumn("3cm");
            column6.Format.Alignment = ParagraphAlignment.Right;

            column6 = this.table1.AddColumn("0.5cm");
            column6.Format.Alignment = ParagraphAlignment.Right;

            column6 = this.table1.AddColumn("4cm");
            column6.Format.Alignment = ParagraphAlignment.Right;

            column6 = this.table1.AddColumn("0.5cm");
            column6.Format.Alignment = ParagraphAlignment.Right;

            column6 = this.table1.AddColumn("3cm");
            column6.Format.Alignment = ParagraphAlignment.Right;

            column6 = this.table1.AddColumn("0.5cm");
            column6.Format.Alignment = ParagraphAlignment.Right;

            column6 = this.table1.AddColumn("4cm");
            column6.Format.Alignment = ParagraphAlignment.Right;

            //----------------------------------------------------------------------------

            // Create the header of the table

            Row row6 = table1.AddRow();
            row6.HeadingFormat    = true;
            row6.Format.Alignment = ParagraphAlignment.Center;
            row6.Format.Font.Bold = true;
            row6.Shading.Color    = Colors.White;

            row6.Cells[0].AddParagraph("□");
            row6.Cells[0].Format.Font.Bold = true;
            row6.Cells[0].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[1].AddParagraph("Blue Tarp");
            row6.Cells[1].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[2].AddParagraph("□");
            row6.Cells[2].Format.Font.Bold = true;
            row6.Cells[2].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[3].AddParagraph("Clips");
            row6.Cells[3].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[4].AddParagraph("□");
            row6.Cells[4].Format.Font.Bold = true;
            row6.Cells[4].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[5].AddParagraph("Patch Kit");
            row6.Cells[5].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[6].AddParagraph("□");
            row6.Cells[6].Format.Font.Bold = true;
            row6.Cells[6].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[7].AddParagraph("Jack Hammer/Fuel");
            row6.Cells[7].Format.Alignment = ParagraphAlignment.Center;

            row6 = table1.AddRow();
            row6.HeadingFormat    = true;
            row6.Format.Alignment = ParagraphAlignment.Center;
            row6.Format.Font.Bold = true;
            row6.Shading.Color    = Colors.White;

            row6.Cells[0].AddParagraph("□");
            row6.Cells[0].Format.Font.Bold = true;
            row6.Cells[0].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[1].AddParagraph("Spray 9/Rags");
            row6.Cells[1].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[2].AddParagraph("□");
            row6.Cells[2].Format.Font.Bold = true;
            row6.Cells[2].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[3].AddParagraph("Sledge Hammer");
            row6.Cells[3].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[4].AddParagraph("□");
            row6.Cells[4].Format.Font.Bold = true;
            row6.Cells[4].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[5].AddParagraph("Step Ladder");
            row6.Cells[5].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[6].AddParagraph("□");
            row6.Cells[6].Format.Font.Bold = true;
            row6.Cells[6].Format.Alignment = ParagraphAlignment.Center;

            row6.Cells[7].AddParagraph("Impact/Screws");
            row6.Cells[7].Format.Alignment = ParagraphAlignment.Center;
            this.table1.SetEdge(0, 0, 8, 2, Edge.Box, BorderStyle.Single, 1, Colors.Black);

            // Add the notes paragraph
            paragraph = section.AddParagraph();
            //this.document.LastSection.AddParagraph();
            paragraph.Format.SpaceBefore = "0.5cm";
            paragraph.Format.SpaceAfter  = "0.5cm";
            //paragraph.Format.Alignment = ParagraphAlignment.Bottom;
            paragraph.Format.Borders.Width    = 0.75;
            paragraph.Format.Borders.Distance = 3;
            paragraph.Format.Borders.Color    = Colors.Black;
            paragraph.Format.Shading.Color    = Colors.LightGray;
            paragraph.AddText("notes \n \n \n \n");
        }
Beispiel #27
0
        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);
            }
        }
Beispiel #28
0
        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);
        }
Beispiel #29
0
        static int CreateConcatcPage(FilterContactReport filter, int colCount)
        {
            // Each MigraDoc document needs at least one section.
            _section = _document.AddSection();
            //_section.PageSetup = _document.DefaultPageSetup.Clone();
            var pageSize = _document.DefaultPageSetup.Clone();

            //  pageSize.Orientation = colCount < 5 ? Orientation.Portrait : Orientation.Landscape;
            pageSize.Orientation = Orientation.Portrait;
            pageSize.PageFormat  = PageFormat.A4;
            pageSize.LeftMargin  = new Unit {
                Centimeter = 1.5
            };
            pageSize.RightMargin = new Unit {
                Centimeter = 1.5
            };
            pageSize.OddAndEvenPagesHeaderFooter = true;
            pageSize.StartingNumber = 1;
            _section.PageSetup      = pageSize;
            Paragraph paragraph = _section.Headers.Primary.AddParagraph();

            paragraph.AddText(filter.Name);
            paragraph.Format.Font.Size = 9;
            paragraph.Format.Alignment = ParagraphAlignment.Center;


            // Create the item 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;
            _table.Rows.HeightRule     = RowHeightRule.AtLeast;
            _table.Rows.Height         = 12;
            Unit curPageWidth = new Unit {
                Centimeter = pageSize.Orientation == Orientation.Landscape ? 29.7 : 21
            };
            Unit?pageWidth = curPageWidth - _section.PageSetup.LeftMargin - _section.PageSetup.RightMargin;



            colCount = CreateColumns(filter, colCount, pageWidth);
            _table.SetEdge(0, 0, colCount, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty);

            //page num
            var style = _document.Styles[StyleNames.Footer];

            style.ParagraphFormat.AddTabStop("9cm", TabAlignment.Center);
            style.Font.Name  = "Verdana";
            style.Font.Name  = "Times New Roman";
            style.Font.Size  = 9;
            style.Font.Color = FontColor;
            // Create a paragraph with centered page number. See definition of style "Footer".
            Paragraph paragraph2 = new Paragraph();

            paragraph2.Style = StyleNames.Footer;
            paragraph2.AddTab();
            paragraph2.AddPageField();

            // Add paragraph to footer for odd pages.
            _section.Footers.Primary.Add(paragraph2);
            // 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(paragraph2.Clone());


            return(colCount);
        }
        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.");
        }