这与此github link相关(用户有40列,并希望导出为pdf)。这里的解决方案是仅使用横向模式(我已经尝试过),但是我的表中只有117列(是的,列数可笑),不幸的是,由于每列都包含重要信息,因此我需要全部导出
有没有办法一次打印出“ x”列?
(例如,假设我要导出一个包含150列的表,而pdfmake [或以其他方式导出pdf的方式]在横向模式下每页打印25列。这意味着需要6页打印出表的前“ y”行(其中y =可容纳横向pdf打印输出的最大行数)。
到目前为止,这是我导出具有大量列的表的唯一解决方案。我将不胜感激!
此刻,我的网格选项看起来像这样:
$scope.gridOptions= {
enableGridMenu: true,
enableSelectAll: true,
exporterCsvFilename: 'Report.csv',
enableColumnMenus : false,
enableColumnResizing: true,
exporterPdfDefaultStyle: {fontSize: 9},
//need this to center grid
exporterPdfTableStyle: {margin: [-40, -10, -10, -20]},
exporterExcelFilename: 'myFile.xlsx',
exporterExcelSheetName: 'Sheet1',
exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics:
true, color: 'red'},
exporterPdfHeader: { text: "", style: 'headerStyle'},
//Allows external buttons to be pressed for exporting
onRegisterApi: function(gridApi){$scope.gridApi = gridApi;
},
exporterPdfMaxGridWidth: 680,
exporterPdfFooter: function ( currentPage, pageCount ) {
return { text: 'Page ' + currentPage.toString() + ' of ' +
pageCount.toString(), style: 'footerStyle' };
},
exporterFieldCallback: function (grid, row, col, value) {
return grid.getCellDisplayValue(row, col);
}
};
$scope.exportCsv = function() {
var grid = $scope.gridApi.grid;
var rowTypes = uiGridExporterConstants.ALL;
var colTypes = uiGridExporterConstants.ALL;
uiGridExporterService.csvExport(grid, rowTypes, colTypes);
};
$scope.exportPdf = function() {
var grid = $scope.gridApi.grid;
var rowTypes = uiGridExporterConstants.ALL;
var colTypes = uiGridExporterConstants.ALL;
uiGridExporterService.pdfExport(grid, rowTypes, colTypes);
};
(如果此时我尝试导出pdf,则csv导出会正常运行,但pdf导出每次都会崩溃)