简体   繁体   English

在Jqgrid中重复标题选项导出Pdf和Excel

[英]Repeated Header Option Export Pdf and Excel in Jqgrid

Hi i am using jqgrid for displaying the data and export data to pdf and excel format.i want to add header in each page in pdf and excel sheet i am attached the sample image 嗨,我正在使用jqgrid来显示数据并将数据导出为pdf和excel格式。我想在pdf和excel表格的每个页面中添加页眉我已附加了示例图像 在此处输入图片说明

I want to add Month,Head1,Head2,Head3 in each page in pdf and excel. 我想在pdf和excel的每个页面中添加Month,Head1,Head2,Head3。 i am searched in google but i am unable to find the option to enable repeated header in pdf,excel using jqgrid i am using the following option for exporting pdf and excel 我在谷歌中搜索,但是我找不到在pdf中启用重复标题的选项,使用jqgrid的excel我正在使用以下选项导出pdf和excel

        $("#export1").on("click", function(){
            $("#year_wise_rep").jqGrid("exportToPdf",{
                title: 'jqGrid Export to PDF',
                orientation: 'portrait',
                pageSize: 'A4',
                description: 'description of the exported document',
                customSettings: null,
                download: 'download',
                includeLabels : true,
                includeGroupHeader : true,
                includeFooter: true,
                fileName : "jqGridExport.pdf"
            })
        });                                      

        $("#export2").on("click", function(){
            $("#year_wise_rep").jqGrid("exportToExcel",{
                includeLabels : true,
                includeGroupHeader : true,
                includeFooter: true,
                fileName : "jqGridExport.xlsx",
                maxlength : 40 // maxlength for visible string data 
            })
        }) ;

please guide me to achieve the solution 请指导我实现解决方案

The degree symbol can be exported if you copy and paste it in your colModel label property. 如果将度数符号复制并粘贴到colModel label属性中,则可以将其导出。 The html tags for degree in pdf does not work. pdf中的度数html标签不起作用。 See the demo link below. 请参阅下面的演示链接。

It is not possible programmatically to repeat the header table in excel. 无法以编程方式在excel中重复头表。 You may want to look at this solution here 您可能要在这里查看此解决方案

By default a single header is printed repeated in pdf. 默认情况下,单个标题以pdf重复打印。 In your case to print the multiple headers you will need to use onBeforeExport event in pdf export and the property headersRows set to 2. Please see the docs here . 如果要打印多个标题,则需要在pdf导出中使用onBeforeExport事件,并将headersRows属性设置为2。请在此处查看文档

See the example here 看到这里例子

        $("#pdf").on("click", function(){
            $('#jqGrid').jqGrid('exportToPdf',{
                onBeforeExport : function( doc ) {
                    doc.content[0].table.headerRows = 2;
                }
            });
        });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM