Esempio n. 1
0
        public static CT_SortState Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_SortState ctObj = new CT_SortState();

            if (node.Attribute("columnSort") != null)
            {
                ctObj.columnSort = XmlHelper.ReadBool(node.Attribute("columnSort"));
            }
            if (node.Attribute("caseSensitive") != null)
            {
                ctObj.caseSensitive = XmlHelper.ReadBool(node.Attribute("caseSensitive"));
            }
            if (node.Attribute("sortMethod") != null)
            {
                ctObj.sortMethod = (ST_SortMethod)Enum.Parse(typeof(ST_SortMethod), node.Attribute("sortMethod").Value);
            }
            ctObj.@ref          = XmlHelper.ReadString(node.Attribute("ref"));
            ctObj.sortCondition = new List <CT_SortCondition>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sortCondition")
                {
                    ctObj.sortCondition.Add(CT_SortCondition.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Esempio n. 2
0
        public static CT_AutoFilter Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_AutoFilter ctObj = new CT_AutoFilter();

            ctObj.@ref         = XmlHelper.ReadString(node.Attribute("ref"));
            ctObj.filterColumn = new List <CT_FilterColumn>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "sortState")
                {
                    ctObj.sortState = CT_SortState.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "filterColumn")
                {
                    ctObj.filterColumn.Add(CT_FilterColumn.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Esempio n. 3
0
        private CT_ExtensionList extLstField = null;                    // optional field

        public static CT_Comments Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Comments ctObj = new CT_Comments();

            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "authors")
                {
                    ctObj.authors = CT_Authors.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "commentList")
                {
                    ctObj.commentList = CT_CommentList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 4
0
        public static CT_XmlColumnPr Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_XmlColumnPr ctObj = new CT_XmlColumnPr();

            if (node.Attribute("mapId") != null)
            {
                ctObj.mapId = XmlHelper.ReadUInt(node.Attribute("mapId"));
            }
            ctObj.xpath = XmlHelper.ReadString(node.Attribute("xpath"));
            if (node.Attribute("denormalized") != null)
            {
                ctObj.denormalized = XmlHelper.ReadBool(node.Attribute("denormalized"));
            }
            if (node.Attribute("xmlDataType") != null)
            {
                ctObj.xmlDataType = (ST_XmlDataType)Enum.Parse(typeof(ST_XmlDataType), node.Attribute("xmlDataType").Value);
            }
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 5
0
        public static CT_BookView Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_BookView ctObj = new CT_BookView();

            if (node.Attribute("visibility") != null)
            {
                ctObj.visibility = (ST_Visibility)Enum.Parse(typeof(ST_Visibility), node.Attribute("visibility").Value);
            }
            ctObj.minimized            = XmlHelper.ReadBool(node.Attribute("minimized"));
            ctObj.showHorizontalScroll = XmlHelper.ReadBool(node.Attribute("showHorizontalScroll"), true);
            ctObj.showVerticalScroll   = XmlHelper.ReadBool(node.Attribute("showVerticalScroll"), true);
            ctObj.showSheetTabs        = XmlHelper.ReadBool(node.Attribute("showSheetTabs"), true);
            ctObj.xWindow                = XmlHelper.ReadInt(node.Attribute("xWindow"));
            ctObj.yWindow                = XmlHelper.ReadInt(node.Attribute("yWindow"));
            ctObj.windowWidth            = XmlHelper.ReadUInt(node.Attribute("windowWidth"));
            ctObj.windowHeight           = XmlHelper.ReadUInt(node.Attribute("windowHeight"));
            ctObj.tabRatio               = XmlHelper.ReadUInt(node.Attribute("tabRatio"));
            ctObj.firstSheet             = XmlHelper.ReadUInt(node.Attribute("firstSheet"));
            ctObj.activeTab              = XmlHelper.ReadUInt(node.Attribute("activeTab"));
            ctObj.autoFilterDateGrouping = XmlHelper.ReadBool(node.Attribute("autoFilterDateGrouping"), true);
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 6
0
        public static CT_TableColumn Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_TableColumn ctObj = new CT_TableColumn();

            if (node.Attribute("id") != null)
            {
                ctObj.id = XmlHelper.ReadUInt(node.Attribute("id"));
            }
            ctObj.uniqueName = XmlHelper.ReadString(node.Attribute("uniqueName"));
            ctObj.name       = XmlHelper.ReadString(node.Attribute("name"));
            if (node.Attribute("totalsRowFunction") != null)
            {
                ctObj.totalsRowFunction = (ST_TotalsRowFunction)Enum.Parse(typeof(ST_TotalsRowFunction), node.Attribute("totalsRowFunction").Value);
            }
            ctObj.totalsRowLabel = XmlHelper.ReadString(node.Attribute("totalsRowLabel"));
            if (node.Attribute("queryTableFieldId") != null)
            {
                ctObj.queryTableFieldId = XmlHelper.ReadUInt(node.Attribute("queryTableFieldId"));
            }
            if (node.Attribute("headerRowDxfId") != null)
            {
                ctObj.headerRowDxfId = XmlHelper.ReadUInt(node.Attribute("headerRowDxfId"));
            }
            if (node.Attribute("dataDxfId") != null)
            {
                ctObj.dataDxfId = XmlHelper.ReadUInt(node.Attribute("dataDxfId"));
            }
            if (node.Attribute("totalsRowDxfId") != null)
            {
                ctObj.totalsRowDxfId = XmlHelper.ReadUInt(node.Attribute("totalsRowDxfId"));
            }
            ctObj.headerRowCellStyle = XmlHelper.ReadString(node.Attribute("headerRowCellStyle"));
            ctObj.dataCellStyle      = XmlHelper.ReadString(node.Attribute("dataCellStyle"));
            ctObj.totalsRowCellStyle = XmlHelper.ReadString(node.Attribute("totalsRowCellStyle"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "calculatedColumnFormula")
                {
                    ctObj.calculatedColumnFormula = CT_TableFormula.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "totalsRowFormula")
                {
                    ctObj.totalsRowFormula = CT_TableFormula.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "xmlColumnPr")
                {
                    ctObj.xmlColumnPr = CT_XmlColumnPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 7
0
        public static CT_Stylesheet Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Stylesheet ctObj = new CT_Stylesheet();

            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "numFmts")
                {
                    ctObj.numFmts = CT_NumFmts.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "fonts")
                {
                    ctObj.fonts = CT_Fonts.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "fills")
                {
                    ctObj.fills = CT_Fills.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "borders")
                {
                    ctObj.borders = CT_Borders.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "cellStyleXfs")
                {
                    ctObj.cellStyleXfs = CT_CellStyleXfs.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "cellXfs")
                {
                    ctObj.cellXfs = CT_CellXfs.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "cellStyles")
                {
                    ctObj.cellStyles = CT_CellStyles.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dxfs")
                {
                    ctObj.dxfs = CT_Dxfs.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "tableStyles")
                {
                    ctObj.tableStyles = CT_TableStyles.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "colors")
                {
                    ctObj.colors = CT_Colors.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 8
0
        public static CT_PivotCacheRecords Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_PivotCacheRecords ctObj = new CT_PivotCacheRecords();

            if (node.Attribute("count") != null)
            {
                ctObj.count = XmlHelper.ReadUInt(node.Attribute("count"));
            }
            ctObj.r = new List <Object>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "n")
                {
                    ctObj.r.Add(CT_Number.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "b")
                {
                    ctObj.r.Add(CT_Boolean.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "d")
                {
                    ctObj.r.Add(CT_DateTime.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "e")
                {
                    ctObj.r.Add(CT_Error.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "m")
                {
                    ctObj.r.Add(CT_Missing.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "s")
                {
                    ctObj.r.Add(CT_String.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "x")
                {
                    ctObj.r.Add(CT_Index.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Esempio n. 9
0
        public static CT_CustomWorkbookView Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_CustomWorkbookView ctObj = new CT_CustomWorkbookView();

            ctObj.name                   = XmlHelper.ReadString(node.Attribute("name"));
            ctObj.guid                   = XmlHelper.ReadString(node.Attribute("guid"));
            ctObj.autoUpdate             = XmlHelper.ReadBool(node.Attribute("autoUpdate"));
            ctObj.mergeInterval          = XmlHelper.ReadUInt(node.Attribute("mergeInterval"));
            ctObj.mergeIntervalSpecified = node.Attribute("mergeInterval") != null;
            ctObj.changesSavedWin        = XmlHelper.ReadBool(node.Attribute("changesSavedWin"));
            ctObj.onlySync               = XmlHelper.ReadBool(node.Attribute("onlySync"));
            ctObj.personalView           = XmlHelper.ReadBool(node.Attribute("personalView"));
            ctObj.includePrintSettings   = XmlHelper.ReadBool(node.Attribute("includePrintSettings"));
            ctObj.includeHiddenRowCol    = XmlHelper.ReadBool(node.Attribute("includeHiddenRowCol"));
            ctObj.maximized              = XmlHelper.ReadBool(node.Attribute("maximized"));
            ctObj.minimized              = XmlHelper.ReadBool(node.Attribute("minimized"));
            ctObj.showHorizontalScroll   = XmlHelper.ReadBool(node.Attribute("showHorizontalScroll"));
            ctObj.showVerticalScroll     = XmlHelper.ReadBool(node.Attribute("showVerticalScroll"));
            ctObj.showSheetTabs          = XmlHelper.ReadBool(node.Attribute("showSheetTabs"));
            ctObj.xWindow                = XmlHelper.ReadInt(node.Attribute("xWindow"));
            ctObj.yWindow                = XmlHelper.ReadInt(node.Attribute("yWindow"));
            ctObj.windowWidth            = XmlHelper.ReadUInt(node.Attribute("windowWidth"));
            ctObj.windowHeight           = XmlHelper.ReadUInt(node.Attribute("windowHeight"));
            ctObj.tabRatio               = XmlHelper.ReadUInt(node.Attribute("tabRatio"));
            ctObj.activeSheetId          = XmlHelper.ReadUInt(node.Attribute("activeSheetId"));
            ctObj.showFormulaBar         = XmlHelper.ReadBool(node.Attribute("showFormulaBar"));
            ctObj.showStatusbar          = XmlHelper.ReadBool(node.Attribute("showStatusbar"));
            if (node.Attribute("showComments") != null)
            {
                ctObj.showComments = (ST_Comments)Enum.Parse(typeof(ST_Comments), node.Attribute("showComments").Value);
            }
            if (node.Attribute("showObjects") != null)
            {
                ctObj.showObjects = (ST_Objects)Enum.Parse(typeof(ST_Objects), node.Attribute("showObjects").Value);
            }
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 10
0
        public static CT_Dxf Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Dxf ctObj = new CT_Dxf();

            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "font")
                {
                    ctObj.font = CT_Font.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "numFmt")
                {
                    ctObj.numFmt = CT_NumFmt.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "fill")
                {
                    ctObj.fill = CT_Fill.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "alignment")
                {
                    ctObj.alignment = CT_CellAlignment.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "border")
                {
                    ctObj.border = CT_Border.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "protection")
                {
                    ctObj.protection = CT_CellProtection.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 11
0
        public static CT_Cell Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Cell ctObj = new CT_Cell();

            ctObj.r = XmlHelper.ReadString(node.Attribute("r"));
            ctObj.s = XmlHelper.ReadUInt(node.Attribute("s"));
            if (node.Attribute("t") != null)
            {
                ctObj.t = (ST_CellType)Enum.Parse(typeof(ST_CellType), node.Attribute("t").Value);
            }
            ctObj.cm = XmlHelper.ReadUInt(node.Attribute("cm"));
            ctObj.vm = XmlHelper.ReadUInt(node.Attribute("vm"));
            ctObj.ph = XmlHelper.ReadBool(node.Attribute("ph"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "f")
                {
                    ctObj.f = CT_CellFormula.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "v")
                {
                    ctObj.v = childNode.Value;
                }
                else if (childNode.Name.LocalName == "is")
                {
                    ctObj.@is = CT_Rst.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 12
0
        public static CT_Xf Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Xf ctObj = new CT_Xf();

            ctObj.numFmtId          = XmlHelper.ReadUInt(node.Attribute("numFmtId"));
            ctObj.fontId            = XmlHelper.ReadUInt(node.Attribute("fontId"));
            ctObj.fillId            = XmlHelper.ReadUInt(node.Attribute("fillId"));
            ctObj.borderId          = XmlHelper.ReadUInt(node.Attribute("borderId"));
            ctObj.xfId              = XmlHelper.ReadUInt(node.Attribute("xfId"));
            ctObj.quotePrefix       = XmlHelper.ReadBool(node.Attribute("quotePrefix"));
            ctObj.pivotButton       = XmlHelper.ReadBool(node.Attribute("pivotButton"));
            ctObj.applyNumberFormat = XmlHelper.ReadBool(node.Attribute("applyNumberFormat"));
            ctObj.applyFont         = XmlHelper.ReadBool(node.Attribute("applyFont"));
            ctObj.applyFill         = XmlHelper.ReadBool(node.Attribute("applyFill"));
            ctObj.applyBorder       = XmlHelper.ReadBool(node.Attribute("applyBorder"));
            ctObj.applyAlignment    = XmlHelper.ReadBool(node.Attribute("applyAlignment"));
            ctObj.applyProtection   = XmlHelper.ReadBool(node.Attribute("applyProtection"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "alignment")
                {
                    ctObj.alignment = CT_CellAlignment.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "protection")
                {
                    ctObj.protection = CT_CellProtection.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 13
0
        public static CT_CellStyle Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_CellStyle ctObj = new CT_CellStyle();

            ctObj.name          = XmlHelper.ReadString(node.Attribute("name"));
            ctObj.xfId          = XmlHelper.ReadUInt(node.Attribute("xfId"));
            ctObj.builtinId     = XmlHelper.ReadUInt(node.Attribute("builtinId"));
            ctObj.iLevel        = XmlHelper.ReadUInt(node.Attribute("iLevel"));
            ctObj.hidden        = XmlHelper.ReadBool(node.Attribute("hidden"));
            ctObj.customBuiltin = XmlHelper.ReadBool(node.Attribute("customBuiltin"));
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 14
0
        public static CT_Row Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Row ctObj = new CT_Row();

            ctObj.r            = XmlHelper.ReadUInt(node.Attribute("r"));
            ctObj.spans        = XmlHelper.ReadString(node.Attribute("spans"));
            ctObj.s            = XmlHelper.ReadUInt(node.Attribute("s"));
            ctObj.customFormat = XmlHelper.ReadBool(node.Attribute("customFormat"));
            if (node.Attribute("ht") != null)
            {
                ctObj.ht = XmlHelper.ReadDouble(node.Attribute("ht"));
            }
            ctObj.hidden       = XmlHelper.ReadBool(node.Attribute("hidden"));
            ctObj.outlineLevel = XmlHelper.ReadByte(node.Attribute("outlineLevel"));
            ctObj.customHeight = XmlHelper.ReadBool(node.Attribute("customHeight"));
            ctObj.collapsed    = XmlHelper.ReadBool(node.Attribute("collapsed"));
            ctObj.thickTop     = XmlHelper.ReadBool(node.Attribute("thickTop"));
            ctObj.thickBot     = XmlHelper.ReadBool(node.Attribute("thickBot"));
            ctObj.ph           = XmlHelper.ReadBool(node.Attribute("ph"));
            ctObj.c            = new List <CT_Cell>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "c")
                {
                    ctObj.c.Add(CT_Cell.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Esempio n. 15
0
        public static CT_ExternalLink Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_ExternalLink ctObj = new CT_ExternalLink();

            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "externalBook")
                {
                    ctObj.externalBookField = CT_ExternalBook.Parse(childNode, namespaceManager);
                    ctObj.itemField         = ctObj.externalBookField;
                    ctObj.itemType          = ExternalLinkItem.externalBook;
                }
                else if (childNode.Name.LocalName == "ddeLink")
                {
                    ctObj.ddeLinkField = CT_DdeLink.Parse(childNode, namespaceManager);
                    ctObj.itemField    = ctObj.ddeLinkField;
                    ctObj.itemType     = ExternalLinkItem.ddeLink;
                }
                else if (childNode.Name.LocalName == "oleLink")
                {
                    ctObj.oleLinkField = CT_OleLink.Parse(childNode, namespaceManager);
                    ctObj.itemField    = ctObj.oleLinkField;
                    ctObj.itemType     = ExternalLinkItem.oleLink;
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLstField = CT_ExtensionList.Parse(childNode, namespaceManager);
                    ctObj.itemField   = ctObj.extLstField;
                    ctObj.itemType    = ExternalLinkItem.extLst;
                }
            }
            return(ctObj);
        }
Esempio n. 16
0
        public static CT_Worksheet Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Worksheet ctObj = new CT_Worksheet();

            ctObj.cols = new List <CT_Cols>();
            ctObj.conditionalFormatting = new List <CT_ConditionalFormatting>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "sheetPr")
                {
                    ctObj.sheetPr = CT_SheetPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dimension")
                {
                    ctObj.dimension = CT_SheetDimension.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sheetViews")
                {
                    ctObj.sheetViews = CT_SheetViews.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sheetFormatPr")
                {
                    ctObj.sheetFormatPr = CT_SheetFormatPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sheetData")
                {
                    ctObj.sheetData = CT_SheetData.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sheetCalcPr")
                {
                    ctObj.sheetCalcPr = CT_SheetCalcPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sheetProtection")
                {
                    ctObj.sheetProtection = CT_SheetProtection.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "protectedRanges")
                {
                    ctObj.protectedRanges = CT_ProtectedRanges.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "scenarios")
                {
                    ctObj.scenarios = CT_Scenarios.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "autoFilter")
                {
                    ctObj.autoFilter = CT_AutoFilter.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sortState")
                {
                    ctObj.sortState = CT_SortState.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dataConsolidate")
                {
                    ctObj.dataConsolidate = CT_DataConsolidate.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "customSheetViews")
                {
                    ctObj.customSheetViews = CT_CustomSheetViews.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "mergeCells")
                {
                    ctObj.mergeCells = CT_MergeCells.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "phoneticPr")
                {
                    ctObj.phoneticPr = CT_PhoneticPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "dataValidations")
                {
                    ctObj.dataValidations = CT_DataValidations.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "hyperlinks")
                {
                    ctObj.hyperlinks = CT_Hyperlinks.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "printOptions")
                {
                    ctObj.printOptions = CT_PrintOptions.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "pageMargins")
                {
                    ctObj.pageMargins = CT_PageMargins.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "pageSetup")
                {
                    ctObj.pageSetup = CT_PageSetup.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "headerFooter")
                {
                    ctObj.headerFooter = CT_HeaderFooter.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "rowBreaks")
                {
                    ctObj.rowBreaks = CT_PageBreak.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "colBreaks")
                {
                    ctObj.colBreaks = CT_PageBreak.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "customProperties")
                {
                    ctObj.customProperties = CT_CustomProperties.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "cellWatches")
                {
                    ctObj.cellWatches = CT_CellWatches.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "ignoredErrors")
                {
                    ctObj.ignoredErrors = CT_IgnoredErrors.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "smartTags")
                {
                    ctObj.smartTags = CT_CellSmartTags.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "drawing")
                {
                    ctObj.drawing = CT_Drawing.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "legacyDrawing")
                {
                    ctObj.legacyDrawing = CT_LegacyDrawing.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "legacyDrawingHF")
                {
                    ctObj.legacyDrawingHF = CT_LegacyDrawing.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "picture")
                {
                    ctObj.picture = CT_SheetBackgroundPicture.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "oleObjects")
                {
                    ctObj.oleObjects = CT_OleObjects.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "controls")
                {
                    ctObj.controls = CT_Controls.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "webPublishItems")
                {
                    ctObj.webPublishItems = CT_WebPublishItems.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "tableParts")
                {
                    ctObj.tableParts = CT_TableParts.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "cols")
                {
                    ctObj.cols.Add(CT_Cols.Parse(childNode, namespaceManager));
                }
                else if (childNode.Name.LocalName == "conditionalFormatting")
                {
                    ctObj.conditionalFormatting.Add(CT_ConditionalFormatting.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Esempio n. 17
0
        public static CT_Table Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Table ctObj = new CT_Table();

            if (node.Attribute("id") != null)
            {
                ctObj.id = XmlHelper.ReadUInt(node.Attribute("id"));
            }
            ctObj.name        = XmlHelper.ReadString(node.Attribute("name"));
            ctObj.displayName = XmlHelper.ReadString(node.Attribute("displayName"));
            ctObj.comment     = XmlHelper.ReadString(node.Attribute("comment"));
            ctObj.@ref        = XmlHelper.ReadString(node.Attribute("ref"));
            if (node.Attribute("tableType") != null)
            {
                ctObj.tableType = (ST_TableType)Enum.Parse(typeof(ST_TableType), node.Attribute("tableType").Value);
            }
            if (node.Attribute("headerRowCount") != null)
            {
                ctObj.headerRowCount = XmlHelper.ReadUInt(node.Attribute("headerRowCount"));
            }
            if (node.Attribute("insertRow") != null)
            {
                ctObj.insertRow = XmlHelper.ReadBool(node.Attribute("insertRow"));
            }
            if (node.Attribute("insertRowShift") != null)
            {
                ctObj.insertRowShift = XmlHelper.ReadBool(node.Attribute("insertRowShift"));
            }
            if (node.Attribute("totalsRowCount") != null)
            {
                ctObj.totalsRowCount = XmlHelper.ReadUInt(node.Attribute("totalsRowCount"));
            }
            if (node.Attribute("totalsRowShown") != null)
            {
                ctObj.totalsRowShown = XmlHelper.ReadBool(node.Attribute("totalsRowShown"));
            }
            if (node.Attribute("published") != null)
            {
                ctObj.published = XmlHelper.ReadBool(node.Attribute("published"));
            }
            if (node.Attribute("headerRowDxfId") != null)
            {
                ctObj.headerRowDxfId = XmlHelper.ReadUInt(node.Attribute("headerRowDxfId"));
            }
            if (node.Attribute("dataDxfId") != null)
            {
                ctObj.dataDxfId = XmlHelper.ReadUInt(node.Attribute("dataDxfId"));
            }
            if (node.Attribute("totalsRowDxfId") != null)
            {
                ctObj.totalsRowDxfId = XmlHelper.ReadUInt(node.Attribute("totalsRowDxfId"));
            }
            if (node.Attribute("headerRowBorderDxfId") != null)
            {
                ctObj.headerRowBorderDxfId = XmlHelper.ReadUInt(node.Attribute("headerRowBorderDxfId"));
            }
            if (node.Attribute("tableBorderDxfId") != null)
            {
                ctObj.tableBorderDxfId = XmlHelper.ReadUInt(node.Attribute("tableBorderDxfId"));
            }
            if (node.Attribute("totalsRowBorderDxfId") != null)
            {
                ctObj.totalsRowBorderDxfId = XmlHelper.ReadUInt(node.Attribute("totalsRowBorderDxfId"));
            }
            ctObj.headerRowCellStyle = XmlHelper.ReadString(node.Attribute("headerRowCellStyle"));
            ctObj.dataCellStyle      = XmlHelper.ReadString(node.Attribute("dataCellStyle"));
            ctObj.totalsRowCellStyle = XmlHelper.ReadString(node.Attribute("totalsRowCellStyle"));
            if (node.Attribute("connectionId") != null)
            {
                ctObj.connectionId = XmlHelper.ReadUInt(node.Attribute("connectionId"));
            }
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "autoFilter")
                {
                    ctObj.autoFilter = CT_AutoFilter.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sortState")
                {
                    ctObj.sortState = CT_SortState.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "tableColumns")
                {
                    ctObj.tableColumns = CT_TableColumns.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "tableStyleInfo")
                {
                    ctObj.tableStyleInfo = CT_TableStyleInfo.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Esempio n. 18
0
        public static CT_Workbook Parse(XElement node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Workbook ctObj = new CT_Workbook();

            ctObj.fileRecoveryPr = new List <CT_FileRecoveryPr>();
            foreach (XElement childNode in node.ChildElements())
            {
                if (childNode.Name.LocalName == "fileVersion")
                {
                    ctObj.fileVersion = CT_FileVersion.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "fileSharing")
                {
                    ctObj.fileSharing = CT_FileSharing.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "workbookPr")
                {
                    ctObj.workbookPr = CT_WorkbookPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "workbookProtection")
                {
                    ctObj.workbookProtection = CT_WorkbookProtection.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "bookViews")
                {
                    ctObj.bookViews = CT_BookViews.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "sheets")
                {
                    ctObj.sheets = CT_Sheets.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "functionGroups")
                {
                    ctObj.functionGroups = CT_FunctionGroups.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "externalReferences")
                {
                    ctObj.externalReferences = CT_ExternalReferences.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "definedNames")
                {
                    ctObj.definedNames = CT_DefinedNames.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "calcPr")
                {
                    ctObj.calcPr = CT_CalcPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "oleSize")
                {
                    ctObj.oleSize = CT_OleSize.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "customWorkbookViews")
                {
                    ctObj.customWorkbookViews = CT_CustomWorkbookViews.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "pivotCaches")
                {
                    ctObj.pivotCaches = CT_PivotCaches.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "smartTagPr")
                {
                    ctObj.smartTagPr = CT_SmartTagPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "smartTagTypes")
                {
                    ctObj.smartTagTypes = CT_SmartTagTypes.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "webPublishing")
                {
                    ctObj.webPublishing = CT_WebPublishing.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "webPublishObjects")
                {
                    ctObj.webPublishObjects = CT_WebPublishObjects.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
                else if (childNode.Name.LocalName == "fileRecoveryPr")
                {
                    ctObj.fileRecoveryPr.Add(CT_FileRecoveryPr.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }