导出为PDF时,列内容超出了uigrid angularjs中的列边框

时间:2016-06-09 03:40:30

标签: angularjs angularjs-directive angularjs-scope angularjs-ng-repeat angular-ui-grid

如果我得到这样的列数据,其间没有空格

$scope.gridOptions.data = [{"name":"rasheedsyedabdulhameed"}]; 这是我的网格选项

 $scope.gridOptions = {
columnDefs: [
  { field: 'name' },
  { field: 'name' },
  { field: 'name' }
],
enableGridMenu: true,
enableSelectAll: true,
exporterCsvFilename: 'myFile.csv',
exporterPdfDefaultStyle: {fontSize: 9},
exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
exporterPdfFooter: function ( currentPage, pageCount ) {
  return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
},
exporterPdfCustomFormatter: function ( docDefinition ) {
  docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
  docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
  return docDefinition;
},
exporterPdfOrientation: 'landscape',
exporterPdfPageSize: 'LETTER',
exporterPdfMaxGridWidth: 500,
exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
onRegisterApi: function(gridApi){
  $scope.gridApi = gridApi;
}

};

在导出到pdf表单时,内容超出了列边框,这是我的示例plunker just a sample

1 个答案:

答案 0 :(得分:0)

您可以在每列上使用function getColumnSum(){ try { var unid = param.documentId; var columnData = @DbLookup(@DbName(), "totalScore", unid, 8); //column to be summed: counting from 1 will give you 8 instead of [7]; if(columnData != null){ var columnSum = @Sum(columnData).toFixed(0); return " " + columnSum; }else{ return " " + "0"; } }catch(e){ print(e.toString()); } } getColumnSum(); 来调整内容。但是,如果内容非常大,您的表格可能会超出页面大小。