private void ProcessTableCellMargin(DocxTableProperties docxProperties, TableProperties tableProperties)
        {
            if (docxProperties.CellPadding != null)
            {
                TableCellMarginDefault cellMargin = new TableCellMarginDefault();
                Int16 width = (Int16)DocxUnits.GetDxaFromPixel(docxProperties.CellPadding.Value);

                cellMargin.TableCellLeftMargin = new TableCellLeftMargin()
                {
                    Width = width,
                    Type  = TableWidthValues.Dxa
                };

                cellMargin.TopMargin = new TopMargin()
                {
                    Width = width.ToString(),
                    Type  = TableWidthUnitValues.Dxa
                };

                cellMargin.TableCellRightMargin = new TableCellRightMargin()
                {
                    Width = width,
                    Type  = TableWidthValues.Dxa
                };

                cellMargin.BottomMargin = new BottomMargin()
                {
                    Width = width.ToString(),
                    Type  = TableWidthUnitValues.Dxa
                };

                tableProperties.Append(cellMargin);
            }
        }
Exemple #2
0
        internal void Process(TableRow row, DocxTableProperties docxProperties)
        {
            TableRowProperties trProperties = new TableRowProperties();

            if (docxProperties.CellSpacing != null)
            {
                trProperties.Append(new TableCellSpacing()
                {
                    Width = DocxUnits.GetDxaFromPixel(docxProperties.CellSpacing.Value).ToString(),
                    Type  = TableWidthUnitValues.Dxa
                });
            }

            if (trProperties.ChildElements.Count > 0)
            {
                row.Append(trProperties);
            }
        }