<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40"><head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 9">
<style>
<!--table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:1.0in .75in 1.0in .75in;
mso-header-margin:.5in;
mso-footer-margin:.5in;}
tr
{mso-height-source:auto;
mso-ruby-visibility:none;}
col
{mso-width-source:auto;
mso-ruby-visibility:none;}
br
{mso-data-placement:same-cell;}
.style0
{mso-number-format:General;
text-align:general;
vertical-align:middle;
white-space:nowrap;
mso-rotate:0;
mso-background-source:auto;
color:windowtext;
font-size:12.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
border:none;
mso-protection:locked visible;
mso-style-name:常规;
mso-style-id:0;}
.total
{mso-style-parent:style0;
mso-number-format:"0\.00_ ";}
.xl23
{mso-style-parent:style0;
border:.5pt solid windowtext;
mso-number-format:"0\.00_ ";}
.xl24
{mso-style-parent:style0;
border:.5pt solid windowtext;}
.xl25
{mso-style-parent:style0;
mso-number-format:"Long Date";
text-align:left;
border:.5pt solid windowtext;}
.xl26
{mso-style-parent:style0;
mso-number-format:"Long Time";
}
.xl27
{mso-style-parent:style0;
mso-number-format:"Short Date";
}
ruby
{ruby-align:left;}
rt
{color:windowtext;
font-size:10.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:宋体;
mso-generic-font-family:auto;
mso-font-charset:134;
mso-char-type:none;
display:none;}
body,td,th {
font-size: 10pt;
}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetOptions>
     <x:DefaultRowHeight>225</x:DefaultRowHeight>
     <x:Print>
      <x:ValidPrinterInfo/>
      <x:PaperSizeIndex>9</x:PaperSizeIndex>
      <x:HorizontalResolution>-3</x:HorizontalResolution>
      <x:VerticalResolution>0</x:VerticalResolution>
     </x:Print>
     <x:Selected/>
     <x:Panes>
      <x:Pane>
       <x:Number>3</x:Number>
       <x:ActiveRow>24</x:ActiveRow>
       <x:ActiveCol>5</x:ActiveCol>
      </x:Pane>
     </x:Panes>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
    <x:PageBreaks> 
          <x:RowBreaks> 
            <x:RowBreak> 
              <x:Row> 1 </x:Row> 
            </x:RowBreak> 
            <x:RowBreak> 
              <x:Row> 3 </x:Row> 
            </x:RowBreak> 
          </x:RowBreaks> 
        </x:PageBreaks>
   </x:ExcelWorksheet>
   <x:ExcelWorksheet>
    <x:Name>Sheet2</x:Name>
    <x:WorksheetOptions>
     <x:DefaultRowHeight>225</x:DefaultRowHeight>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
   <x:ExcelWorksheet>
    <x:Name>Sheet3</x:Name>
    <x:WorksheetOptions>
     <x:DefaultRowHeight>225</x:DefaultRowHeight>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:WindowHeight>6600</x:WindowHeight>
  <x:WindowWidth>12000</x:WindowWidth>
  <x:WindowTopX>0</x:WindowTopX>
  <x:WindowTopY>1395</x:WindowTopY>
  <x:ProtectStructure>False</x:ProtectStructure>
  <x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
上面这一段是我生成伪EXCEL加的文件头,,后面直接跟 <table></table> 就可以了,,
目前导出EXCEL可以实现,也没什么大问题,,但是我现在要做的是有一些内容我要放到 第二个工作表 即 sheet2 里,,
但无论我增加一个 <table> 或者 在 <tr> 里增加 style = "page-break-after" 
或者在文件头中的 XML代码段里增加 <PageBreak> 节点,,都无法实现
我目前不想改变整个项目的结构,,ADO.NET导出  貌似是不能加颜色吧?
用EXCEL的DLL组件生成起来比较慢,,因为表格颜色太多,画颜色浪费的时间就更可怕
等待解决方案----------------------------
最后,请注意,我是要把内容放到 sheet2 里去!!! 就这一个问题,,
如果能解决问题,可以加分!!!

解决方案 »

  1.   

    刚才研究了下  他会创建一个  excel文件名+files的文件夹  里面包含了框架和内容htm页
    把主excel文件作为 frame框架  。饿,,,构建了一个小型网站系统,,晕
      

  2.   

    我之前也做过这种,也是想放到sheet2里,没有实现,当时查资料,都说要启动excel进程。就是你说的要用excel的dll。
    还做过生成word的,当时是处理行间距,html里的行间距不能输出到word里显示。查资料,也是说要用word进程,但是生成很慢
      

  3.   

    其实,,放到sheet2里 目前我发现的东西来看  是可以实现的,只是要事先模拟一个小型的网站系统
    但真要那么做,,我觉得我就没必要用这个方法生成EXCEL了,,哎,,纠结中……
      

  4.   

    javascript实现!网上有的是!代码就不贴了!
      

  5.   


    我不明白的是,我都贴了文件头了,,你还不明白 我不是用的B/S程序么?
    我如果用B/S我干嘛费这么多劲 写那文件头?
      

  6.   

    好像,你用EXCEL打开修改后再保存它也还用XML来保存
    你试一下在EXCL里增加一个SHEET看XML长什么样。