我们正在使用HTML / XML / CSS将表格导出到Excel 2007。
我有以下代码设置,当HTML页面加载时,它会将数据导出到Excel。前两行设置为冻结窗格,这在查看文档时很好,但不会在每个打印页面上打印这些行。我的所有页面数据都采用表格tr-t格式。
块底部(我已阅读)应该在每个打印页面上打印第一行......但事实并非如此。
我还读过......部分,应该在每个页面上打印第一行,但这似乎也不起作用。
赞赏任何建议,想法或答案!!
header("Cache-Control: public, must-revalidate");
header("Pragma: no-cache");
header ('Content-type: application/vnd.ms-excel');
header ('Content-Disposition: attachment; filename=StoreVsCompany.xls');
echo '
<html xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
<!--[if gte mso 9]>
<xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>VendorAgendaSummary</x:Name>
<x:WorksheetOptions>
<x:PageSetup>
<x:Layout x:Orientation="Portrait"/>
<x:Header x:Margin="0.3"/>
<x:Footer x:Margin="0.3"/>
<x:PageMargins x:Bottom="0.75" x:Left="0.5" x:Right="0.5" x:Top="0.75"/>
</x:PageSetup>
<x:FitToPage/>
<x:Print>
<x:FitHeight>100</x:FitHeight>
<x:ValidPrinterInfo/>
<x:HorizontalResolution>600</x:HorizontalResolution>
<x:VerticalResolution>600</x:VerticalResolution>
</x:Print>
<x:FreezePanes/>
<x:FrozenNoSplit/>
<x:SplitHorizontal>2</x:SplitHorizontal>
<x:TopRowBottomPane>2</x:TopRowBottomPane>
<x:SplitVertical>2</x:SplitVertical>
<x:LeftColumnRightPane>2</x:LeftColumnRightPane>
<x:ActivePane>0</x:ActivePane>
<x:Panes>
<x:Pane>
<x:Number>3</x:Number>
</x:Pane>
<x:Pane>
<x:Number>1</x:Number>
</x:Pane>
<x:Pane>
<x:Number>2</x:Number>
</x:Pane>
<x:Pane>
<x:Number>0</x:Number>
<x:ActiveRow>0</x:ActiveRow>
<x:ActiveCol>1</x:ActiveCol>
</x:Pane>
</x:Panes>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
<x:ExcelName>
<x:Name>Print_Titles</x:Name>
<x:SheetIndex>1</x:SheetIndex>
<x:Formula>=\'strWorkBookName\'!$1:$1</x:Formula>
</x:ExcelName>
</xml>
<![endif]-->
</head>';
答案 0 :(得分:1)
使用这个的组合,我能够冻结第6行。
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:FreezePanes/>
<x:FrozenNoSplit/>
<x:SplitHorizontal>6</x:SplitHorizontal>
<x:TopRowBottomPane>6</x:TopRowBottomPane>
<x:ActivePane>2</x:ActivePane>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
<x:ExcelName>
<x:Name>Print_Titles</x:Name>
<x:SheetIndex>1</x:SheetIndex>
<x:Formula>=Sheet1!$6:$6</x:Formula>
</x:ExcelName>