private void ApplyStyle(DocxNode node)
        {
            string fontFamily = node.ExtractOwnStyleValue(DocxFontStyle.fontFamily);

            if (string.IsNullOrEmpty(fontFamily))
            {
                string face = node.ExtractAttributeValue("face");

                if (!string.IsNullOrEmpty(face))
                {
                    node.SetExtentedStyle(DocxFontStyle.fontFamily, face);
                }
            }

            string fontSize = node.ExtractOwnStyleValue(DocxFontStyle.fontSize);

            if (string.IsNullOrEmpty(fontSize))
            {
                SetFontSize(node);
            }

            string color = node.ExtractOwnStyleValue(DocxColor.color);

            if (string.IsNullOrEmpty(color))
            {
                color = node.ExtractAttributeValue("color");

                if (!string.IsNullOrEmpty(color))
                {
                    node.SetExtentedStyle(DocxColor.color, color);
                }
            }
        }
示例#2
0
        private void ApplyStyle(DocxNode node)
        {
            string fontFamily = node.ExtractOwnStyleValue(DocxFontStyle.fontFamily);

            if (string.IsNullOrEmpty(fontFamily))
            {
                string face = node.ExtractAttributeValue("face");

                if (!string.IsNullOrEmpty(face))
                {
                    node.SetExtentedStyle(DocxFontStyle.fontFamily, face);
                }
            }

            string fontSize = node.ExtractOwnStyleValue(DocxFontStyle.fontSize);

            if (string.IsNullOrEmpty(fontSize))
            {
                SetFontSize(node);
            }

            string color = node.ExtractOwnStyleValue(DocxColor.color);

            if(string.IsNullOrEmpty(color))
            {
                color = node.ExtractAttributeValue("color");

                if(!string.IsNullOrEmpty(color))
                {
                    node.SetExtentedStyle(DocxColor.color, color);
                }
            }
        }
        private void ApplyStyle(DocxNode node)
        {
            string fontSizeValue   = node.ExtractOwnStyleValue(DocxFontStyle.fontSize);
            string fontWeightValue = node.ExtractOwnStyleValue(DocxFontStyle.fontWeight);

            if (string.IsNullOrEmpty(fontSizeValue))
            {
                string headingFontSize = CalculateFontSize(GetHeaderNumber(node));
                string inheritedStyle  = node.ExtractInheritedStyleValue(DocxFontStyle.fontSize);

                if (!string.IsNullOrEmpty(inheritedStyle))
                {
                    fontSizeValue = string.Concat(
                        context.Parser.CalculateRelativeChildFontSize(
                            inheritedStyle, headingFontSize).ToString("G29"), "px");
                }
                else
                {
                    fontSizeValue = headingFontSize;
                }
            }

            if (string.IsNullOrEmpty(fontWeightValue))
            {
                fontWeightValue = DocxFontStyle.bold;
            }

            node.SetExtentedStyle(DocxFontStyle.fontSize, fontSizeValue);
            node.SetExtentedStyle(DocxFontStyle.fontWeight, fontWeightValue);
        }
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || node.Parent == null || IsHidden(node))
            {
                return;
            }

            paragraph = null;
            Paragraph centerParagraph = null;
            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);

            ProcessBlockElement(node, ref centerParagraph);
        }
示例#5
0
        private void SetFontSize(DocxNode node)
        {
            string size = node.ExtractAttributeValue("size");

            if (string.IsNullOrEmpty(size))
            {
                return;
            }

            Match match = Regex.Match(size, "^\\d+");
            Int32 sizeValue;
            Int32 fontSizeValue = 0;

            if (!match.Success || !Int32.TryParse(match.Value, out sizeValue))
            {
                return;
            }

            if (!fontSizes.TryGetValue(sizeValue, out fontSizeValue))
            {
                if (sizeValue > 7)
                {
                    fontSizeValue = 48;
                }
            }

            if (fontSizeValue != 0)
            {
                node.SetExtentedStyle(DocxFontStyle.fontSize, string.Concat(fontSizeValue.ToString(), "px"));
            }
        }
        private void SetFontSize(DocxNode node)
        {
            string size = node.ExtractAttributeValue("size");

            if (string.IsNullOrEmpty(size))
            {
                return;
            }

            Match match = Regex.Match(size, "^\\d+");

            if (!match.Success || !Int32.TryParse(match.Value, out int sizeValue))
            {
                return;
            }

            if (!fontSizes.TryGetValue(sizeValue, out int fontSizeValue))
            {
                if (sizeValue > 7)
                {
                    fontSizeValue = 48;
                }
            }

            if (fontSizeValue != 0)
            {
                node.SetExtentedStyle(DocxFontStyle.fontSize, string.Concat(fontSizeValue.ToString(), "px"));
            }
        }
示例#7
0
        internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties)
        {
            if (node.IsNull() || node.Parent == null || IsHidden(node))
            {
                return;
            }

            paragraph = null;
            Paragraph centerParagraph = null;

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);

            ProcessBlockElement(node, ref centerParagraph, properties);
        }
示例#8
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || node.Parent == null || IsHidden(node))
            {
                return;
            }

            paragraph = null;
            Paragraph centerParagraph = null;

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);

            ProcessBlockElement(node, ref centerParagraph);
        }
