PdfRpt.Core.Helper.TableCellDefinitionsExt.MapBasicPropertiesTo C# (CSharp) Method

MapBasicPropertiesTo() public static method

Maps ItemTemplate.BasicProperties to pdfRptTableCellDefinition.BasicProperties.
public static MapBasicPropertiesTo ( this fromPdfCellAttributes, CellBasicProperties toPdfCellAttributes ) : void
fromPdfCellAttributes this From PdfCell Attributes
toPdfCellAttributes PdfRpt.Core.Contracts.CellBasicProperties To PdfCell Attributes
return void
        public static void MapBasicPropertiesTo(this CellBasicProperties fromPdfCellAttributes, CellBasicProperties toPdfCellAttributes)
        {
            if (fromPdfCellAttributes != null)
            {
                var borderWidth = fromPdfCellAttributes.BorderWidth;
                if (borderWidth > 0)
                    toPdfCellAttributes.BorderWidth = borderWidth;

                var cellPadding = fromPdfCellAttributes.CellPadding;
                if (cellPadding > 0)
                    toPdfCellAttributes.CellPadding = cellPadding;

                var fixedHeight = fromPdfCellAttributes.FixedHeight;
                if (fixedHeight > 0)
                    toPdfCellAttributes.FixedHeight = fixedHeight;

                var minimumHeight = fromPdfCellAttributes.MinimumHeight;
                if (minimumHeight > 0)
                    toPdfCellAttributes.MinimumHeight = minimumHeight;

                var fontColor = fromPdfCellAttributes.FontColor;
                if (fontColor != null)
                    toPdfCellAttributes.FontColor = fontColor;

                var backgroundColor = fromPdfCellAttributes.BackgroundColor;
                if (backgroundColor != null)
                    toPdfCellAttributes.BackgroundColor = backgroundColor;

                var pdfFont = fromPdfCellAttributes.PdfFont;
                if (pdfFont != null)
                    toPdfCellAttributes.PdfFont = pdfFont;

                var rotation = fromPdfCellAttributes.Rotation;
                if (rotation != 0)
                    toPdfCellAttributes.Rotation = rotation;

                var runDirection = fromPdfCellAttributes.RunDirection;
                if (runDirection != null && runDirection != PdfRunDirection.None)
                    toPdfCellAttributes.RunDirection = runDirection;

                var horizontalAlignment = fromPdfCellAttributes.HorizontalAlignment;
                if (horizontalAlignment != null && horizontalAlignment != HorizontalAlignment.None)
                    toPdfCellAttributes.HorizontalAlignment = horizontalAlignment;

                var displayFormatFormula = fromPdfCellAttributes.DisplayFormatFormula;
                if (displayFormatFormula != null && toPdfCellAttributes.DisplayFormatFormula == null)
                    toPdfCellAttributes.DisplayFormatFormula = displayFormatFormula;
            }
        }