Xml access class xfs records. This is the top level style object.
Inheritance: OfficeOpenXml.Style.XmlAccess.StyleXmlHelper
コード例 #1
0
ファイル: ExcelXfsXml.cs プロジェクト: Eagle-Chan/KIS
 internal ExcelXfs Copy(ExcelStyles styles)
 {
     ExcelXfs newXF = new ExcelXfs(NameSpaceManager, styles);
     newXF.NumberFormatId = _numFmtId;
     newXF.FontId = _fontId;
     newXF.FillId = _fillId;
     newXF.BorderId = _borderId;
     newXF.XfId = _xfID;
     newXF.ReadingOrder = _readingOrder;
     newXF.HorizontalAlignment = _horizontalAlignment;
     newXF.VerticalAlignment = _verticalAlignment;
     newXF.WrapText = _wrapText;
     newXF.ShrinkToFit = _shrinkToFit;
     newXF.Indent = _indent;
     newXF.TextRotation = _textRotation;
     newXF.Locked = _locked;
     newXF.Hidden = _hidden;
     return newXF;
 }
コード例 #2
0
ファイル: ExcelStyles.cs プロジェクト: GitOffice/DataPie
        /// <summary>
        /// Loads the style XML to memory
        /// </summary>
        private void LoadFromDocument()
        {
            //NumberFormats
            ExcelNumberFormatXml.AddBuildIn(NameSpaceManager, NumberFormats);
            XmlNode numNode = _styleXml.SelectSingleNode(NumberFormatsPath, _nameSpaceManager);
            if (numNode != null)
            {
                foreach (XmlNode n in numNode)
                {
                    ExcelNumberFormatXml nf = new ExcelNumberFormatXml(_nameSpaceManager, n);
                    NumberFormats.Add(nf.Id, nf);
                    if (nf.NumFmtId >= NumberFormats.NextId) NumberFormats.NextId=nf.NumFmtId+1;
                }
            }

            //Fonts
            XmlNode fontNode = _styleXml.SelectSingleNode(FontsPath, _nameSpaceManager);
            foreach (XmlNode n in fontNode)
            {
                ExcelFontXml f = new ExcelFontXml(_nameSpaceManager, n);
                Fonts.Add(f.Id, f);
            }

            //Fills
            XmlNode fillNode = _styleXml.SelectSingleNode(FillsPath, _nameSpaceManager);
            foreach (XmlNode n in fillNode)
            {
                ExcelFillXml f;
                if (n.FirstChild != null && n.FirstChild.LocalName == "gradientFill")
                {
                    f = new ExcelGradientFillXml(_nameSpaceManager, n);
                }
                else
                {
                    f = new ExcelFillXml(_nameSpaceManager, n);
                }
                Fills.Add(f.Id, f);
            }

            //Borders
            XmlNode borderNode = _styleXml.SelectSingleNode(BordersPath, _nameSpaceManager);
            foreach (XmlNode n in borderNode)
            {
                ExcelBorderXml b = new ExcelBorderXml(_nameSpaceManager, n);
                Borders.Add(b.Id, b);
            }

            //cellStyleXfs
            XmlNode styleXfsNode = _styleXml.SelectSingleNode(CellStyleXfsPath, _nameSpaceManager);
            if (styleXfsNode != null)
            {
                foreach (XmlNode n in styleXfsNode)
                {
                    ExcelXfs item = new ExcelXfs(_nameSpaceManager, n, this);
                    CellStyleXfs.Add(item.Id, item);
                }
            }

            XmlNode styleNode = _styleXml.SelectSingleNode(CellXfsPath, _nameSpaceManager);
            for (int i = 0; i < styleNode.ChildNodes.Count; i++)
            {
                XmlNode n = styleNode.ChildNodes[i];
                ExcelXfs item = new ExcelXfs(_nameSpaceManager, n, this);
                CellXfs.Add(item.Id, item);
            }

            //cellStyle
            XmlNode namedStyleNode = _styleXml.SelectSingleNode(CellStylesPath, _nameSpaceManager);
            if (namedStyleNode != null)
            {
                foreach (XmlNode n in namedStyleNode)
                {
                    ExcelNamedStyleXml item = new ExcelNamedStyleXml(_nameSpaceManager, n, this);
                    NamedStyles.Add(item.Name, item);
                }
            }

            //dxfsPath
            XmlNode dxfsNode = _styleXml.SelectSingleNode(dxfsPath, _nameSpaceManager);
            if (dxfsNode != null)
            {
                foreach (XmlNode x in dxfsNode)
                {
                    ExcelDxfStyleConditionalFormatting item = new ExcelDxfStyleConditionalFormatting(_nameSpaceManager, x, this);
                    Dxfs.Add(item.Id, item);
                }
            }
        }
