Пример #1
0
            public PdfGrid RenderingGroupHeader(Document pdfDoc, PdfWriter pdfWriter, IList <CellData> newGroupInfo, IList <SummaryCellData> summaryData)
            {
                var idDokumenta    = newGroupInfo.GetSafeStringValueOf(nameof(StavkaDenorm.IdDokumenta));
                var urlDokumenta   = newGroupInfo.GetSafeStringValueOf(nameof(StavkaDenorm.UrlDokumenta));
                var nazPartnera    = newGroupInfo.GetSafeStringValueOf(nameof(StavkaDenorm.NazPartnera));
                var datDokumenta   = (DateTime)newGroupInfo.GetValueOf(nameof(StavkaDenorm.DatDokumenta));
                var iznosDokumenta = (decimal)newGroupInfo.GetValueOf(nameof(StavkaDenorm.IznosDokumenta));

                var table = new PdfGrid(relativeWidths: new[] { 2f, 5f, 2f, 3f })
                {
                    WidthPercentage = 100
                };

                table.AddSimpleRow(
                    (cellData, cellProperties) =>
                {
                    cellData.Value                     = "Id dokumenta:";
                    cellProperties.PdfFont             = PdfRptFont;
                    cellProperties.PdfFontStyle        = DocumentFontStyle.Bold;
                    cellProperties.HorizontalAlignment = HorizontalAlignment.Left;
                },
                    (cellData, cellProperties) =>
                {
                    cellData.TableRowData = newGroupInfo; //postavi podatke retka za ćeliju
                    var cellTemplate      = new HyperlinkField(BaseColor.Black, false)
                    {
                        TextPropertyName          = nameof(StavkaDenorm.IdDokumenta),
                        NavigationUrlPropertyName = nameof(StavkaDenorm.UrlDokumenta),
                        BasicProperties           = new CellBasicProperties
                        {
                            HorizontalAlignment = HorizontalAlignment.Left,
                            PdfFontStyle        = DocumentFontStyle.Bold,
                            PdfFont             = PdfRptFont
                        }
                    };

                    cellData.CellTemplate              = cellTemplate;
                    cellProperties.PdfFont             = PdfRptFont;
                    cellProperties.HorizontalAlignment = HorizontalAlignment.Left;
                },
                    (cellData, cellProperties) =>
                {
                    cellData.Value                     = "Datum dokumenta:";
                    cellProperties.PdfFont             = PdfRptFont;
                    cellProperties.PdfFontStyle        = DocumentFontStyle.Bold;
                    cellProperties.HorizontalAlignment = HorizontalAlignment.Left;
                },
                    (cellData, cellProperties) =>
                {
                    cellData.Value                      = datDokumenta;
                    cellProperties.PdfFont              = PdfRptFont;
                    cellProperties.HorizontalAlignment  = HorizontalAlignment.Left;
                    cellProperties.DisplayFormatFormula = obj => ((DateTime)obj).ToString("dd.MM.yyyy");
                });

                table.AddSimpleRow(
                    (cellData, cellProperties) =>
                {
                    cellData.Value                     = "Partner:";
                    cellProperties.PdfFont             = PdfRptFont;
                    cellProperties.PdfFontStyle        = DocumentFontStyle.Bold;
                    cellProperties.HorizontalAlignment = HorizontalAlignment.Left;
                },
                    (cellData, cellProperties) =>
                {
                    cellData.Value                     = nazPartnera;
                    cellProperties.PdfFont             = PdfRptFont;
                    cellProperties.HorizontalAlignment = HorizontalAlignment.Left;
                },
                    (cellData, cellProperties) =>
                {
                    cellData.Value                     = "Iznos dokumenta:";
                    cellProperties.PdfFont             = PdfRptFont;
                    cellProperties.PdfFontStyle        = DocumentFontStyle.Bold;
                    cellProperties.HorizontalAlignment = HorizontalAlignment.Left;
                },
                    (cellData, cellProperties) =>
                {
                    cellData.Value = iznosDokumenta;
                    cellProperties.DisplayFormatFormula = obj => ((decimal)obj).ToString("C2");
                    cellProperties.PdfFont             = PdfRptFont;
                    cellProperties.HorizontalAlignment = HorizontalAlignment.Left;
                });
                return(table.AddBorderToTable(borderColor: BaseColor.LightGray, spacingBefore: 5f));
            }