コード例 #1
0
        private void BillingTotal(Table table, TotalRow total)
        {
            table.Columns[4].Format.Alignment = ParagraphAlignment.Center;

            Row row = table.AddRow();

            row.Style = "TableRow";

            string font; Color shading;

            if (total.Inverse == true)
            {
                font    = "H2-9B-Inverse";
                shading = MigraDocHelpers.TextColorFromHtml(Invoice.TextColor);
            }
            else
            {
                font    = "H2-9B";
                shading = MigraDocHelpers.BackColorFromHtml(Invoice.BackColor);
            }

            Cell cell = row.Cells[3];

            cell.Shading.Color = shading;
            cell.AddParagraph(total.Name, ParagraphAlignment.Left, font);

            cell = row.Cells[4];
            cell.Shading.Color = shading;
            cell.AddParagraph(total.Value.ToCurrency(Invoice.Currency), ParagraphAlignment.Center, font);
        }
コード例 #2
0
        private void PaymentSection()
        {
            Section section = Pdf.LastSection;

            Table table = section.AddTable();

            table.AddColumn(Unit.FromPoint(section.Document.PageWidth()));
            Row row = table.AddRow();

            if (Invoice.Details != null && Invoice.Details.Count > 0)
            {
                foreach (DetailRow detail in Invoice.Details)
                {
                    row.Cells[0].AddParagraph(detail.Title, ParagraphAlignment.Left, "H2-9B-Color");
                    row.Cells[0].Borders.Bottom = BorderLine;

                    row = table.AddRow();
                    TextFrame frame = null;
                    foreach (string line in detail.Paragraphs)
                    {
                        if (line == detail.Paragraphs[0])
                        {
                            frame       = row.Cells[0].AddTextFrame();
                            frame.Width = section.Document.PageWidth();
                        }
                        frame.AddParagraph(line, ParagraphAlignment.Left, "H2-9");
                    }
                }
            }

            if (Invoice.Company.HasCompanyNumber || Invoice.Company.HasVatNumber)
            {
                row = table.AddRow();

                Color shading = MigraDocHelpers.TextColorFromHtml(Invoice.TextColor);

                if (Invoice.Company.HasCompanyNumber && Invoice.Company.HasVatNumber)
                {
                    row.Cells[0].AddParagraph(string.Format("Company Number: {0}, VAT Number: {1}",
                                                            Invoice.Company.CompanyNumber, Invoice.Company.VatNumber),
                                              ParagraphAlignment.Center, "H2-9B-Inverse")
                    .Format.Shading.Color = shading;
                }
                else
                {
                    if (Invoice.Company.HasCompanyNumber)
                    {
                        row.Cells[0].AddParagraph(string.Format("Company Number: {0}", Invoice.Company.CompanyNumber),
                                                  ParagraphAlignment.Center, "H2-9B-Inverse")
                        .Format.Shading.Color = shading;
                    }
                    else
                    {
                        row.Cells[0].AddParagraph(string.Format("VAT Number: {0}", Invoice.Company.VatNumber),
                                                  ParagraphAlignment.Center, "H2-9B-Inverse")
                        .Format.Shading.Color = shading;
                    }
                }
            }
        }
コード例 #3
0
ファイル: PdfInvoice.cs プロジェクト: Triskae/InvoiceSharp
        private void DefineStyles()
        {
            MigraDoc.DocumentObjectModel.Style style = Pdf.Styles["Normal"];
            style.Font.Name = "Calibri";

            style           = Pdf.Styles.AddStyle("H1-20", "Normal");
            style.Font.Size = 20;
            style.Font.Bold = true;

            style            = Pdf.Styles.AddStyle("H1-20-Red", "H1-20");
            style.Font.Color = Colors.Red;

            style            = Pdf.Styles.AddStyle("H1-20-Green", "H1-20");
            style.Font.Color = Colors.Green;

            style           = Pdf.Styles.AddStyle("H2-8", "Normal");
            style.Font.Size = 8;

            style = Pdf.Styles.AddStyle("H2-8-Blue", "H2-8");
            style.ParagraphFormat.Font.Color = Colors.Blue;

            style           = Pdf.Styles.AddStyle("H2-8B", "H2-8");
            style.Font.Bold = true;

            style           = Pdf.Styles.AddStyle("H2-9", "Normal");
            style.Font.Size = 9;

            style            = Pdf.Styles.AddStyle("H2-9-Grey", "H2-9");
            style.Font.Color = Colors.Gray;

            style           = Pdf.Styles.AddStyle("H2-9B", "H2-9");
            style.Font.Bold = true;

            style = Pdf.Styles.AddStyle("H2-9B-Inverse", "H2-9B");
            style.ParagraphFormat.Font.Color = Colors.White;

            style            = Pdf.Styles.AddStyle("H2-9B-Color", "H2-9B");
            style.Font.Color = MigraDocHelpers.TextColorFromHtml(Invoice.TextColor);

            style           = Pdf.Styles.AddStyle("H2-10", "Normal");
            style.Font.Size = 10;

            style            = Pdf.Styles.AddStyle("H2-10-Red", "H2-10");
            style.Font.Color = Colors.Red;

            style           = Pdf.Styles.AddStyle("H2-10B", "H2-10");
            style.Font.Bold = true;

            style            = Pdf.Styles.AddStyle("H2-10B-Color", "H2-10B");
            style.Font.Color = MigraDocHelpers.TextColorFromHtml(Invoice.TextColor);
        }
コード例 #4
0
        private void PaymentSection()
        {
            Section section = Pdf.LastSection;

            Table table = section.AddTable();

            table.AddColumn(Unit.FromPoint(section.Document.PageWidth()));
            Row row = table.AddRow();

            if (Invoice.Details != null && Invoice.Details.Count > 0)
            {
                foreach (DetailRow detail in Invoice.Details)
                {
                    row.Cells[0].AddParagraph(detail.Title, ParagraphAlignment.Left, "H2-9B-Color");
                    row.Cells[0].Borders.Bottom = BorderLine;

                    row = table.AddRow();
                    TextFrame frame = null;
                    foreach (string line in detail.Paragraphs)
                    {
                        //if (line == detail.Paragraphs[0])
                        //{
                        //    frame = row.Cells[0].AddTextFrame();
                        //    frame.Width = section.Document.PageWidth();
                        //}
                        //frame.AddParagraph("X - " + line, ParagraphAlignment.Left, "H2-9");
                        Paragraph name = row.Cells[0].AddParagraph();
                        name.AddFormattedText(line, "H2-9-Grey");
                    }
                }
            }

            if (Invoice.Company.HasLegalTextLines)
            {
                row = table.AddRow();

                Color shading = MigraDocHelpers.TextColorFromHtml(Invoice.TextColor);

                foreach (var line in Invoice.Company.LegalTextLines)
                {
                    row.Cells[0].AddParagraph(line, ParagraphAlignment.Center, "H2-9B-Inverse")
                    .Format.Shading.Color = shading;
                }
            }
        }