예제 #1
0
        private void ProcessVerticalAlign(DocxNode node, RunProperties properties)
        {
            string verticalAlign = node.ExtractStyleValue(DocxAlignment.verticalAlign);

            if (!string.IsNullOrEmpty(verticalAlign))
            {
                DocxAlignment.ApplyVerticalTextAlign(verticalAlign, properties);
            }
        }
        private void ProcessVerticalAlignment(DocxNode node, TableCellProperties cellProperties)
        {
            string alignment = node.ExtractStyleValue(DocxAlignment.verticalAlign);

            if (!string.IsNullOrEmpty(alignment))
            {
                if (DocxAlignment.GetCellVerticalAlignment(alignment, out TableVerticalAlignmentValues value))
                {
                    cellProperties.Append(new TableCellVerticalAlignment()
                    {
                        Val = value
                    });
                }
            }
        }
        internal void Process(Paragraph element, DocxNode node)
        {
            ParagraphProperties properties = element.ParagraphProperties;

            if (properties == null)
            {
                properties = new ParagraphProperties();
            }

            //Order of assigning styles to paragraph property is important. The order should not change.
            ProcessBorder(node, properties);

            string backgroundColor = node.ExtractStyleValue(DocxColor.backGroundColor);
            string backGround      = DocxColor.ExtractBackGround(node.ExtractStyleValue(DocxColor.backGround));

            if (!string.IsNullOrEmpty(backgroundColor))
            {
                DocxColor.ApplyBackGroundColor(backgroundColor, properties);
            }
            else if (!string.IsNullOrEmpty(backGround))
            {
                DocxColor.ApplyBackGroundColor(backGround, properties);
            }

            DocxMargin margin = new DocxMargin(node);

            margin.ProcessParagraphMargin(properties);

            string textAlign = node.ExtractStyleValue(DocxAlignment.textAlign);

            if (!string.IsNullOrEmpty(textAlign))
            {
                DocxAlignment.ApplyTextAlign(textAlign, properties);
            }

            if (element.ParagraphProperties == null && properties.HasChildren)
            {
                element.ParagraphProperties = properties;
            }
        }