开发者

html to excel - print row 1 on every page

We are using HTML/XML/CSS to export a table to excel 2007.

I have the below code setup, which when the HTML page loads, it then exports the data to Excel. The first two rows are set as frozen panes, which is great while viewing the document, but does not print those rows on every printed page. All of my page data is in table tr-th tr-td format.

the block towads the bottom (i have read) is supposed to make the first row print on every printed page... but it is not.

I have also read that the .... section, should print the first rows on every page, but this does not seem to work either.

Any suggestions, ideas or answers are appreciated!!

    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>';   


using a combination of this, i was able to freeze row 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