Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 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"));
            }
        }
Exemplo n.º 6
0
        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"));
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 9
0
        private void SetThStyleToRun(DocxNode run)
        {
            string value = run.ExtractStyleValue(DocxFontStyle.fontWeight);

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

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

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

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

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

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);
            ProcessTextChild(node, properties);
        }
Exemplo n.º 15
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

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

            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine);
            ProcessTextChild(node);
        }
Exemplo n.º 17
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.textDecoration, DocxFontStyle.underLine);
            ProcessTextChild(node);
        }
Exemplo n.º 18
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxFontStyle.fontWeight, DocxFontStyle.bold);
            ProcessTextChild(node);
        }
Exemplo n.º 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);
        }
Exemplo n.º 21
0
        void ITextElement.Process(DocxNode node)
        {
            if (IsHidden(node))
            {
                return;
            }

            node.SetExtentedStyle(DocxAlignment.textAlign, DocxAlignment.center);
            ProcessTextChild(node);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 27
0
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 34
0
 internal void SetLeftMargin(string value)
 {
     node.SetExtentedStyle(marginLeft, value);
 }