Пример #1
0
        public CT_TableColumn InsertNewTableColumn(int columnIndex)
        {
            var newTableColumn = new CT_TableColumn();

            this.tableColumn.Insert(columnIndex, newTableColumn);
            return(newTableColumn);
        }
Пример #2
0
        public static CT_TableColumn Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_TableColumn ctObj = new CT_TableColumn();

            if (node.Attributes["id"] != null)
            {
                ctObj.id = XmlHelper.ReadUInt(node.Attributes["id"]);
            }
            ctObj.uniqueName = XmlHelper.ReadString(node.Attributes["uniqueName"]);
            ctObj.name       = XmlHelper.ReadString(node.Attributes["name"]);
            if (node.Attributes["totalsRowFunction"] != null)
            {
                ctObj.totalsRowFunction = (ST_TotalsRowFunction)Enum.Parse(typeof(ST_TotalsRowFunction), node.Attributes["totalsRowFunction"].Value);
            }
            ctObj.totalsRowLabel = XmlHelper.ReadString(node.Attributes["totalsRowLabel"]);
            if (node.Attributes["queryTableFieldId"] != null)
            {
                ctObj.queryTableFieldId = XmlHelper.ReadUInt(node.Attributes["queryTableFieldId"]);
            }
            if (node.Attributes["headerRowDxfId"] != null)
            {
                ctObj.headerRowDxfId = XmlHelper.ReadUInt(node.Attributes["headerRowDxfId"]);
            }
            if (node.Attributes["dataDxfId"] != null)
            {
                ctObj.dataDxfId = XmlHelper.ReadUInt(node.Attributes["dataDxfId"]);
            }
            if (node.Attributes["totalsRowDxfId"] != null)
            {
                ctObj.totalsRowDxfId = XmlHelper.ReadUInt(node.Attributes["totalsRowDxfId"]);
            }
            ctObj.headerRowCellStyle = XmlHelper.ReadString(node.Attributes["headerRowCellStyle"]);
            ctObj.dataCellStyle      = XmlHelper.ReadString(node.Attributes["dataCellStyle"]);
            ctObj.totalsRowCellStyle = XmlHelper.ReadString(node.Attributes["totalsRowCellStyle"]);
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "calculatedColumnFormula")
                {
                    ctObj.calculatedColumnFormula = CT_TableFormula.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "totalsRowFormula")
                {
                    ctObj.totalsRowFormula = CT_TableFormula.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "xmlColumnPr")
                {
                    ctObj.xmlColumnPr = CT_XmlColumnPr.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Пример #3
0
        public static TableDocument Parse(XmlDocument xmldoc, XmlNamespaceManager namespaceMgr)
        {
            CT_Table   obj       = new CT_Table();
            XmlElement tableNode = xmldoc.DocumentElement;

            obj.id          = XmlHelper.ReadUInt(tableNode.Attributes["id"]);
            obj.name        = XmlHelper.ReadString(tableNode.Attributes["name"]);
            obj.displayName = XmlHelper.ReadString(tableNode.Attributes["displayName"]);
            if (tableNode.Attributes["tableType"] != null)
            {
                obj.tableType = (ST_TableType)Enum.Parse(typeof(ST_TableType), tableNode.Attributes["tableType"].Value);
            }
            obj.totalsRowCount = XmlHelper.ReadUInt(tableNode.GetAttributeNode("totalsRowCount"));
            obj.totalsRowShown = XmlHelper.ReadBool(tableNode.GetAttributeNode("totalsRowShown"));
            obj.@ref           = XmlHelper.ReadString(tableNode.Attributes["ref"]);
            XmlNode autoFilter = xmldoc.SelectSingleNode("//d:autoFilter", namespaceMgr);

            if (autoFilter != null)
            {
                obj.autoFilter      = new CT_AutoFilter();
                obj.autoFilter.@ref = XmlHelper.ReadString(autoFilter.Attributes["name"]);
            }
            XmlNodeList tableCols = xmldoc.SelectNodes("//d:tableColumns/d:tableColumn", namespaceMgr);

            if (tableCols != null)
            {
                obj.tableColumns       = new CT_TableColumns();
                obj.tableColumns.count = (uint)tableCols.Count;
                foreach (XmlElement tableColNode in tableCols)
                {
                    CT_TableColumn ctTableCol = new CT_TableColumn();
                    ctTableCol.id                 = XmlHelper.ReadUInt(tableColNode.GetAttributeNode("id"));
                    ctTableCol.name               = XmlHelper.ReadString(tableColNode.GetAttributeNode("name"));
                    ctTableCol.uniqueName         = XmlHelper.ReadString(tableColNode.GetAttributeNode("uniqueName"));
                    ctTableCol.totalsRowCellStyle = XmlHelper.ReadString(tableColNode.GetAttributeNode("totalsRowCellStyle"));
                    ctTableCol.totalsRowDxfId     = XmlHelper.ReadUInt(tableColNode.GetAttributeNode("totalsRowDxfId"));
                    ctTableCol.totalsRowLabel     = XmlHelper.ReadString(tableColNode.GetAttributeNode("totalsRowDxfId"));
                    ctTableCol.queryTableFieldId  = XmlHelper.ReadUInt(tableColNode.GetAttributeNode("queryTableFieldId"));
                    ctTableCol.xmlColumnPr        = CT_XmlColumnPr.Parse(tableColNode.SelectSingleNode("d:xmlColumnPr", namespaceMgr), namespaceMgr);
                    //TODO: parse sub element of CT_TableColumn
                    obj.tableColumns.tableColumn.Add(ctTableCol);
                }
            }
            XmlNode tableStyleInfo = xmldoc.SelectSingleNode("//d:tableStyleInfo", namespaceMgr);

            if (tableStyleInfo != null)
            {
                obj.tableStyleInfo                   = new CT_TableStyleInfo();
                obj.tableStyleInfo.name              = XmlHelper.ReadString(tableStyleInfo.Attributes["name"]);
                obj.tableStyleInfo.showFirstColumn   = XmlHelper.ReadBool(tableStyleInfo.Attributes["showFirstColumn"]);
                obj.tableStyleInfo.showLastColumn    = XmlHelper.ReadBool(tableStyleInfo.Attributes["showLastColumn"]);
                obj.tableStyleInfo.showRowStripes    = XmlHelper.ReadBool(tableStyleInfo.Attributes["showRowStripes"]);
                obj.tableStyleInfo.showColumnStripes = XmlHelper.ReadBool(tableStyleInfo.Attributes["showColumnStripes"]);
            }
            return(new TableDocument(obj));
        }
Пример #4
0
 public static TableDocument Parse(XmlDocument xmldoc, XmlNamespaceManager namespaceMgr)
 {
     CT_Table obj = new CT_Table();
     XmlElement tableNode = xmldoc.DocumentElement;
     obj.id = XmlHelper.ReadUInt(tableNode.Attributes["id"]);
     obj.name = XmlHelper.ReadString(tableNode.Attributes["name"]);
     obj.displayName = XmlHelper.ReadString(tableNode.Attributes["displayName"]);
     if (tableNode.Attributes["tableType"] != null)
     {
         obj.tableType = (ST_TableType)Enum.Parse(typeof(ST_TableType), tableNode.Attributes["tableType"].Value);
     }
     obj.totalsRowCount = XmlHelper.ReadUInt(tableNode.GetAttributeNode("totalsRowCount"));
     obj.totalsRowShown = XmlHelper.ReadBool(tableNode.GetAttributeNode("totalsRowShown"));
     obj.@ref = XmlHelper.ReadString(tableNode.Attributes["ref"]);
     XmlNode autoFilter = xmldoc.SelectSingleNode("//d:autoFilter", namespaceMgr);
     if (autoFilter != null)
     {
         obj.autoFilter = new CT_AutoFilter();
         obj.autoFilter.@ref = XmlHelper.ReadString(autoFilter.Attributes["name"]);
     }
     XmlNodeList tableCols =  xmldoc.SelectNodes("//d:tableColumns/d:tableColumn", namespaceMgr);
     if (tableCols != null)
     {
         obj.tableColumns = new CT_TableColumns();
         obj.tableColumns.count = (uint)tableCols.Count;
         foreach (XmlElement tableColNode in tableCols)
         {
             CT_TableColumn ctTableCol = new CT_TableColumn();
             ctTableCol.id = XmlHelper.ReadUInt(tableColNode.GetAttributeNode("id"));
             ctTableCol.name = XmlHelper.ReadString(tableColNode.GetAttributeNode("name")); 
             ctTableCol.uniqueName = XmlHelper.ReadString(tableColNode.GetAttributeNode("uniqueName"));
             ctTableCol.totalsRowCellStyle = XmlHelper.ReadString(tableColNode.GetAttributeNode("totalsRowCellStyle"));
             ctTableCol.totalsRowDxfId = XmlHelper.ReadUInt(tableColNode.GetAttributeNode("totalsRowDxfId"));
             ctTableCol.totalsRowLabel = XmlHelper.ReadString(tableColNode.GetAttributeNode("totalsRowDxfId"));
             ctTableCol.queryTableFieldId = XmlHelper.ReadUInt(tableColNode.GetAttributeNode("queryTableFieldId"));
             ctTableCol.xmlColumnPr = CT_XmlColumnPr.Parse(tableColNode.SelectSingleNode("d:xmlColumnPr", namespaceMgr), namespaceMgr);
             //TODO: parse sub element of CT_TableColumn
             obj.tableColumns.tableColumn.Add(ctTableCol);
         }
     }
     XmlNode tableStyleInfo = xmldoc.SelectSingleNode("//d:tableStyleInfo", namespaceMgr);
     if (tableStyleInfo != null)
     {
         obj.tableStyleInfo = new CT_TableStyleInfo();
         obj.tableStyleInfo.name = XmlHelper.ReadString(tableStyleInfo.Attributes["name"]);
         obj.tableStyleInfo.showFirstColumn = XmlHelper.ReadBool(tableStyleInfo.Attributes["showFirstColumn"]);
         obj.tableStyleInfo.showLastColumn = XmlHelper.ReadBool(tableStyleInfo.Attributes["showLastColumn"]);
         obj.tableStyleInfo.showRowStripes = XmlHelper.ReadBool(tableStyleInfo.Attributes["showRowStripes"]);
         obj.tableStyleInfo.showColumnStripes = XmlHelper.ReadBool(tableStyleInfo.Attributes["showColumnStripes"]);
     }
     return new TableDocument(obj);
 }
Пример #5
0
 public static TableDocument Parse(XmlDocument xmldoc, XmlNamespaceManager namespaceMgr)
 {
     CT_Table obj = new CT_Table();
     XmlNode tableNode = xmldoc.DocumentElement;
     obj.id = uint.Parse(tableNode.Attributes["id"].Value);
     obj.name = tableNode.Attributes["name"].Value;
     obj.displayName = tableNode.Attributes["displayName"].Value;
     if (tableNode.Attributes["tableType"] != null)
     {
         obj.tableType = (ST_TableType)Enum.Parse(typeof(ST_TableType), tableNode.Attributes["tableType"].Value);
     }
     if (tableNode.Attributes["totalsRowCount"] != null)
         obj.totalsRowCount = uint.Parse(tableNode.Attributes["totalsRowCount"].Value);
     if(tableNode.Attributes["totalsRowShown"].Value=="1"||tableNode.Attributes["totalsRowShown"].Value.ToLower()=="true")
         obj.totalsRowShown = true;
     obj.@ref = tableNode.Attributes["ref"].Value;
     var autoFilter = xmldoc.SelectSingleNode("//d:autoFilter", namespaceMgr);
     if (autoFilter != null)
     {
         obj.autoFilter = new CT_AutoFilter();
         obj.autoFilter.@ref = autoFilter.Attributes["ref"].Value;
     }
     var tableCols =  xmldoc.SelectNodes("//d:tableColumns/d:tableColumn", namespaceMgr);
     if (tableCols != null)
     {
         obj.tableColumns = new CT_TableColumns();
         obj.tableColumns.count = (uint)tableCols.Count;
         foreach (XmlNode tableCol in tableCols)
         {
             CT_TableColumn tableColObj = new CT_TableColumn();
             tableColObj.id = uint.Parse(tableCol.Attributes["id"].Value);
             tableColObj.name = tableCol.Attributes["name"].Value;
             obj.tableColumns.tableColumn.Add(tableColObj);
         }
     }
     var tableStyleInfo = xmldoc.SelectSingleNode("//d:tableStyleInfo", namespaceMgr);
     if (tableStyleInfo != null)
     {
         obj.tableStyleInfo = new CT_TableStyleInfo();
         obj.tableStyleInfo.name = tableStyleInfo.Attributes["name"].Value;
         if (tableStyleInfo.Attributes["showFirstColumn"] != null)
             obj.tableStyleInfo.showFirstColumn = tableStyleInfo.Attributes["showFirstColumn"].Value == "1" ? true : false;
         if (tableStyleInfo.Attributes["showLastColumn"] != null)
             obj.tableStyleInfo.showLastColumn = tableStyleInfo.Attributes["showLastColumn"].Value == "1" ? true : false;
         if (tableStyleInfo.Attributes["showRowStripes"] != null)
             obj.tableStyleInfo.showRowStripes = tableStyleInfo.Attributes["showRowStripes"].Value == "1" ? true : false;
         if (tableStyleInfo.Attributes["showColumnStripes"] != null)
             obj.tableStyleInfo.showColumnStripes = tableStyleInfo.Attributes["showColumnStripes"].Value == "1" ? true : false;
     }
     return new TableDocument(obj);
 }
Пример #6
0
        public static CT_TableColumns Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_TableColumns ctObj = new CT_TableColumns();

            if (node.Attributes["count"] != null)
            {
                ctObj.count = XmlHelper.ReadUInt(node.Attributes["count"]);
            }
            ctObj.tableColumn = new List <CT_TableColumn>();
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "tableColumn")
                {
                    ctObj.tableColumn.Add(CT_TableColumn.Parse(childNode, namespaceManager));
                }
            }
            return(ctObj);
        }
