当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·怎么实现 “自动填充”    »显示摘要«
    摘要: 怎么实现 “自动填充”?比如在ie里输入micr,就显示出“microsoft" ( 或“www.microsoft.com") ......
    摘要: 如何隐藏pagecontrol上的切换button??? ......


关于生成XML文件的问题.前缀出不来

private   void   btnCreateFile_Click(object   sender,   System.EventArgs   e)   {  
              string   fileName="d:\\testXml\\createFile.xml";  
              XmlDocument   docXml   =   new   XmlDocument();  
              XmlElement   rootNode=docXml.CreateElement("xml");  
              rootNode.SetAttribute("xmlns:x","urn:schemas-microsoft-com:office:excel");  
              rootNode.SetAttribute("xmlns:dt","uuid:C2F41010-65B3-11d1-A29F-00AA00C14882");    
              rootNode.SetAttribute("xmlns:s","uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");    
              rootNode.SetAttribute("xmlns:rs","urn:schemas-microsoft-com:rowset");  
              rootNode.SetAttribute("xmlns:z","#RowsetSchema");      
              docXml.AppendChild(rootNode);  
   
              XmlElement   pivotCacheNode=docXml.CreateElement("x:PivotCache");  
              rootNode.AppendChild(pivotCacheNode);    
              XmlElement   cacheIndexNode=docXml.CreateElement("x:CacheIndex");  
              cacheIndexNode.InnerText="1";    
              pivotCacheNode.AppendChild(cacheIndexNode);    
              XmlElement   rowsetSchemaNode=docXml.CreateElement("s:Schema");  
              rowsetSchemaNode.SetAttribute("id","RowsetSchema");  
              pivotCacheNode.AppendChild(rowsetSchemaNode);    
              XmlElement     elementTypeNode=docXml.CreateElement("s:ElementType");  
              elementTypeNode.SetAttribute("name","row");  
              elementTypeNode.SetAttribute("content","eltOnly");  
              rowsetSchemaNode.AppendChild(elementTypeNode);  
              int   i;  
              XmlElement   tempNode;  
              for(i=1;i<8;i++){  
                  tempNode=docXml.CreateElement("s:attribute");  
                  tempNode.SetAttribute("type","Col"+i.ToString());  
                  elementTypeNode.AppendChild(tempNode);    
                 
                  tempNode=docXml.CreateElement("AttributeType");  
                  tempNode.Prefix="s";    
                  tempNode.SetAttribute("name","Col"+i.ToString());  
                  tempNode.SetAttribute("rs:name","test"+i.ToString());  
   
                  rowsetSchemaNode.AppendChild(tempNode);  
   
                  tempNode.AppendChild(docXml.CreateElement("s:datatype"))   ;  
                  ((XmlElement)(tempNode.FirstChild)).SetAttribute("dt:maxLength","255");      
              }  
                  tempNode=docXml.CreateElement("s:extends");  
                  tempNode.SetAttribute("type","rs:rowbase");    
                  elementTypeNode.AppendChild(tempNode);    
   
                  XmlElement   dataNode=docXml.CreateElement("rs:data");  
                  pivotCacheNode.AppendChild(dataNode);    
   
              docXml.Save(fileName)   ;  
          }  
 

NO.1   作者: tylzice

巴西对WIN了.  
   
  试试这个:  
   
      private   void   btnCreateFile_Click(object   sender,   System.EventArgs   e)    
      {  
              string   fileName="d:\\createFile.xml";  
              XmlDocument   docXml   =   new   XmlDocument();  
              XmlElement   rootNode=docXml.CreateElement("xml");  
              rootNode.SetAttribute("xmlns:x","urn:schemas-microsoft-com:office:excel");  
              rootNode.SetAttribute("xmlns:dt","uuid:C2F41010-65B3-11d1-A29F-00AA00C14882");    
              rootNode.SetAttribute("xmlns:s","uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");    
              rootNode.SetAttribute("xmlns:rs","urn:schemas-microsoft-com:rowset");  
              rootNode.SetAttribute("xmlns:z","#RowsetSchema");      
              docXml.AppendChild(rootNode);  
               
        string   prex=rootNode.GetPrefixOfNamespace("urn:schemas-microsoft-com:office:excel");  
        string   predt=rootNode.GetPrefixOfNamespace("uuid:C2F41010-65B3-11d1-A29F-00AA00C14882");  
        string   pres=rootNode.GetPrefixOfNamespace("uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");  
        string   prexrs=rootNode.GetPrefixOfNamespace("urn:schemas-microsoft-com:rowset");  
        string   prexz=rootNode.GetPrefixOfNamespace("#RowsetSchema");  
   
              XmlElement   pivotCacheNode=docXml.CreateElement(prex,"PivotCache","urn:schemas-microsoft-com:office:excel");  
              rootNode.AppendChild(pivotCacheNode);    
              XmlElement   cacheIndexNode=docXml.CreateElement(prex,"CacheIndex","urn:schemas-microsoft-com:office:excel");  
              cacheIndexNode.InnerText="1";    
              pivotCacheNode.AppendChild(cacheIndexNode);    
              XmlElement   rowsetSchemaNode=docXml.CreateElement(pres,"Schema","uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");  
              rowsetSchemaNode.SetAttribute("id","RowsetSchema");  
              pivotCacheNode.AppendChild(rowsetSchemaNode);    
              XmlElement     elementTypeNode=docXml.CreateElement(pres,"ElementType","uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");  
              elementTypeNode.SetAttribute("name","row");  
              elementTypeNode.SetAttribute("content","eltOnly");  
              rowsetSchemaNode.AppendChild(elementTypeNode);  
              int   i;  
              XmlElement   tempNode;  
              for(i=1;i<8;i++){  
                  tempNode=docXml.CreateElement(pres,"attribute","uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");  
                  tempNode.SetAttribute("type","Col"+i.ToString());  
                  elementTypeNode.AppendChild(tempNode);    
                 
                  tempNode=docXml.CreateElement(pres,"AttributeType","uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882");  
                  tempNode.SetAttribute("name","Col"+i.ToString());  
                  tempNode.SetAttribute("rs:name","test"+i.ToString());  
   
                  rowsetSchemaNode.AppendChild(tempNode);  
   
                  tempNode.AppendChild(docXml.CreateElement(pres,"datatype","uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"))   ;  
                  ((XmlElement)(tempNode.FirstChild)).SetAttribute("dt:maxLength","255");      
              }  
                  tempNode=docXml.CreateElement("s:extends");  
                  tempNode.SetAttribute("type","rs:rowbase");    
                  elementTypeNode.AppendChild(tempNode);    
   
                  XmlElement   dataNode=docXml.CreateElement("rs:data");  
                  pivotCacheNode.AppendChild(dataNode);    
   
              docXml.Save(fileName)   ;  
          }  
 


 ·如何控制一个窗体的显示    »显示摘要«
    摘要: 如何控制一个窗体的显示! 两个form,第一个form里的有一个panel,我想让第二个form显示的时候,显示在第一个form的panel里面!? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE