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);
        }
예제 #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);
                }
            }
        }
예제 #3
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);
                }
            }
        }
예제 #4
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);
        }