Skip to content

Exporting Data

Exporting Data

Exporting Data

format could be - pdf - excel - csv - html heading is used as Heading of pdf file. orientation is page orientation. Could be landscape or portrait. paper values could be 4a0,2a0,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,b0,b1, b2,b3,b4,b5,b6,b7,b8,b9,b10,c0,c1,c2,c3,c4,c5, c6,c7,c8,c9,c10,ra0,ra1,ra2,ra3,ra4,sra0,sra1, sra2,sra3,sra4,letter,legal,ledger,tabloid,executive, folio,commercial #10 envelope,catalog #10 1/2 envelope, 8.5x11,8.5x14,11x17

$opt["export"] = array("format"=>"pdf", "filename"=>"my-file", "sheetname"=>"test");
$opt["export"] = array("filename"=>"my-file", "heading"=>"Invoice Details", "orientation"=>"landscape", "paper"=>"a4");

Setting paged to 1 will only export current page.

$opt["export"]["paged"] = "1";

Export all data which is fetched by SQL, or export after applying search filters (if any) Possible values are filtered or all.

$opt["export"]["range"] = "filtered";

When exporting PDF, if you define column width, you need to set width of all columns. Setting width for few and leaving few will make export column width distorted. In order to make it independent of $col["width"] and adjust equally in pdf, you can set:

$grid["export"]["colwidth"] = "equal";

You can also set certain column not to export by setting export option to false. e.g.

$col["export"] = false;

You can also add export buttons on toolbar by:

$g = new jqgrid($conf);
// ...
                        // ...


^ Top