Ejemplo n.º 1
0
        public void AddReportHeader(DateTime?generationTime, string userQuery, IEnumerable <string> searchedLocations)
        {
            Paragraph paragraph = section.AddParagraph();

            paragraph.Style = "Heading1";
            paragraph.AddText("Search Report");

            paragraph       = section.AddParagraph();
            paragraph.Style = "Heading2";
            paragraph.AddText("\nKey information\n");

            if (generationTime.HasValue)
            {
                paragraph       = section.AddParagraph("Generation date: " + generationTime.Value.ToShortDateString());
                paragraph.Style = "Heading3";
            }

            if (userQuery != null)
            {
                paragraph       = section.AddParagraph("Searched phrases:    " + userQuery);
                paragraph.Style = "Heading3";
            }

            if (searchedLocations != null)
            {
                paragraph       = section.AddParagraph("Searched locations:");
                paragraph.Style = "Heading3";
                foreach (String location in searchedLocations)
                {
                    paragraph = section.AddParagraph("\t" + location);
                }
            }
            section.AddParagraph("\n\n");
            paragraph.Style = "Normal";
        }
Ejemplo n.º 2
0
        private void AddNotes()
        {
            //Written total
            TextFrame textFrame = section.AddTextFrame();

            textFrame.Width            = "17cm";
            textFrame.Left             = ShapePosition.Left;
            textFrame.WrapFormat.Style = WrapStyle.None;
            textFrame.AddParagraph();
            section.AddParagraph();
            Paragraph paragraph = section.AddParagraph();

            paragraph.Format.Font.Size = "10pt";
            paragraph.Format.Font.Name = "Arial";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText(documentContent.totalWritten);
            section.AddParagraph();
            paragraph = section.AddParagraph();
            paragraph.Format.Font.Size = "10pt";
            paragraph.Format.Font.Name = "Arial";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText(documentContent.taxNote);
            paragraph = section.AddParagraph();
            paragraph.Format.Font.Size = "10pt";
            paragraph.Format.Font.Name = "Arial";
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText(documentContent.notes);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public byte[] EstraiReportALEMancanti(AddebitiModel report, string dataInizio, string dataFine)
        {
            InizializzaDocumento("Report Mancanti ALE", "Report", "MetalWeb");

            _document.DefaultPageSetup.Orientation = Orientation.Portrait;
            _document.DefaultPageSetup.RightMargin = 20;
            _document.DefaultPageSetup.LeftMargin  = 20;
            _document.AddSection();
            _document.LastSection.AddParagraph("Report Mancanti ALE", "Heading2");

            Paragraph paragraph = _document.LastSection.AddParagraph();

            paragraph.AddText("Report dal ");
            paragraph.AddFormattedText(dataInizio, TextFormat.Bold);
            paragraph.AddText(" al ");
            paragraph.AddFormattedText(dataFine, TextFormat.Bold);
            paragraph.AddText(".");

            paragraph.Format.SpaceAfter = "1cm";

            CreaTabellaALEMancanti(report);

            byte[] fileContents = EstraiByteDaDocumento();
            return(fileContents);
        }
Ejemplo n.º 5
0
        public static Document CreateDocument(string Propriedade, string Nome = "", string InscricaoEstadual = "")
        {
            Section  section;
            Document doc;

            doc     = new Document();
            section = doc.AddSection();
            section.PageSetup.OddAndEvenPagesHeaderFooter = true;

            section.AddParagraph("RELATÓRIO - " + Convert.ToString(DateTime.Now.Date)).Format.Alignment = ParagraphAlignment.Center;

            section.AddParagraph("Proprietário: " + Nome);
            section.AddParagraph("Inscrição Estadual: " + InscricaoEstadual);
            section.AddParagraph("Propriedade: " + Propriedade);
            section.AddParagraph();

            Paragraph paragraph = new Paragraph();

            paragraph.AddText("Página ");
            paragraph.AddPageField();
            paragraph.AddText(" de ");
            paragraph.AddNumPagesField();

            section.Footers.Primary.Add(paragraph);
            section.Footers.EvenPage.Add(paragraph.Clone());

            section.PageSetup.Orientation = Orientation.Landscape;

            DefineStyles(doc);

            return(doc);
        }
Ejemplo n.º 6
0
        public byte[] EstraiVerniciaturaReport(VerniciaturaReportModel report, DateTime dataInizio, DateTime dataFine)
        {
            InizializzaDocumento("Report Verniciatura", "Report settimanale", "MetalWeb");

            _document.DefaultPageSetup.Orientation = Orientation.Landscape;
            _document.DefaultPageSetup.RightMargin = 20;
            _document.DefaultPageSetup.LeftMargin  = 20;
            _document.AddSection();
            _document.LastSection.AddParagraph("Report Verniciatura", "Heading2");

            Paragraph paragraph = _document.LastSection.AddParagraph();

            paragraph.AddText("Report per la settimana dal ");
            paragraph.AddFormattedText(dataInizio.ToShortDateString(), TextFormat.Bold);
            paragraph.AddText(" al ");
            paragraph.AddFormattedText(dataFine.ToShortDateString(), TextFormat.Bold);
            paragraph.AddText(". Quantità manuale complessiva: ");
            paragraph.AddFormattedText(report.QuantitaManualeTotale, TextFormat.Bold);
            paragraph.AddText(". NUmero di barre complessivo: ");
            paragraph.AddFormattedText(report.BarreTotali, TextFormat.Bold);
            paragraph.Format.SpaceAfter = "1cm";


            CreaTabellaVerniciatura(report);

            byte[] fileContents = EstraiByteDaDocumento();
            return(fileContents);
        }
Ejemplo n.º 7
0
        public byte[] EstraiPDVReport(PVDReportModel report, DateTime dataInizio, DateTime dataFine)
        {
            InizializzaDocumento("Report PDV", "Report settimanale", "MetalWeb");

            _document.DefaultPageSetup.Orientation = Orientation.Landscape;
            _document.DefaultPageSetup.RightMargin = 20;
            _document.DefaultPageSetup.LeftMargin  = 20;
            _document.AddSection();
            _document.LastSection.AddParagraph("Report PVD", "Heading2");

            Paragraph paragraph = _document.LastSection.AddParagraph();

            paragraph.AddText("Report per la settimana dal ");
            paragraph.AddFormattedText(dataInizio.ToShortDateString(), TextFormat.Bold);
            paragraph.AddText(" al ");
            paragraph.AddFormattedText(dataFine.ToShortDateString(), TextFormat.Bold);
            paragraph.AddText(". Durata complessiva: ");
            paragraph.AddFormattedText(report.DurataTotale, TextFormat.Bold);
            paragraph.Format.SpaceAfter = "1cm";

            CreaTabellaPVD(report);

            byte[] fileContents = EstraiByteDaDocumento();
            return(fileContents);
        }
Ejemplo n.º 8
0
        public static void printTags(PictureViewModel pvm)
        {
            Dictionary <string, int> exifCount = CountExifTags(pvm);
            Dictionary <string, int> iptcCount = CountIptcTags(pvm);

            Document  doc        = new Document();
            Section   section1   = doc.AddSection();
            Paragraph paragraph1 = section1.AddParagraph();

            paragraph1.AddFormattedText("EXIF Properties:\n", TextFormat.Bold);
            paragraph1.AddText(PrintableTags(exifCount));
            paragraph1.AddFormattedText("IPTC Properties:\n", TextFormat.Bold);
            paragraph1.AddText(PrintableTags(iptcCount));
            PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false);

            pdfRenderer.Document = doc;
            pdfRenderer.RenderDocument();

            OpenFileDialog dialog = new OpenFileDialog();

            dialog.CheckFileExists = false;
            var result = dialog.ShowDialog();

            if (result == false)
            {
                return;
            }
            pdfRenderer.PdfDocument.Save(dialog.FileName);
        }