コード例 #3
0
ファイル: ExcelXfsXml.cs プロジェクト: Eagle-Chan/KIS
 internal void RegisterEvent(ExcelXfs xf)
 {
     //                RegisterEvent(xf, xf.Xf_ChangedEvent);
 }
コード例 #4
0
ファイル: ExcelStyles.cs プロジェクト: huoxudong125/EPPlus
        /// <summary>
        /// Loads the style XML to memory
        /// </summary>
        private void LoadFromDocument()
        {
            //NumberFormats
            ExcelNumberFormatXml.AddBuildIn(NameSpaceManager, NumberFormats);
            XmlNode numNode = _styleXml.SelectSingleNode(NumberFormatsPath, _nameSpaceManager);
            if (numNode != null)
            {
                foreach (XmlNode n in numNode)
                {
                    ExcelNumberFormatXml nf = new ExcelNumberFormatXml(_nameSpaceManager, n);
                    NumberFormats.Add(nf.Id, nf);
                    if (nf.NumFmtId >= NumberFormats.NextId) NumberFormats.NextId=nf.NumFmtId+1;
                }
            }

            //Fonts
            XmlNode fontNode = _styleXml.SelectSingleNode(FontsPath, _nameSpaceManager);
            foreach (XmlNode n in fontNode)
            {
                ExcelFontXml f = new ExcelFontXml(_nameSpaceManager, n);
                Fonts.Add(f.Id, f);
            }

            //Fills
            XmlNode fillNode = _styleXml.SelectSingleNode(FillsPath, _nameSpaceManager);
            foreach (XmlNode n in fillNode)
            {
                ExcelFillXml f = new ExcelFillXml(_nameSpaceManager, n);
                Fills.Add(f.Id, f);
            }

            //Borders
            XmlNode borderNode = _styleXml.SelectSingleNode(BordersPath, _nameSpaceManager);
            foreach (XmlNode n in borderNode)
            {
                ExcelBorderXml b = new ExcelBorderXml(_nameSpaceManager, n);
                Borders.Add(b.Id, b);
            }

            //cellStyleXfs
            XmlNode styleXfsNode = _styleXml.SelectSingleNode(CellStyleXfsPath, _nameSpaceManager);
            foreach (XmlNode n in styleXfsNode)
            {
                ExcelXfs item = new ExcelXfs(_nameSpaceManager, n, this);
                CellStyleXfs.Add(item.Id, item);
            }

            XmlNode styleNode = _styleXml.SelectSingleNode(CellXfsPath, _nameSpaceManager);
            for (int i = 0; i < styleNode.ChildNodes.Count; i++)
            {
                XmlNode n = styleNode.ChildNodes[i];
                ExcelXfs item = new ExcelXfs(_nameSpaceManager, n, this);
                CellXfs.Add(item.Id, item);
            }

            //cellStyle
            XmlNode namedStyleNode = _styleXml.SelectSingleNode(CellStylesPath, _nameSpaceManager);
            foreach (XmlNode n in namedStyleNode)
            {
                ExcelNamedStyleXml item = new ExcelNamedStyleXml(_nameSpaceManager, n, this);
                NamedStyles.Add(item.Name, item);
            }
        }