Пример #7
0
 public static CT_TableColumn Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_TableColumn ctObj = new CT_TableColumn();
     if (node.Attributes["id"] != null)
         ctObj.id = XmlHelper.ReadUInt(node.Attributes["id"]);
     ctObj.uniqueName = XmlHelper.ReadString(node.Attributes["uniqueName"]);
     ctObj.name = XmlHelper.ReadString(node.Attributes["name"]);
     if (node.Attributes["totalsRowFunction"] != null)
         ctObj.totalsRowFunction = (ST_TotalsRowFunction)Enum.Parse(typeof(ST_TotalsRowFunction), node.Attributes["totalsRowFunction"].Value);
     ctObj.totalsRowLabel = XmlHelper.ReadString(node.Attributes["totalsRowLabel"]);
     if (node.Attributes["queryTableFieldId"] != null)
         ctObj.queryTableFieldId = XmlHelper.ReadUInt(node.Attributes["queryTableFieldId"]);
     if (node.Attributes["headerRowDxfId"] != null)
         ctObj.headerRowDxfId = XmlHelper.ReadUInt(node.Attributes["headerRowDxfId"]);
     if (node.Attributes["dataDxfId"] != null)
         ctObj.dataDxfId = XmlHelper.ReadUInt(node.Attributes["dataDxfId"]);
     if (node.Attributes["totalsRowDxfId"] != null)
         ctObj.totalsRowDxfId = XmlHelper.ReadUInt(node.Attributes["totalsRowDxfId"]);
     ctObj.headerRowCellStyle = XmlHelper.ReadString(node.Attributes["headerRowCellStyle"]);
     ctObj.dataCellStyle = XmlHelper.ReadString(node.Attributes["dataCellStyle"]);
     ctObj.totalsRowCellStyle = XmlHelper.ReadString(node.Attributes["totalsRowCellStyle"]);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "calculatedColumnFormula")
             ctObj.calculatedColumnFormula = CT_TableFormula.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "totalsRowFormula")
             ctObj.totalsRowFormula = CT_TableFormula.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "xmlColumnPr")
             ctObj.xmlColumnPr = CT_XmlColumnPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "extLst")
             ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
Пример #8
0
 public XSSFXmlColumnPr(XSSFTable table, CT_TableColumn ctTableColum, CT_XmlColumnPr CT_XmlColumnPr)
 {
     this.table = table;
     this.ctTableColumn = ctTableColum;
     this.ctXmlColumnPr = CT_XmlColumnPr;
 }