xml模板导出Excel

文笔不好,就不废话了
using  System;
using  System.Data;
using  System.Text;
using  System.IO;
using  System.Xml;
using  System.Collections.Generic;

namespace  MaYa.Common
{
    
public class ExcelManager
    
{
        

        
//制作一个全新的Excel文件名
        private static string getExcelFileName()
        
{
            
string strFileName = DateTime.Now.ToString("yyyyMMddHHmmssfffffff"+ ".xls";
            
while (File.Exists(strFileName))
            
{
                strFileName 
= DateTime.Now.ToString("yyyyMMddHHmmssfffffff"+ ".xls";
            }

            
return strFileName;
        }


        
//修改xml模板文件中的数据行设定值
        private static void updateTableRowCount(XmlNode xmlTable, DataSet dsSource,int intIndex,string[] arrModeTitleIndex)
        
{
            
int intRowCount = 0;
            List
<XmlNode> xmlNodes = new List<XmlNode>();
            
int rowCount = dsSource.Tables[intIndex].Rows.Count;
            
if (rowCount <= 0)
            
{
                
return;
            }

            
try
            
{
                intRowCount 
= Convert.ToInt32(xmlTable.Attributes["ss:ExpandedRowCount"].Value);
                intRowCount 
+= rowCount;
                xmlTable.Attributes[
"ss:ExpandedRowCount"].Value = intRowCount.ToString();
                
//给当前模板的所有后续模板重新进行行定位
                for (int i = intIndex; i < arrModeTitleIndex.Length; i++)
                
{
                    xmlNodes 
= searchModeRow(xmlTable, "id", arrModeTitleIndex[i]);
                    
foreach (XmlNode node in xmlNodes)
                    
{
                        node.Attributes[
"ss:Index"].Value = (Convert.ToInt32(node.Attributes["ss:Index"].Value) + rowCount).ToString();
                    }

                }

                

            }

            
catch (Exception e)
            
{
                
throw e;
            }

        }


        
//寻找数据表中数据行模板,以便找到数据存储的起始位置和根据模板的格式向数据表中添加数据
        private static List<XmlNode> searchModeRow(XmlNode xmlTable, string markKey, string markValue)
        
{
            List
<XmlNode> xmlNodes = new List<XmlNode>();
            
foreach (XmlNode node in xmlTable)
            
{
                
if (node.Attributes == null || node.Attributes.Count <= 0)
                
{
                    
continue;
                }

                
foreach (XmlAttribute attribute in node.Attributes)
                
{
                    
if (attribute.Name.ToLower() == markKey.ToLower() && 
                        attribute.Value.ToLower() 
== markValue.ToLower())
                    
{
                        xmlNodes.Add(node);
                    }

                }

            }

            
if (xmlNodes.Count <= 0)
            
{
                
return null;
            }

            
return xmlNodes;
        }


        
//向数据表Table中插入数据
        private static void insertDataToTable(XmlDocument xmlDoc, DataTable dtSource, XmlNode xmlModeRow, ref XmlNode xmlTable)
        
{
            XmlNode xmlDataRow 
= null;
            XmlNode xmlDataCell 
= null;
            XmlNode xmlDataNode 
= null;
            XmlNode xmlNodeAtt 
= null;
            
try
            
{
                
//寻找数据的切入行
                if (xmlModeRow != null)
                
{
                    
//如果模板中只有Cell,没有Data
                    if (!xmlModeRow.FirstChild.HasChildNodes)
                    
{
                        xmlDataNode 
= xmlDoc.CreateNode(XmlNodeType.Element, "Data"null);
                        xmlNodeAtt 
= xmlDoc.CreateNode(XmlNodeType.Attribute, "ss:Type""String");
                        xmlDataNode.Attributes.SetNamedItem(xmlNodeAtt);

                        
for (int i = 0; i < dtSource.Rows.Count; i++)
                        
{
                            
//克隆一个模板
                            xmlDataRow = xmlModeRow.Clone();
                            
for (int j = 0; j < xmlDataRow.ChildNodes.Count; j++)
                            
{
                                xmlDataCell 
= xmlDataRow.ChildNodes[j];
                                xmlDataNode.InnerText 
= dtSource.Rows[i][j].ToString();
                                xmlDataCell.AppendChild(xmlDataNode);
                            }

                            xmlTable.InsertAfter(xmlDataRow, xmlModeRow);
                        }

                    }

                    
else
                    
{
                        
for (int i = 0; i < dtSource.Rows.Count; i++)
                        
{
                            xmlDataRow 
= xmlModeRow.Clone();
                            
for (int j = 0; j < xmlDataRow.ChildNodes.Count; j++)
                            
{
                                xmlDataRow.ChildNodes[j].FirstChild.InnerText 
= dtSource.Rows[i][j].ToString();
                            }

                            xmlTable.InsertAfter(xmlDataRow, xmlModeRow);
                        }

                    }

                }

            }

            
catch (Exception e)
            
{
                
throw e;
            }

        }


        
public static string getExportExcelFile(DataSet dsSource, string modefilename,
                                                
string[] arrModeString,string[] arrModeTitleIndex, string strExportDirectory)
        
{
            
string createdExcelFileName = string.Empty;
            List
<XmlNode> lstNode = new List<XmlNode>();

            
if (!File.Exists(modefilename))
            
{
                
return string.Empty;
            }

            
if(dsSource.Tables.Count != arrModeString.Length)
            
{
                
return string.Empty;
            }

            
try
            
{
                DeletOldExportFile deleteOldExportFile 
= new DeletOldExportFile();
                deleteOldExportFile.Directory 
= strExportDirectory;
                System.Threading.Thread thread 
= new System.Threading.Thread(new System.Threading.ThreadStart(deleteOldExportFile.deleteExportFile));
                thread.Start();
                XmlDocument xmlDoc 
= new XmlDocument();
                XmlNode xmlModeRow 
= null;
                createdExcelFileName 
= getExcelFileName();
                xmlDoc.Load(modefilename);
                
//获取数据Table节点
                XmlNode xmlTable = xmlDoc.GetElementsByTagName("Table")[0];
                
for (int i = 0; i < dsSource.Tables.Count; i++)
                
{
                    lstNode 
= searchModeRow(xmlTable, "id", arrModeString[i]);
                    
if (lstNode != null)
                    
{
                        xmlModeRow 
= lstNode[0];
                        updateTableRowCount(xmlTable, dsSource, i, arrModeTitleIndex);
                    }

                    insertDataToTable(xmlDoc, dsSource.Tables[i], xmlModeRow, 
ref xmlTable);
                }

                xmlDoc.Save(strExportDirectory 
+ "/" + createdExcelFileName);
                
if (thread.IsAlive)
                
{
                    
if (deleteOldExportFile.DeleteFlag)
                    
{
                        thread.Abort();
                    }

                }

                
return createdExcelFileName;
            }

            
catch
            
{
                
return string.Empty;
            }

        }

    }


    
public class DeletOldExportFile
    
{
        
private string strDirectory = string.Empty;
        
private bool blDeleteFlag = false;

        
public string Directory
        
{
            
set
            
{
                strDirectory 
= value;
            }

        }

        
public bool DeleteFlag
        
{
            
get
            
{
                
return blDeleteFlag;
            }

        }


        
public void deleteExportFile()
        
{
            
string[] arrstr;
            
string str = string.Empty;
            
long lngData = 0;

            
long lgDateData = long.Parse(DateTime.Now.ToString("yyyyMMddHH")) * 100;

            arrstr 
= System.IO.Directory.GetFiles(strDirectory + "/""*.xls");
            
try
            
{
                
for (int i = 0; i < arrstr.Length; i++)
                
{
                    str 
= arrstr[i].Substring(arrstr[i].Length - 2512);
                    
if (long.TryParse(str, out lngData) && lngData < lgDateData)
                    
{
                        File.Delete(arrstr[i]);
                    }

                }

            }

            
catch
            
{ }
            
finally
            
{
                blDeleteFlag 
= true;
            }


        }

    }

}

<% @ Page Language = " C# "  AutoEventWireup = " true "   CodeFile = " Default.aspx.cs "  Inherits = " _Default "   %>

<! DOCTYPE html PUBLIC  " -//W3C//DTD XHTML 1.0 Transitional//EN "   " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >

< html xmlns = " http://www.w3.org/1999/xhtml "   >
< head runat = " server " >
    
< title > 无标题页 </ title >
</ head >
< body >
    
< form id = " form1 "  runat = " server " >
    
< div >
        
< asp:Button id = " button2 "  Text = " ExportExcel "  OnClick = " button2_Click "  runat = " Server "   />
    
</ div >
    
</ form >
</ body >
</ html >
using  System;
using  System.Data;
using  System.Configuration;
using  System.Web;
using  System.Web.Security;
using  System.Web.UI;
using  System.Web.UI.WebControls;
using  System.Web.UI.WebControls.WebParts;
using  System.Web.UI.HtmlControls;
using  System.Diagnostics;
using  MaYa.Common;
using  System.IO;
using  System.Xml;

public   partial   class  _Default : System.Web.UI.Page 
{
    
protected void Page_Load(object sender, EventArgs e)
    
{

        
    }


    
protected void button2_Click(object sender, EventArgs e)
    
{
        DataTable dt 
= null;
        DataTable dt1 
= null;
        DataSet ds 
= new DataSet();
        
        testdatetable(
out dt);
        testdatetable1(
out dt1);
        ds.Tables.Add(dt);
        ds.Tables.Add(dt1);
        
//和数据源DataTable匹配的模板数据行,用来标识插入DataTable数据的切入行
        string[] arrstr = new string[] "RowMode""RowMode2" };
        
//模板表头所在行标示关键字,用来及时修正模板表头所在数据行的行号
        string[] arrstrMode = new string[] "Mode2Title" };
        
string strfilename = ExcelManager.getExportExcelFile(ds, Server.MapPath(@"~XmlModeFolderNewXmlNoMode.xml"), arrstr, arrstrMode,
                                                                Server.MapPath(
@"~ExportExcelFolder"));
        Response.Redirect(
@"~ExportExcelFolder" + strfilename,true);
    }

    
private void testdatetable(out DataTable dtmt)
    
{
        dtmt 
= new DataTable();
        dtmt.Columns.Add(
new DataColumn("col1"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col2"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col3"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col4"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col5"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col6"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col7"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col8"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col9"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col10"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col11"typeof(string)));

        DataRow dr 
= null
        
for (int i = 0; i < 2000; i++)
        
{
            dr 
= dtmt.NewRow();
            
for (int j = 0; j < 11; j++)
            
{
                dr[j] 
= "test"+i.ToString();
            }

            dtmt.Rows.Add(dr);
        }

    }

    
private void testdatetable1(out DataTable dtmt)
    
{
        dtmt 
= new DataTable();
        dtmt.Columns.Add(
new DataColumn("col1"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col2"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col3"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col4"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col5"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col6"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col7"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col8"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col9"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col10"typeof(string)));
        dtmt.Columns.Add(
new DataColumn("col11"typeof(string)));

        DataRow dr 
= null;
        
for (int i = 0; i < 3000; i++)
        
{
            dr 
= dtmt.NewRow();
            
for (int j = 0; j < 11; j++)
            
{
                dr[j] 
= "testOOO";
            }

            dtmt.Rows.Add(dr);
        }

    }

}



Xml模板1:
<? xml version="1.0" ?>
<? mso-application progid="Excel.Sheet" ?>
< Workbook  xmlns ="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o
="urn:schemas-microsoft-com:office:office"
 xmlns:x
="urn:schemas-microsoft-com:office:excel"
 xmlns:ss
="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html
="http://www.w3.org/TR/REC-html40" >
 
< DocumentProperties  xmlns ="urn:schemas-microsoft-com:office:office" >
  
< LastAuthor > jye </ LastAuthor >
  
< Created > 1996-10-14T23:33:28Z </ Created >
  
< LastSaved > 2008-02-22T06:58:34Z </ LastSaved >
  
< Version > 11.5606 </ Version >
 
</ DocumentProperties >
 
< ExcelWorkbook  xmlns ="urn:schemas-microsoft-com:office:excel" >
  
< WindowHeight > 9300 </ WindowHeight >
  
< WindowWidth > 15135 </ WindowWidth >
  
< WindowTopX > 120 </ WindowTopX >
  
< WindowTopY > 120 </ WindowTopY >
  
< AcceptLabelsInFormulas />
  
< ProtectStructure > False </ ProtectStructure >
  
< ProtectWindows > False </ ProtectWindows >
 
</ ExcelWorkbook >
 
< Styles >
  
< Style  ss:ID ="Default"  ss:Name ="Normal" >
   
< Alignment  ss:Vertical ="Bottom" />
   
< Borders />
   
< Font  x:Family ="Swiss" />
   
< Interior />
   
< NumberFormat />
   
< Protection />
  
</ Style >
  
< Style  ss:ID ="m19863920" >
   
< Alignment  ss:Horizontal ="Left"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134" />
  
</ Style >
  
< Style  ss:ID ="m19877894" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="2" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134"  ss:Size ="20"  ss:Bold ="1" />
   
< Interior  ss:Color ="#FFFF99"  ss:Pattern ="Solid" />
  
</ Style >
  
< Style  ss:ID ="m19877904" >
   
< Alignment  ss:Horizontal ="Left"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="2" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134" />
  
</ Style >
  
< Style  ss:ID ="m19877914" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134"  ss:Size ="20" />
   
< Interior  ss:Color ="#FF9900"  ss:Pattern ="Solid" />
  
</ Style >
  
< Style  ss:ID ="s21" >
   
< Borders />
  
</ Style >
  
< Style  ss:ID ="s23" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Bottom" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s45" >
   
< Borders >
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="2" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s46" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s58" >
   
< Borders >
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s59" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s60" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s61" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s64" >
   
< Borders >
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="2" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s68" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
 
</ Styles >
 
< Worksheet  ss:Name ="Sheet1" >
  
< Table  ss:ExpandedColumnCount ="15"  ss:ExpandedRowCount ="17"  x:FullColumns ="1"
   x:FullRows
="1"  id ="maintable" >
   
< Column  ss:Index ="5"  ss:StyleID ="s21" />
   
< Column  ss:Index ="15"  ss:StyleID ="s21" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:StyleID ="s23" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:MergeDown ="4"  ss:StyleID ="m19877894" >< Data
      
ss:Type ="String" > 测试标题 </ Data ></ Cell >
   
</ Row >
   
< Row  ss:Index ="6"  ss:AutoFitHeight ="0"  ss:Height ="13.5" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="2"  ss:MergeDown ="1"  ss:StyleID ="m19877904" >< Data
      
ss:Type ="String" > 左上角 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s64" />
    
< Cell  ss:StyleID ="s64" />
    
< Cell  ss:StyleID ="s64" />
    
< Cell  ss:StyleID ="s64" />
    
< Cell  ss:StyleID ="s64" />
    
< Cell  ss:StyleID ="s64" />
    
< Cell  ss:StyleID ="s64" />
    
< Cell  ss:StyleID ="s45" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="8"  ss:StyleID ="s68" />
    
< Cell  ss:StyleID ="s68" />
    
< Cell  ss:StyleID ="s68" />
    
< Cell  ss:StyleID ="s68" />
    
< Cell  ss:StyleID ="s68" />
    
< Cell  ss:StyleID ="s68" />
    
< Cell  ss:StyleID ="s68" />
    
< Cell  ss:StyleID ="s46" />
   
</ Row >
   
< Row  ss:Index ="11"  id ="Mode2Title" >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:MergeDown ="2"  ss:StyleID ="m19877914" >< ss:Data
      
ss:Type ="String"  xmlns ="http://www.w3.org/TR/REC-html40" > 测试标题 < Font
       
html:Face ="Arial"  x:Family ="Swiss" > 2 </ Font ></ ss:Data ></ Cell >
   
</ Row >
   
< Row  ss:Index ="13"  ss:AutoFitHeight ="0"  ss:Height ="13.5"  id ="Mode2Title" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="2"  ss:MergeDown ="1"  ss:StyleID ="m19863920" >< Data
      
ss:Type ="String" > 左上角 </ Data ></ Cell >
    
< Cell  ss:Index ="15"  ss:StyleID ="s45" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="15"  ss:StyleID ="s46" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="5"  ss:StyleID ="s58" />
    
< Cell  ss:StyleID ="s59" />
    
< Cell  ss:StyleID ="s60" />
    
< Cell  ss:StyleID ="s60" />
    
< Cell  ss:StyleID ="s60" />
    
< Cell  ss:StyleID ="s60" />
    
< Cell  ss:StyleID ="s60" />
    
< Cell  ss:StyleID ="s60" />
    
< Cell  ss:StyleID ="s60" />
    
< Cell  ss:StyleID ="s61" />
    
< Cell  ss:StyleID ="s60" />
   
</ Row >
   
< Row  id ="RowMode2" >
    
< Cell  ss:Index ="5"  ss:StyleID ="s60" >< Data  ss:Type ="String" > test01 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s59" >< Data  ss:Type ="String" > test02 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test03 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test04 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test05 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test06 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test07 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test08 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test09 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s61" >< Data  ss:Type ="String" > test10 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s60" >< Data  ss:Type ="String" > test11 </ Data ></ Cell >
   
</ Row >
  
</ Table >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< Print >
    
< ValidPrinterInfo />
    
< PaperSizeIndex > 9 </ PaperSizeIndex >
    
< HorizontalResolution > 600 </ HorizontalResolution >
    
< VerticalResolution > 600 </ VerticalResolution >
   
</ Print >
   
< Selected />
   
< DoNotDisplayGridlines />
   
< Panes >
    
< Pane >
     
< Number > 3 </ Number >
     
< ActiveRow > 29 </ ActiveRow >
     
< ActiveCol > 7 </ ActiveCol >
    
</ Pane >
   
</ Panes >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
 
< Worksheet  ss:Name ="Sheet2" >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
 
< Worksheet  ss:Name ="Sheet3" >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
</ Workbook >

Xml模板2:
<? xml version="1.0" ?>
<? mso-application progid="Excel.Sheet" ?>
< Workbook  xmlns ="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o
="urn:schemas-microsoft-com:office:office"
 xmlns:x
="urn:schemas-microsoft-com:office:excel"
 xmlns:ss
="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html
="http://www.w3.org/TR/REC-html40" >
 
< DocumentProperties  xmlns ="urn:schemas-microsoft-com:office:office" >
  
< LastAuthor > jye </ LastAuthor >
  
< Created > 1996-10-14T23:33:28Z </ Created >
  
< LastSaved > 2008-02-22T06:58:34Z </ LastSaved >
  
< Version > 11.5606 </ Version >
 
</ DocumentProperties >
 
< ExcelWorkbook  xmlns ="urn:schemas-microsoft-com:office:excel" >
  
< WindowHeight > 9300 </ WindowHeight >
  
< WindowWidth > 15135 </ WindowWidth >
  
< WindowTopX > 120 </ WindowTopX >
  
< WindowTopY > 120 </ WindowTopY >
  
< AcceptLabelsInFormulas />
  
< ProtectStructure > False </ ProtectStructure >
  
< ProtectWindows > False </ ProtectWindows >
 
</ ExcelWorkbook >
 
< Styles >
  
< Style  ss:ID ="Default"  ss:Name ="Normal" >
   
< Alignment  ss:Vertical ="Bottom" />
   
< Borders />
   
< Font  x:Family ="Swiss" />
   
< Interior />
   
< NumberFormat />
   
< Protection />
  
</ Style >
  
< Style  ss:ID ="m120081850" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="2" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134"  ss:Size ="20"  ss:Bold ="1" />
   
< Interior  ss:Color ="#FFFF99"  ss:Pattern ="Solid" />
  
</ Style >
  
< Style  ss:ID ="m120081860" >
   
< Alignment  ss:Horizontal ="Left"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134" />
  
</ Style >
  
< Style  ss:ID ="s21" >
   
< Borders >
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s22" >
   
< Borders >
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s24" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Bottom" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s25" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Bottom" />
   
< Borders />
  
</ Style >
  
< Style  ss:ID ="s48" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s55" >
   
< Borders />
  
</ Style >
 
</ Styles >
 
< Worksheet  ss:Name ="Sheet1" >
  
< Table  id ="maintable"   ss:ExpandedColumnCount ="15"  ss:ExpandedRowCount ="10"  x:FullColumns ="1"
   x:FullRows
="1" >
   
< Column  ss:Index ="5"  ss:StyleID ="s21" />
   
< Column  ss:Index ="15"  ss:StyleID ="s22" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:StyleID ="s24" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:MergeDown ="4"  ss:StyleID ="m120081850" >< Data
      
ss:Type ="String" > 测试标题 </ Data ></ Cell >
   
</ Row >
   
< Row  ss:Index ="6"  ss:AutoFitHeight ="0"  ss:Height ="13.5" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="2"  ss:MergeDown ="1"  ss:StyleID ="m120081860" >< Data
      
ss:Type ="String" > 左上角 </ Data ></ Cell >
   
</ Row >
   
< Row  ss:Index ="9"  ss:StyleID ="s55" >
    
< Cell  ss:MergeAcross ="3"  ss:StyleID ="s25" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s48" />
   
</ Row >
   
< Row  id ="RowMode" >
    
< Cell  ss:Index ="5"  ss:StyleID ="s48" >< Data  ss:Type ="String" > test01 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test02 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test03 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test04 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test05 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test06 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test07 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test08 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test09 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test10 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s48" >< Data  ss:Type ="String" > test11 </ Data ></ Cell >
   
</ Row >
  
</ Table >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< Print >
    
< ValidPrinterInfo />
    
< PaperSizeIndex > 9 </ PaperSizeIndex >
    
< HorizontalResolution > 600 </ HorizontalResolution >
    
< VerticalResolution > 600 </ VerticalResolution >
   
</ Print >
   
< Selected />
   
< DoNotDisplayGridlines />
   
< Panes >
    
< Pane >
     
< Number > 3 </ Number >
     
< ActiveRow > 17 </ ActiveRow >
     
< ActiveCol > 7 </ ActiveCol >
    
</ Pane >
   
</ Panes >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
 
< Worksheet  ss:Name ="Sheet2" >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
 
< Worksheet  ss:Name ="Sheet3" >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
</ Workbook >
Xml模板3:
<? xml version="1.0" ?>
<? mso-application progid="Excel.Sheet" ?>
< Workbook  xmlns ="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o
="urn:schemas-microsoft-com:office:office"
 xmlns:x
="urn:schemas-microsoft-com:office:excel"
 xmlns:ss
="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html
="http://www.w3.org/TR/REC-html40" >
 
< DocumentProperties  xmlns ="urn:schemas-microsoft-com:office:office" >
  
< LastAuthor > jye </ LastAuthor >
  
< Created > 1996-10-14T23:33:28Z </ Created >
  
< LastSaved > 2008-02-22T06:58:34Z </ LastSaved >
  
< Version > 11.5606 </ Version >
 
</ DocumentProperties >
 
< ExcelWorkbook  xmlns ="urn:schemas-microsoft-com:office:excel" >
  
< WindowHeight > 9300 </ WindowHeight >
  
< WindowWidth > 15135 </ WindowWidth >
  
< WindowTopX > 120 </ WindowTopX >
  
< WindowTopY > 120 </ WindowTopY >
  
< AcceptLabelsInFormulas />
  
< ProtectStructure > False </ ProtectStructure >
  
< ProtectWindows > False </ ProtectWindows >
 
</ ExcelWorkbook >
 
< Styles >
  
< Style  ss:ID ="Default"  ss:Name ="Normal" >
   
< Alignment  ss:Vertical ="Bottom" />
   
< Borders />
   
< Font  x:Family ="Swiss" />
   
< Interior />
   
< NumberFormat />
   
< Protection />
  
</ Style >
  
< Style  ss:ID ="m19863828" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134"  ss:Size ="20" />
   
< Interior  ss:Color ="#FF9900"  ss:Pattern ="Solid" />
  
</ Style >
  
< Style  ss:ID ="m19863838" >
   
< Alignment  ss:Horizontal ="Left"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134" />
  
</ Style >
  
< Style  ss:ID ="m19877798" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="2" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134"  ss:Size ="20"  ss:Bold ="1" />
   
< Interior  ss:Color ="#FFFF99"  ss:Pattern ="Solid" />
  
</ Style >
  
< Style  ss:ID ="m19877808" >
   
< Alignment  ss:Horizontal ="Left"  ss:Vertical ="Center" />
   
< Borders >
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
   
< Font  ss:FontName ="宋体"  x:CharSet ="134" />
  
</ Style >
  
< Style  ss:ID ="s21" >
   
< Borders />
  
</ Style >
  
< Style  ss:ID ="s23" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Bottom" />
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s24" >
   
< Alignment  ss:Horizontal ="Center"  ss:Vertical ="Bottom" />
   
< Borders />
  
</ Style >
  
< Style  ss:ID ="s45" >
   
< Borders >
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="2" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s46" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s48" >
   
< Borders >
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s49" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s50" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Right"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
  
< Style  ss:ID ="s51" >
   
< Borders >
    
< Border  ss:Position ="Bottom"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Left"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
    
< Border  ss:Position ="Top"  ss:LineStyle ="Continuous"  ss:Weight ="1" />
   
</ Borders >
  
</ Style >
 
</ Styles >
 
< Worksheet  ss:Name ="Sheet1" >
  
< Table  ss:ExpandedColumnCount ="15"  ss:ExpandedRowCount ="17"  x:FullColumns ="1"
   x:FullRows
="1"  id ="maintable" >
   
< Column  ss:Index ="5"  ss:StyleID ="s21" />
   
< Column  ss:Index ="15"  ss:StyleID ="s21" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:StyleID ="s23" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:MergeDown ="4"  ss:StyleID ="m19877798" >< Data
      
ss:Type ="String" > 测试标题 </ Data ></ Cell >
   
</ Row >
   
< Row  ss:Index ="6"  ss:AutoFitHeight ="0"  ss:Height ="13.5" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="2"  ss:MergeDown ="1"  ss:StyleID ="m19877808" >< Data
      
ss:Type ="String" > 左上角 </ Data ></ Cell >
    
< Cell  ss:Index ="15"  ss:StyleID ="s45" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="15"  ss:StyleID ="s46" />
   
</ Row >
   
< Row  ss:StyleID ="s21" >
    
< Cell  ss:MergeAcross ="3"  ss:StyleID ="s24" />
    
< Cell  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s49" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s51" />
    
< Cell  ss:StyleID ="s50" />
   
</ Row >
   
< Row  id ="RowMode" >
    
< Cell  ss:Index ="5"  ss:StyleID ="s50" >< Data  ss:Type ="String" > test01 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s49" >< Data  ss:Type ="String" > test02 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test03 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test04 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test05 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test06 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test07 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test08 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test09 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s51" >< Data  ss:Type ="String" > test10 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test11 </ Data ></ Cell >
   
</ Row >
   
< Row >     < Cell  ss:Index ="5"  ss:MergeAcross ="10"  ss:MergeDown ="2"  ss:StyleID ="m19863828" >< ss:Data
      
ss:Type ="String"  xmlns ="http://www.w3.org/TR/REC-html40" >< Font
       
html:Face ="Arial"  x:Family ="Swiss" > 测试标题2 </ Font ></ ss:Data ></ Cell >
   
</ Row >
   
< Row  id ="Mode2Title"   ss:Index ="13"  ss:AutoFitHeight ="0"  ss:Height ="13.5" />
   
< Row >
    
< Cell  ss:Index ="5"  ss:MergeAcross ="2"  ss:MergeDown ="1"  ss:StyleID ="m19863838" >< Data
      
ss:Type ="String" > 左上角 </ Data ></ Cell >
    
< Cell  ss:Index ="15"  ss:StyleID ="s45" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="15"  ss:StyleID ="s46" />
   
</ Row >
   
< Row >
    
< Cell  ss:Index ="5"  ss:StyleID ="s48" />
    
< Cell  ss:StyleID ="s49" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s50" />
    
< Cell  ss:StyleID ="s51" />
    
< Cell  ss:StyleID ="s50" />
   
</ Row >
   
< Row  id ="RowMode2" >
    
< Cell  ss:Index ="5"  ss:StyleID ="s50" >< Data  ss:Type ="String" > test01 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s49" >< Data  ss:Type ="String" > test02 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test03 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test04 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test05 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test06 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test07 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test08 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test09 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s51" >< Data  ss:Type ="String" > test10 </ Data ></ Cell >
    
< Cell  ss:StyleID ="s50" >< Data  ss:Type ="String" > test11 </ Data ></ Cell >
   
</ Row >
  
</ Table >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< Print >
    
< ValidPrinterInfo />
    
< PaperSizeIndex > 9 </ PaperSizeIndex >
    
< HorizontalResolution > 600 </ HorizontalResolution >
    
< VerticalResolution > 600 </ VerticalResolution >
   
</ Print >
   
< Selected />
   
< DoNotDisplayGridlines />
   
< Panes >
    
< Pane >
     
< Number > 3 </ Number >
     
< ActiveRow > 24 </ ActiveRow >
     
< ActiveCol > 4 </ ActiveCol >
     
< RangeSelection > R25C5:R25C15 </ RangeSelection >
    
</ Pane >
   
</ Panes >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
 
< Worksheet  ss:Name ="Sheet2" >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
 
< Worksheet  ss:Name ="Sheet3" >
  
< WorksheetOptions  xmlns ="urn:schemas-microsoft-com:office:excel" >
   
< ProtectObjects > False </ ProtectObjects >
   
< ProtectScenarios > False </ ProtectScenarios >
  
</ WorksheetOptions >
 
</ Worksheet >
</ Workbook >


注意几个地方:
   1:xml文件中
  <Table ss:ExpandedColumnCount="15" ss:ExpandedRowCount="17" x:FullColumns="1"
   x:FullRows="1" id="maintable">

ss:ExpandedRowCount="17"  代表Excel文当中的行数,向xml文件中插入数据时,一定要对其进行相应的修改,否则会出错;
        
1:xml文件中有多个模板时, 如:模板3
<Row>    <Cell ss:Index="5" ss:MergeAcross="10" ss:MergeDown="2" ss:StyleID="m19863828"><ss:Data
      
ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40"><Font
       
html:Face="Arial" x:Family="Swiss">测试标题2</Font></ss:Data></Cell>
   
</Row>
   
<Row id="Mode2Title"  ss:Index="13" ss:AutoFitHeight="0" ss:Height="13.5"/>
这两个Row中有个属性
ss:Index="13" 是表示该模板在Excel文档中所处的行号;所以在往其内插入数据后一定要对其进行相应的修改,否则会出错;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值