private TableCellTextStyle GetTableCellTextStyle(bool create)
        {
            TablePartStyleType tablePartStyleType = this.tablePartStyleTypeGenerator(true);
            TableCellTextStyle result             = tablePartStyleType.TableCellTextStyle;

            if (result == null && create)
            {
                result = new TableCellTextStyle();
                tablePartStyleType.TableCellTextStyle = result;
            }

            return(result);
        }
Exemplo n.º 2
0
        public ITablePartStyle SetFontColor(OpenXmlColor color)
        {
            TableCellTextStyle tableCellTextStyle = this.tableCellTextStyleGenerator(true);

            tableCellTextStyle.RemoveAllChildren <SchemeColor>();
            tableCellTextStyle.RemoveAllChildren <HslColor>();
            tableCellTextStyle.RemoveAllChildren <RgbColorModelHex>();
            tableCellTextStyle.RemoveAllChildren <RgbColorModelPercentage>();
            tableCellTextStyle.RemoveAllChildren <SystemColor>();
            tableCellTextStyle.RemoveAllChildren <PresetColor>();

            tableCellTextStyle.AppendChild(color.CreateColorElement());

            return(this.result);
        }
Exemplo n.º 3
0
        public ITablePartStyle SetFont(OpenXmlFontRef fontRef)
        {
            TableCellTextStyle tableCellTextStyle = this.tableCellTextStyleGenerator(true);

            tableCellTextStyle.RemoveAllChildren <FontReference>();
            tableCellTextStyle.RemoveAllChildren <Fonts>();

            FontReference element = new FontReference
            {
                Index = (FontCollectionIndexValues)fontRef.Index
            };

            if (fontRef.Color != null)
            {
                element.AppendChild(fontRef.Color.CreateColorElement());
            }

            tableCellTextStyle.PrependChild(element);

            return(this.result);
        }
Exemplo n.º 4
0
        public ITablePartStyle SetFont(string typeface)
        {
            TableCellTextStyle tableCellTextStyle = this.tableCellTextStyleGenerator(true);

            tableCellTextStyle.RemoveAllChildren <FontReference>();
            tableCellTextStyle.RemoveAllChildren <Fonts>();


            tableCellTextStyle.PrependChild(
                new Fonts(
                    new LatinFont()
            {
                Typeface = typeface
            },
                    new ComplexScriptFont()
            {
                Typeface = typeface
            }
                    )
                );

            return(this.result);
        }