Exemple #1
0
        public XSSFTable()
            : base()
        {

            ctTable = new CT_Table();

        }
Exemple #2
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));
        }
Exemple #3
0
 public void ReadFrom(XmlDocument xmlDoc)
 {
     try
     {
         TableDocument doc = TableDocument.Parse(xmlDoc, NamespaceManager);
         ctTable = doc.GetTable();
     }
     catch (XmlException e)
     {
         throw new IOException(e.Message);
     }
 }
Exemple #4
0
 public void ReadFrom(Stream is1)
 {
     try
     {
         TableDocument doc = TableDocument.Parse(is1);
         ctTable = doc.GetTable();
     }
     catch (XmlException e)
     {
         throw new IOException(e.Message);
     }
 }
Exemple #5
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);
 }
Exemple #6
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);
 }
 public void SetTable(CT_Table table)
 {
     this.ctTable = table;
 }
 public TableDocument(CT_Table table)
 {
     this.ctTable = table;
 }
Exemple #9
0
 public void SetTable(CT_Table table)
 {
     this.ctTable = table;
 }
Exemple #10
0
 public TableDocument(CT_Table table)
 {
     this.ctTable = table;
 }
Exemple #11
0
        public static CT_Table Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Table ctObj = new CT_Table();

            if (node.Attributes["id"] != null)
            {
                ctObj.id = XmlHelper.ReadUInt(node.Attributes["id"]);
            }
            ctObj.name        = XmlHelper.ReadString(node.Attributes["name"]);
            ctObj.displayName = XmlHelper.ReadString(node.Attributes["displayName"]);
            ctObj.comment     = XmlHelper.ReadString(node.Attributes["comment"]);
            ctObj.@ref        = XmlHelper.ReadString(node.Attributes["ref"]);
            if (node.Attributes["tableType"] != null)
            {
                ctObj.tableType = (ST_TableType)Enum.Parse(typeof(ST_TableType), node.Attributes["tableType"].Value);
            }
            if (node.Attributes["headerRowCount"] != null)
            {
                ctObj.headerRowCount = XmlHelper.ReadUInt(node.Attributes["headerRowCount"]);
            }
            if (node.Attributes["insertRow"] != null)
            {
                ctObj.insertRow = XmlHelper.ReadBool(node.Attributes["insertRow"]);
            }
            if (node.Attributes["insertRowShift"] != null)
            {
                ctObj.insertRowShift = XmlHelper.ReadBool(node.Attributes["insertRowShift"]);
            }
            if (node.Attributes["totalsRowCount"] != null)
            {
                ctObj.totalsRowCount = XmlHelper.ReadUInt(node.Attributes["totalsRowCount"]);
            }
            if (node.Attributes["totalsRowShown"] != null)
            {
                ctObj.totalsRowShown = XmlHelper.ReadBool(node.Attributes["totalsRowShown"]);
            }
            if (node.Attributes["published"] != null)
            {
                ctObj.published = XmlHelper.ReadBool(node.Attributes["published"]);
            }
            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"]);
            }
            if (node.Attributes["headerRowBorderDxfId"] != null)
            {
                ctObj.headerRowBorderDxfId = XmlHelper.ReadUInt(node.Attributes["headerRowBorderDxfId"]);
            }
            if (node.Attributes["tableBorderDxfId"] != null)
            {
                ctObj.tableBorderDxfId = XmlHelper.ReadUInt(node.Attributes["tableBorderDxfId"]);
            }
            if (node.Attributes["totalsRowBorderDxfId"] != null)
            {
                ctObj.totalsRowBorderDxfId = XmlHelper.ReadUInt(node.Attributes["totalsRowBorderDxfId"]);
            }
            ctObj.headerRowCellStyle = XmlHelper.ReadString(node.Attributes["headerRowCellStyle"]);
            ctObj.dataCellStyle      = XmlHelper.ReadString(node.Attributes["dataCellStyle"]);
            ctObj.totalsRowCellStyle = XmlHelper.ReadString(node.Attributes["totalsRowCellStyle"]);
            if (node.Attributes["connectionId"] != null)
            {
                ctObj.connectionId = XmlHelper.ReadUInt(node.Attributes["connectionId"]);
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "autoFilter")
                {
                    ctObj.autoFilter = CT_AutoFilter.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "sortState")
                {
                    ctObj.sortState = CT_SortState.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "tableColumns")
                {
                    ctObj.tableColumns = CT_TableColumns.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "tableStyleInfo")
                {
                    ctObj.tableStyleInfo = CT_TableStyleInfo.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "extLst")
                {
                    ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
                }
            }
            return(ctObj);
        }