示例#9
0
        private void SetThStyleToRun(DocxNode run)
        {
            string value = run.ExtractStyleValue(DocxFontStyle.fontWeight);

            if (string.IsNullOrEmpty(value))
            {
                run.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);
            }
        }
示例#10
0
        private void SetThStyleToRun(DocxNode run)
        {
            string value = run.ExtractStyleValue(DocxFontStyle.fontWeight);

            if (string.IsNullOrEmpty(value))
            {
                run.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);
            }
        }
示例#11
0
        private void SetStyle(DocxNode node)
        {
            string value = node.ExtractStyleValue(DocxFontStyle.italic);

            if (string.IsNullOrEmpty(value))
            {
                node.SetExtentedStyle(DocxFontStyle.fontStyle, DocxFontStyle.italic);
            }
        }
示例#12
0
        private void SetStyle(DocxNode node)
        {
            string value = node.ExtractStyleValue(DocxFontStyle.italic);

            if (string.IsNullOrEmpty(value))
            {
                node.SetExtentedStyle(DocxFontStyle.fontStyle, DocxFontStyle.italic);
            }
        }
示例#13
0
        void ITextElement.Process(DocxNode node, Dictionary <string, object> properties)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);
            ProcessTextChild(node, properties);
        }
示例#14
0
        void ITextElement.Process(DocxNode node, Dictionary <string, object> properties)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);
            ProcessTextChild(node, properties);
        }
示例#15
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);
            ProcessTextChild(node);
        }
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine);
            ProcessTextChild(node);
        }
示例#17
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine);
            ProcessTextChild(node);
        }
示例#18
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);
            ProcessTextChild(node);
        }
示例#19
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);
            ProcessTextChild(node);
        }
        void ITextElement.Process(DocxNode node, Dictionary <string, object> properties)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine);
            ProcessTextChild(node, properties);
        }
示例#21
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);
            ProcessTextChild(node);
        }
示例#22
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.lineThrough);

            ProcessElement(node, ref paragraph);
        }
示例#23
0
        internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxAlignment.verticalAlign, DocxAlignment.super);

            ProcessElement(node, ref paragraph, properties);
        }
示例#24
0
        internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);

            ProcessElement(node, ref paragraph, properties);
        }
示例#25
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);

            ProcessElement(node, ref paragraph);
        }
示例#26
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxAlignment.verticalAlign, DocxAlignment.sub);

            ProcessElement(node, ref paragraph);
        }
        internal override void Process(DocxNode node, ref Paragraph paragraph, Dictionary <string, object> properties)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.lineThrough);

            ProcessElement(node, ref paragraph, properties);
        }
示例#28
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxAlignment.verticalAlign, DocxAlignment.sub);

            ProcessElement(node, ref paragraph);
        }
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }
            
            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine);

            ProcessElement(node, ref paragraph);
        }
示例#30
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);

            ProcessElement(node, ref paragraph);
        }
示例#31
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || node.Parent == null || IsHidden(node))
            {
                return;
            }

            //Address tag also creats a new block element. Thus clear the existing paragraph
            paragraph = null;
            Paragraph addrParagraph = null;
            node.SetExtentedStyle(DocxFontStyle.fontStyle, DocxFontStyle.italic);

            ProcessBlockElement(node, ref addrParagraph);
        }
示例#32
0
        internal override void Process(DocxNode node, ref Paragraph paragraph)
        {
            if (node.IsNull() || node.Parent == null || IsHidden(node))
            {
                return;
            }

            //Address tag also creats a new block element. Thus clear the existing paragraph
            paragraph = null;
            Paragraph addrParagraph = null;

            node.SetExtentedStyle(DocxFontStyle.fontStyle, DocxFontStyle.italic);

            ProcessBlockElement(node, ref addrParagraph);
        }
示例#33
0
        private void ApplyStyle(DocxNode node)
        {
            string fontSizeValue = node.ExtractOwnStyleValue(DocxFontStyle.fontSize);
            string fontWeightValue = node.ExtractOwnStyleValue(DocxFontStyle.fontWeight);

            if (string.IsNullOrEmpty(fontSizeValue))
            {
                string headingFontSize = CalculateFontSize(GetHeaderNumber(node));
                string inheritedStyle = node.ExtractInheritedStyleValue(DocxFontStyle.fontSize);

                if (!string.IsNullOrEmpty(inheritedStyle))
                {
                    fontSizeValue = string.Concat(
                        context.Parser.CalculateRelativeChildFontSize(
                        inheritedStyle, headingFontSize).ToString("G29"), "px");
                }
                else
                {
                    fontSizeValue = headingFontSize;
                }
            }

            if (string.IsNullOrEmpty(fontWeightValue))
            {
                fontWeightValue = DocxFontStyle.bold;
            }

            node.SetExtentedStyle(DocxFontStyle.fontSize, fontSizeValue);
            node.SetExtentedStyle(DocxFontStyle.fontWeight, fontWeightValue);
        }
示例#34
0
 internal void SetLeftMargin(string value)
 {
     node.SetExtentedStyle(marginLeft, value);
 }