コード例 #5
0
ファイル: ExcelXfsXml.cs プロジェクト: huoxudong125/EPPlus
 internal ExcelXfs Copy()
 {
     ExcelXfs newXF = new ExcelXfs(NameSpaceManager, _styles);
     newXF.NumberFormatId = _numFmtId;
     newXF.FontId = _fontId;
     newXF.FillId = _fillId;
     newXF.BorderId = _borderId;
     newXF.XfId = _xfID;
     newXF.ReadingOrder = _readingOrder;
     newXF.HorizontalAlignment = _horizontalAlignment;
     newXF.VerticalAlignment = _verticalAlignment;
     newXF.WrapText = _wrapText;
     return newXF;
 }
コード例 #6
0
ファイル: ExcelXfsXml.cs プロジェクト: ndilday/wftdastats
 internal void RegisterEvent(ExcelXfs xf)
 {
     //                RegisterEvent(xf, xf.Xf_ChangedEvent);
 }
コード例 #7
0
ファイル: ExcelXfsXml.cs プロジェクト: jackjet870/EPPlus
        internal int GetNewID(ExcelStyleCollection <ExcelXfs> xfsCol, StyleBase styleObject, eStyleClass styleClass, eStyleProperty styleProperty, object value)
        {
            ExcelXfs newXfs = this.Copy();

            switch (styleClass)
            {
            case eStyleClass.Numberformat:
                newXfs.NumberFormatId = GetIdNumberFormat(styleProperty, value);
                styleObject.SetIndex(newXfs.NumberFormatId);
                break;

            case eStyleClass.Font:
            {
                newXfs.FontId = GetIdFont(styleProperty, value);
                styleObject.SetIndex(newXfs.FontId);
                break;
            }

            case eStyleClass.Fill:
            case eStyleClass.FillBackgroundColor:
            case eStyleClass.FillPatternColor:
                newXfs.FillId = GetIdFill(styleClass, styleProperty, value);
                styleObject.SetIndex(newXfs.FillId);
                break;

            case eStyleClass.GradientFill:
            case eStyleClass.FillGradientColor1:
            case eStyleClass.FillGradientColor2:
                newXfs.FillId = GetIdGradientFill(styleClass, styleProperty, value);
                styleObject.SetIndex(newXfs.FillId);
                break;

            case eStyleClass.Border:
            case eStyleClass.BorderBottom:
            case eStyleClass.BorderDiagonal:
            case eStyleClass.BorderLeft:
            case eStyleClass.BorderRight:
            case eStyleClass.BorderTop:
                newXfs.BorderId = GetIdBorder(styleClass, styleProperty, value);
                styleObject.SetIndex(newXfs.BorderId);
                break;

            case eStyleClass.Style:
                switch (styleProperty)
                {
                case eStyleProperty.XfId:
                    newXfs.XfId = (int)value;
                    break;

                case eStyleProperty.HorizontalAlign:
                    newXfs.HorizontalAlignment = (ExcelHorizontalAlignment)value;
                    break;

                case eStyleProperty.VerticalAlign:
                    newXfs.VerticalAlignment = (ExcelVerticalAlignment)value;
                    break;

                case eStyleProperty.WrapText:
                    newXfs.WrapText = (bool)value;
                    break;

                case eStyleProperty.ReadingOrder:
                    newXfs.ReadingOrder = (ExcelReadingOrder)value;
                    break;

                case eStyleProperty.ShrinkToFit:
                    newXfs.ShrinkToFit = (bool)value;
                    break;

                case eStyleProperty.Indent:
                    newXfs.Indent = (int)value;
                    break;

                case eStyleProperty.TextRotation:
                    newXfs.TextRotation = (int)value;
                    break;

                case eStyleProperty.Locked:
                    newXfs.Locked = (bool)value;
                    break;

                case eStyleProperty.Hidden:
                    newXfs.Hidden = (bool)value;
                    break;

                default:
                    throw (new Exception("Invalid property for class style."));
                }
                break;

            default:
                break;
            }
            int id = xfsCol.FindIndexByID(newXfs.Id);

            if (id < 0)
            {
                return(xfsCol.Add(newXfs.Id, newXfs));
            }
            return(id);
        }