Exemple #12
0
 public static CT_Table Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Table ctObj = new CT_Table();
     if (node.Attributes["id"] != null)
         ctObj.id = XmlHelper.ReadUInt(node.Attributes["id"]);
     ctObj.name = XmlHelper.ReadString(node.Attributes["name"]);
     ctObj.displayName = XmlHelper.ReadString(node.Attributes["displayName"]);
     ctObj.comment = XmlHelper.ReadString(node.Attributes["comment"]);
     ctObj.@ref = XmlHelper.ReadString(node.Attributes["ref"]);
     if (node.Attributes["tableType"] != null)
         ctObj.tableType = (ST_TableType)Enum.Parse(typeof(ST_TableType), node.Attributes["tableType"].Value);
     if (node.Attributes["headerRowCount"] != null)
         ctObj.headerRowCount = XmlHelper.ReadUInt(node.Attributes["headerRowCount"]);
     if (node.Attributes["insertRow"] != null)
         ctObj.insertRow = XmlHelper.ReadBool(node.Attributes["insertRow"]);
     if (node.Attributes["insertRowShift"] != null)
         ctObj.insertRowShift = XmlHelper.ReadBool(node.Attributes["insertRowShift"]);
     if (node.Attributes["totalsRowCount"] != null)
         ctObj.totalsRowCount = XmlHelper.ReadUInt(node.Attributes["totalsRowCount"]);
     if (node.Attributes["totalsRowShown"] != null)
         ctObj.totalsRowShown = XmlHelper.ReadBool(node.Attributes["totalsRowShown"]);
     if (node.Attributes["published"] != null)
         ctObj.published = XmlHelper.ReadBool(node.Attributes["published"]);
     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"]);
     if (node.Attributes["headerRowBorderDxfId"] != null)
         ctObj.headerRowBorderDxfId = XmlHelper.ReadUInt(node.Attributes["headerRowBorderDxfId"]);
     if (node.Attributes["tableBorderDxfId"] != null)
         ctObj.tableBorderDxfId = XmlHelper.ReadUInt(node.Attributes["tableBorderDxfId"]);
     if (node.Attributes["totalsRowBorderDxfId"] != null)
         ctObj.totalsRowBorderDxfId = XmlHelper.ReadUInt(node.Attributes["totalsRowBorderDxfId"]);
     ctObj.headerRowCellStyle = XmlHelper.ReadString(node.Attributes["headerRowCellStyle"]);
     ctObj.dataCellStyle = XmlHelper.ReadString(node.Attributes["dataCellStyle"]);
     ctObj.totalsRowCellStyle = XmlHelper.ReadString(node.Attributes["totalsRowCellStyle"]);
     if (node.Attributes["connectionId"] != null)
         ctObj.connectionId = XmlHelper.ReadUInt(node.Attributes["connectionId"]);
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "autoFilter")
             ctObj.autoFilter = CT_AutoFilter.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "sortState")
             ctObj.sortState = CT_SortState.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "tableColumns")
             ctObj.tableColumns = CT_TableColumns.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "tableStyleInfo")
             ctObj.tableStyleInfo = CT_TableStyleInfo.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "extLst")
             ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager);
     }
     return ctObj;
 }
Exemple #13
0
        public static TableDocument Parse(Stream stream)
        {
            CT_Table obj = (CT_Table)serializer.Deserialize(stream);

            return(new TableDocument(obj));
        }
Exemple #14
0
        public static TableDocument Parse(XmlDocument xmldoc, XmlNamespaceManager namespaceMgr)
        {
            CT_Table obj = CT_Table.Parse(xmldoc.DocumentElement, namespaceMgr);

            return(new TableDocument(obj));
        }