コード例 #1
0
        private void ProcessWidth(DocxNode node, TableProperties tableProperties)
        {
            string width      = node.ExtractAttributeValue(DocxUnits.width);
            string styleWidth = node.ExtractStyleValue(DocxUnits.width);

            if (!string.IsNullOrEmpty(styleWidth))
            {
                width = styleWidth;
            }

            if (!string.IsNullOrEmpty(width))
            {
                decimal value;
                TableWidthUnitValues unit;

                if (DocxUnits.TableUnitsFromStyle(width, out value, out unit))
                {
                    TableWidth tableWidth = new TableWidth()
                    {
                        Width = value.ToString(),
                        Type  = unit
                    };
                    tableProperties.Append(tableWidth);
                }
            }
        }
コード例 #2
0
        private void ProcessWidth(DocxNode node, TableCellProperties cellProperties)
        {
            string width = node.ExtractStyleValue(DocxUnits.width);

            if (!string.IsNullOrEmpty(width))
            {
                if (DocxUnits.TableUnitsFromStyle(width, out decimal value, out TableWidthUnitValues unit))
                {
                    TableCellWidth cellWidth = new TableCellWidth()
                    {
                        Width = value.ToString(),
                        Type  = unit
                    };

                    cellProperties.Append(cellWidth);
                }
            }
        }