Ejemplo n.º 9
0
        private void AddFooter(Section section)
        {
            //var footer = section.Footers.Primary.AddParagraph();
            //footer.Format.AddTabStop(Size.GetWidth(section), TabAlignment.Right);


            //footer.AddTab();
            //footer.AddText("Symphony Media -Linear");//Here need to print Client Short Name
            //footer.AddTab();
            //footer.AddText("Page ");
            //footer.AddPageField();
            //footer.AddText(" of ");
            //footer.AddNumPagesField();
            Paragraph leftFooter = section.Footers.Primary.AddParagraph();

            leftFooter.Format.Font.Size = 10;
            leftFooter.Format.Alignment = ParagraphAlignment.Right;
            leftFooter.AddText("Symphony Media -Linear");

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

            rightFooter.Format.Font.Size = 10;
            rightFooter.Format.Alignment = ParagraphAlignment.Center;
            rightFooter.AddText("Page ");
            rightFooter.AddPageField();
            rightFooter.AddText(" of ");
            rightFooter.AddNumPagesField();
        }
Ejemplo n.º 10
0
        static void DemonstrateBordersAndShading(Document document)
        {
            document.LastSection.AddPageBreak();
            document.LastSection.AddParagraph("Borders and Shading", "Heading2");

            document.LastSection.AddParagraph("Border around Paragraph", "Heading3");

            Paragraph paragraph = document.LastSection.AddParagraph();

            paragraph.Format.Borders.Width    = 2.5;
            paragraph.Format.Borders.Color    = Colors.Navy;
            paragraph.Format.Borders.Distance = 3;
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("Shading", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Shading.Color = Colors.LightCoral;
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("Borders & Shading", "Heading3");

            paragraph       = document.LastSection.AddParagraph();
            paragraph.Style = "TextBox";
            paragraph.AddText("Miroslaw");
        }
Ejemplo n.º 11
0
        private void AddDocumentFooter()
        {
            if (String.IsNullOrWhiteSpace(DocumentFooter) && ShowPageNumber == false)
            {
                return; // Don't add any footer
            }
            var section = Document.LastSection;

            var footer1 = new Paragraph();

            if (!String.IsNullOrWhiteSpace(DocumentFooter))
            {
                footer1.Style = StyleNames.Footer;
                footer1.AddText(DocumentFooter);

                if (ShowPageNumber)
                {
                    footer1.AddLineBreak();
                }
            }

            if (ShowPageNumber)
            {
                footer1.AddText("Page ");
                footer1.AddPageField();
                footer1.AddText(" of ");
                footer1.AddNumPagesField();
            }

            section.Footers.Primary.Add(footer1.Clone());
            section.Footers.FirstPage.Add(footer1.Clone());
        }
Ejemplo n.º 12
0
        public Section CreateDocumentSection()
        {
            Section section = _document.AddSection();

            // Set section footer
            Paragraph paragraph = new Paragraph();

            paragraph.Format.Font.Size   = 6;
            paragraph.Format.Alignment   = ParagraphAlignment.Right;
            paragraph.Format.Font.Italic = false;
            paragraph.Format.Font.Color  = Colors.DarkGray;
            paragraph.AddText($"Powered by {AppConstants.AppTitle} {AppConstants.AppVersion}");
            paragraph.AddSpace(3);
            paragraph.AddText("|");
            paragraph.AddSpace(3);
            paragraph.AddText(Phrases.GlobalPage);
            paragraph.AddSpace(1);
            paragraph.AddPageField();
            paragraph.AddSpace(1);
            paragraph.AddText(Phrases.GlobalOf);
            paragraph.AddSpace(1);
            paragraph.AddNumPagesField();

            section.Footers.Primary.Add(paragraph);
            section.Footers.EvenPage.Add(paragraph.Clone());

            return(section);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Pisze odzywke licytacyjna, wiec na praktyke moze tez pisac wist
        /// </summary>
        /// <param name="p"></param>
        /// <param name="odzywka">Odzywka, np. 2H, 7N, p,d,r. Moga byc male lub wielkie litery</param>
        /// <returns></returns>
        public static Paragraph WriteOdzywka(Paragraph p, string odzywka)
        {
            odzywka = odzywka.ToUpper();

            if (odzywka.Count() > 1)
            {
                p.AddText(odzywka[0].ToString());

                char suit = odzywka[1];

                WriteSuit(p, suit);
            }
            else
            {
                if (odzywka.ToUpper() == "D")
                {
                    p.AddText(napisKontra);
                }
                if (odzywka.ToUpper() == "R")
                {
                    p.AddText(napisRe);
                }
                if (odzywka.ToUpper() == "P")
                {
                    p.AddText(napisPas);
                }
            }
            return(p);
        }
Ejemplo n.º 14
0
            private static void CreateNewSection(ref Document workingDoc, string sectionHead)
            {
                workingDoc.AddSection();
                workingDoc.LastSection.PageSetup.TopMargin    = Unit.FromInch(.25);
                workingDoc.LastSection.PageSetup.BottomMargin = Unit.FromInch(.5);
                workingDoc.LastSection.PageSetup.LeftMargin   = Unit.FromInch(.25);
                workingDoc.LastSection.PageSetup.RightMargin  = Unit.FromInch(.25);

                workingDoc.LastSection.AddParagraph(sectionHead, "Heading1");
                if (_rowBreak != null && _rowBreak != "" && sectionHead != "")
                {
                    //workingDoc.LastSection.Headers.Primary.AddParagraph(sectionHead);
                    //workingDoc.LastSection.PageSetup.HeaderDistance = new Unit(.75, UnitType.Inch);
                    //workingDoc.LastSection.AddParagraph(sectionHead, "Heading1");
                    workingDoc.LastSection.Headers.Primary.AddParagraph(_rowBreak + ":" + sectionHead);
                }

                Unit myFooter = new Unit(.20, UnitType.Inch);

                workingDoc.LastSection.PageSetup.FooterDistance = myFooter;
                //workingDoc.DefaultPageSetup.FooterDistance = myFooter;
                Paragraph pFooter = new Paragraph();

                pFooter.AddText("Page ");
                pFooter.AddPageField();
                pFooter.AddText(" of ");
                pFooter.AddNumPagesField();
                workingDoc.LastSection.Footers.Primary.Add(pFooter);
            }
Ejemplo n.º 15
0
        void CreatePage()
        {
            Sumy_wybranych();

            // Each MigraDoc document needs at least one section.
            section = this.document.AddSection();
            Paragraph paragraph = section.Footers.Primary.AddParagraph();

            paragraph = section.AddParagraph();
            paragraph.AddText(Properties.Settings.Default.aktualne_miasto_PL);
            paragraph.Style = "TNR12";
            //////////
            paragraph = section.AddParagraph();
            paragraph.AddText("Raport od: " + data_od);
            paragraph.Style = "TNR12";
            ///////////
            paragraph = section.AddParagraph();
            paragraph.AddText("Raport do: " + data_do);
            paragraph.Style = "TNR12";
            //



            paragraph = section.AddParagraph();
            paragraph.AddText("Przyjętych zamówień: " + ile_przyjetych);
            paragraph.Style = "TNR12";

            paragraph = section.AddParagraph();
            paragraph.AddText("W tym rozliczonych: " + ile_rozliczonych);
            paragraph.Style = "TNR12";

            Tworzenie_tabeli();
        }
Ejemplo n.º 16
0
        public void AddParagraph(ArrayList oArregloEncabezados, ArrayList pArregloResultados)
        {
            Paragraph oParagraph = new Paragraph();

            oParagraph = section.AddParagraph();
            oParagraph.Format.SpaceBefore = "1cm";
            oParagraph.Format.Alignment   = ParagraphAlignment.Left;


            int i = 0;

            foreach (string oTexto in oArregloEncabezados)
            {
                FormattedText oFormattedText = oParagraph.AddFormattedText(oTexto);
                oFormattedText.Bold      = true;
                oFormattedText.Font.Name = "Segoe Print";
                oFormattedText.Font.Size = 12;

                oParagraph.Format.Font = new Font("Arial", 11);
                oParagraph.AddText(pArregloResultados[i].ToString().Trim());
                oParagraph.AddText("        ");

                i++;
            }
        }
Ejemplo n.º 17
0
        public void FooterSection()
        {
            HeaderFooter footer = Pdf.LastSection.Footers.Primary;

            Table table = footer.AddTable();

            table.AddColumn(footer.Section.PageWidth() / 2);
            table.AddColumn(footer.Section.PageWidth() / 2);
            Row row = table.AddRow();

            if (!string.IsNullOrEmpty(Invoice.Footer))
            {
                Paragraph paragraph = row.Cells[0].AddParagraph(Invoice.Footer, ParagraphAlignment.Left, "H2-8-Blue");
                Hyperlink link      = paragraph.AddHyperlink(Invoice.Footer, HyperlinkType.Web);
            }

            Paragraph info = row.Cells[1].AddParagraph();

            info.Format.Alignment = ParagraphAlignment.Right;
            info.Style            = "H2-8";
            info.AddText("Page ");
            info.AddPageField();
            info.AddText(" of ");
            info.AddNumPagesField();
        }
Ejemplo n.º 18
0
 internal static void FillFormattedParagraph(Paragraph par)
 {
     for (int idx = 0; idx <= 140; ++idx)
     {
         if (idx < 60)
         {
             FormattedText formText = par.AddFormattedText((idx).ToString(), TextFormat.Bold);
             formText.Font.Size = 16;
             formText.AddText(" ");
         }
         else if (idx < 100)
         {
             par.AddText((idx).ToString());
             par.AddText(" ");
         }
         else
         {
             FormattedText formText = par.AddFormattedText((idx).ToString(), TextFormat.Italic);
             formText.Font.Size = 6;
             formText.AddText(" ");
         }
         if (idx % 50 == 0)
         {
             par.AddLineBreak();
         }
     }
     par.AddText(" ...ready.");
 }
Ejemplo n.º 19
0
        static void DemonstrateAlignment(Document document)
        {
            try {
                document.LastSection.AddParagraph("Alignment", "Heading2");

                document.LastSection.AddParagraph("Left Aligned", "Heading3");

                Paragraph paragraph = document.LastSection.AddParagraph();
                paragraph.Format.Alignment = ParagraphAlignment.Left;
                paragraph.AddText("Algo de texto");

                document.LastSection.AddParagraph("Right Aligned", "Heading3");

                paragraph = document.LastSection.AddParagraph();
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.AddText("Algo de texto");

                document.LastSection.AddParagraph("Centered", "Heading3");

                paragraph = document.LastSection.AddParagraph();
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                paragraph.AddText("Algo de texto");

                document.LastSection.AddParagraph("Justified", "Heading3");

                paragraph = document.LastSection.AddParagraph();
                paragraph.Format.Alignment = ParagraphAlignment.Justify;
                paragraph.AddText("Algo de texto");
            } catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 20
0
        static void DemonstrateIndent(Document document)
        {
            try {
                document.LastSection.AddParagraph("Indent", "Heading2");

                document.LastSection.AddParagraph("Left Indent", "Heading3");

                Paragraph paragraph = document.LastSection.AddParagraph();
                paragraph.Format.LeftIndent = "2cm";
                paragraph.AddText("Algo de texto");

                document.LastSection.AddParagraph("Right Indent", "Heading3");

                paragraph = document.LastSection.AddParagraph();
                paragraph.Format.RightIndent = "1in";
                paragraph.AddText("Algo de texto");

                document.LastSection.AddParagraph("First Line Indent", "Heading3");

                paragraph = document.LastSection.AddParagraph();
                paragraph.Format.FirstLineIndent = "12mm";
                paragraph.AddText("Algo de texto");

                document.LastSection.AddParagraph("First Line Negative Indent", "Heading3");

                paragraph = document.LastSection.AddParagraph();
                paragraph.Format.LeftIndent      = "1.5cm";
                paragraph.Format.FirstLineIndent = "-1.5cm";
                paragraph.AddText("Algo de texto");
            } catch (Exception ex) {
                throw ex;
            }
        }
Ejemplo n.º 21
0
        private void AddLogoDateProducerNameAddressAndCicle(Document document, DateTime date, Producer producer, string cicle)
        {
            string          producerName     = producer.Name + " " + producer.PaternalSurname + " " + producer.MaternalSurname;
            SelectableModel state            = new CatalogBL(settlementDL.ConnectionString).GetStates().Where(x => x.Id == producer.StateId).FirstOrDefault();
            string          producerAddress  = producer.Address + ". C.P: " + producer.ZipCode + ". Colonia " + producer.DistrinctOrColony + ". " + producer.City + ", " + state.Name;
            TextInfo        textInfo         = new CultureInfo("en-US", false).TextInfo;
            string          dateString       = textInfo.ToUpper(date.ToString("D", CultureInfo.CreateSpecificCulture("es-MX")));
            var             assembly         = Assembly.GetExecutingAssembly();
            Paragraph       currentParagraph = document.LastSection.AddParagraph();

            using (Stream stream = assembly.GetManifestResourceStream("LasMargaritas.BL.Images.LogoMargaritasMedium.jpg"))
            {
                if (stream == null)
                {
                    throw new ArgumentException("No resource with name");
                }
                int    count = (int)stream.Length;
                byte[] data  = new byte[count];
                stream.Read(data, 0, count);
                currentParagraph.Format.Alignment = ParagraphAlignment.Right;
                currentParagraph.AddImage("base64:" + Convert.ToBase64String(data));
            }
            currentParagraph = document.LastSection.AddParagraph();
            currentParagraph.AddFormattedText("Ciclo: ", "Heading2");
            currentParagraph.AddText(cicle);
            currentParagraph = document.LastSection.AddParagraph();
            currentParagraph.AddFormattedText("Fecha: ", "Heading2");
            currentParagraph.AddText(dateString);
            currentParagraph = document.LastSection.AddParagraph();
            currentParagraph.AddFormattedText("Productor: ", "Heading2");
            currentParagraph.AddText(producerName);
            currentParagraph = document.LastSection.AddParagraph();
            currentParagraph.AddFormattedText("Domicilio: ", "Heading2");
            currentParagraph.AddText(producerAddress);
        }
Ejemplo n.º 22
0
        public MemoryStream PrintSettlement(int settlementId)
        {
            Document                 document   = CreateDocument();
            Settlement               settlement = settlementDL.GetSettlement(settlementId, null)[0];                                   //TODO check for missing settlement
            Cicle                    cicle      = new CicleBL(settlementDL.ConnectionString).GetCicle(settlement.CicleId)[0];          //TODO check for missing cicle
            Producer                 producer   = new ProducerBL(settlementDL.ConnectionString).GetProducer(settlement.ProducerId)[0]; //TODO check for missing cicle
            List <WeightTicket>      tickets    = new WeightTicketsDL(settlementDL.ConnectionString).GetWeightTicketsInSettlementFullDetails(settlementId);
            List <SettlementPayment> payments   = settlementDL.GetSettlementPayments(settlementId);

            //Add logo, date,  producer data and cicle
            AddLogoDateProducerNameAddressAndCicle(document, settlement.Date, producer, cicle.Name);
            document.LastSection.AddParagraph();
            //Print weightickets table
            AddWeightTicketsTable(tickets, document);
            document.LastSection.AddParagraph();
            //Print payments
            AddPaymentsTableAndSummaryTable(payments, document, settlement);
            document.LastSection.AddParagraph();
            //Print producer signature section
            Paragraph currentParagraph = document.LastSection.AddParagraph();

            currentParagraph.Format.Alignment = ParagraphAlignment.Center;
            currentParagraph.AddText("______________________________________");
            currentParagraph = document.LastSection.AddParagraph();
            currentParagraph.Format.Alignment = ParagraphAlignment.Center;
            currentParagraph.AddText(producer.Name + " " + producer.PaternalSurname + " " + producer.MaternalSurname);
            PdfDocumentRenderer renderer = new PdfDocumentRenderer(true);

            renderer.Document = document;
            renderer.RenderDocument();
            MemoryStream stream = new MemoryStream();

            renderer.Save(stream, false);
            return(stream);
        }
Ejemplo n.º 23
0
//   [UnitTestFunction]
        public static void TestParagraph()
        {
            Document doc = new Document();

            doc.Styles["Heading3"].Font.Color = Color.CadetBlue;
            Section   sec = doc.Sections.AddSection();
            Paragraph par = sec.AddParagraph();

            par.Style = "Heading4";
            par.AddText("A bit ");
            FormattedText ft = par.AddFormattedText("differently formatted");

            ft.Style     = "InvalidStyleName";
            ft.Font.Size = 40;
            ft.Font.Name = "Courier New";
            //ft.Font.Color = Color.Azure;
            ft.Font.Bold   = true;
            ft.Font.Italic = true;
            //ft.Font.Underline = Underline.Dotted;

            par.AddText(" text.");

            DocumentRenderer docRndrr = new DocumentRenderer();

            docRndrr.Render(doc, "RtfParagraph.txt", null);

            File.Copy("RtfParagraph.txt", "RtfParagraph.rtf", true);
            System.Diagnostics.Process.Start("RtfParagraph.rtf");
        }
Ejemplo n.º 24
0
        static void DemonstrateIndent(Document document)
        {
            document.LastSection.AddParagraph("Indent", "Heading2");

            document.LastSection.AddParagraph("Left Indent", "Heading3");

            Paragraph paragraph = document.LastSection.AddParagraph();

            paragraph.Format.LeftIndent = "2cm";
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("Right Indent", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.RightIndent = "1in";
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("First Line Indent", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.FirstLineIndent = "12mm";
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("First Line Negative Indent", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.LeftIndent      = "1.5cm";
            paragraph.Format.FirstLineIndent = "-1.5cm";
            paragraph.AddText("Miroslaw");
        }
Ejemplo n.º 25
0
        private void DemonstrateAlignment(Document document)
        {
            document.LastSection.AddParagraph("Alignment", "Heading2");

            document.LastSection.AddParagraph("Left Aligned", "Heading3");

            Paragraph paragraph = document.LastSection.AddParagraph();

            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText(_fillerTextText);

            document.LastSection.AddParagraph("Right Aligned", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment = ParagraphAlignment.Right;
            paragraph.AddText(_fillerTextText);

            document.LastSection.AddParagraph("Centered", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment = ParagraphAlignment.Center;
            paragraph.AddText(_fillerTextText);

            document.LastSection.AddParagraph("Justified", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment = ParagraphAlignment.Justify;
            paragraph.AddText(_fillerTextMediumText);
        }
Ejemplo n.º 26
0
        static void DemonstrateAlignment(Document document)
        {
            document.LastSection.AddParagraph("Alignment", "Heading2");

            document.LastSection.AddParagraph("Left Aligned", "Heading3");

            Paragraph paragraph = document.LastSection.AddParagraph();

            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("Right Aligned", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment = ParagraphAlignment.Right;
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("Centered", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment = ParagraphAlignment.Center;
            paragraph.AddText("Miroslaw");

            document.LastSection.AddParagraph("Justified", "Heading3");

            paragraph = document.LastSection.AddParagraph();
            paragraph.Format.Alignment = ParagraphAlignment.Justify;
            paragraph.AddText("Miroslaw");
        }
Ejemplo n.º 27
0
        private MigraDoc.DocumentObjectModel.Document CreatePrintDocument(PrintDocument pd)
        {
            string text;

            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth    = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100);
            doc.DefaultPageSetup.PageHeight   = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100);
            doc.DefaultPageSetup.TopMargin    = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100);
            doc.DefaultPageSetup.LeftMargin   = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100);
            doc.DefaultPageSetup.RightMargin  = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100);
            doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100);
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();
            section.PageSetup.StartingNumber = 1;
            MigraDoc.DocumentObjectModel.Font headingFont = MigraDocHelper.CreateFont(13, true);
            MigraDoc.DocumentObjectModel.Font bodyFontx   = MigraDocHelper.CreateFont(9, false);
            MigraDoc.DocumentObjectModel.Font nameFontx   = MigraDocHelper.CreateFont(9, true);
            MigraDoc.DocumentObjectModel.Font totalFontx  = MigraDocHelper.CreateFont(9, true);
            Paragraph pageNumParag = new Paragraph();

            pageNumParag.AddText(Lan.g(this, "Page") + " ");
            pageNumParag.AddPageField();
            pageNumParag.AddText(" " + Lan.g(this, "of") + " ");
            pageNumParag.AddNumPagesField();
            section.Footers.Primary.Add(pageNumParag);
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Center;
            parformat.Font      = MigraDocHelper.CreateFont(14, true);
            par.Format          = parformat;
            //Render the reconcile grid.
            par = section.AddParagraph();
            par.Format.Alignment = ParagraphAlignment.Center;
            par.AddFormattedText(Lan.g(this, "RECONCILE"), totalFontx);
            par.AddLineBreak();
            text = Accounts.GetAccount(ReconcileCur.AccountNum).Description.ToUpper();
            par.AddFormattedText(text, totalFontx);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticeTitle);
            par.AddText(text);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticePhone);
            if (text.Length == 10 && Application.CurrentCulture.Name == "en-US")
            {
                text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6);
            }
            par.AddText(text);
            par.AddLineBreak();
            par.AddText(MiscData.GetNowDateTime().ToShortDateString());
            par.AddLineBreak();
            par.AddText(Lan.g(this, "Reconcile Date") + ": " + PIn.Date(textDate.Text).ToShortDateString());
            par.AddLineBreak();
            par.AddText(labelStart.Text + ": " + PIn.Double(textStart.Text).ToString("n"));
            par.AddLineBreak();
            par.AddText(labelEnd.Text + ": " + PIn.Double(textEnd.Text).ToString("n"));
            MigraDocHelper.InsertSpacer(section, 10);
            MigraDocHelper.DrawGrid(section, gridMain);
            return(doc);
        }
Ejemplo n.º 28
0
        private Document fillContent(Document doc, Realizacija_osiguranja ro, TextFrame addressFrame, Table table)
        {
            Osoba o = ro.Stavka_u_realizaciji.Where(s => s.Nosilac_Stavka_u_realiziciji == true).FirstOrDefault().Osoba;

            Paragraph paragraph = addressFrame.AddParagraph();

            paragraph.AddText(o.Ime_Osoba + " " + o.Prezime_Osoba);
            paragraph.AddLineBreak();
            paragraph.AddText(o.Adresa_Osoba);
            paragraph.AddLineBreak();
            paragraph.AddText(o.E_mail_Osoba);

            Row row;

            for (int i = 0; i < ro.Stavka_u_realizaciji.Count; i++)
            {
                Stavka_u_realizaciji sur = ro.Stavka_u_realizaciji.ElementAt(i);

                row                        = table.AddRow();
                row.TopPadding             = 1.5;
                row.Cells[0].Shading.Color = new Color(242, 242, 242);
                row.Cells[2].Shading.Color = new Color(242, 242, 242);

                row.Cells[0].AddParagraph((i + 1).ToString());

                if (sur.Osoba != null)
                {
                    row.Cells[1].AddParagraph(sur.Osoba.Ime_Osoba + " " + sur.Osoba.Prezime_Osoba + ", " + sur.Osoba.Broj_pasosa_Osoba);
                }
                else
                {
                    if (sur.Nekretnina != null)
                    {
                        row.Cells[1].AddParagraph("Nekretnina na adresi: " + sur.Nekretnina.Adresa_Nekretnina);
                    }
                    else
                    {
                        if (sur.Vozilo != null)
                        {
                            row.Cells[1].AddParagraph("Vozilo sa brojem šasije: " + sur.Vozilo.Broj_sasije_Vozilo);
                        }
                    }
                }


                row.Cells[2].AddParagraph(sur.Vrednost_Stavka_u_realizaciji.ToString());
            }


            row               = table.AddRow();
            row.TopPadding    = 1.5;
            row.Shading.Color = new Color(242, 242, 242);

            row.Cells[1].AddParagraph("Ukupna cena polise: " + ro.Ukupna_vrednost_Realizacija_osiguranja);

            return(doc);
        }
Ejemplo n.º 29
0
        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);
        }
Ejemplo n.º 30
0
        private void showPageNumber()
        {
            Paragraph pageNumber = new Paragraph();

            pageNumber.AddText("Page ");
            pageNumber.AddPageField();
            pageNumber.AddText(" of ");
            pageNumber.AddNumPagesField();
            section.Footers.Primary.Add(pageNumber);
        }