当我们导出农业网格中显示的数据时,我们可以使用内置的导出功能导出它们。对于导出的 Excel,我们需要更改包括标题在内的所有单元格的字体大小。有一种方法可以更改数据单元格值的字体大小,但不能更改单元格标题的字体大小。
可以使用 excelStyles 并在 JSON 中提供 font: { size: "11"} 来编辑单元格值字体大小。
有谁知道我们如何更改导出的Excel中标题的字体大小
我尝试了以下方法来解决这个问题,它适用于 FF 但不适用于 Chrome。
::ng-deep div.ag-cell-value {
-webkit-touch-callout: default;
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
cursor:auto;
}
Run Code Online (Sandbox Code Playgroud)
甚至从下面 chrome 检查中的其他单元格中随机选择文本,
请通过将此 css 添加到下面的标准模板来检查问题, https://stackblitz.com/edit/ag-grid-angular-hello-world
我的列定义如下所示,并且我请求显示为名称 = 名字 + 姓氏,而不是显示为网格中的两个不同列。

var users_column = [
{
field: 'FIRST_NAME',
suppressMenu: true,
}, {
field: 'LAST_NAME',
suppressMenu: true,
},
Run Code Online (Sandbox Code Playgroud) 在开发我面临问题的程序时,将抽象类扩展为可共享的角度组件
这是我的代码:
AgGridDatasource(aggrid.model.ts)
export abstract class AgGridDatasource {
private _gridOptions: GridOptions = DEFAULT_GRID_OPTIONS;
private _gridApi: GridApi;
private _gridColumnApi: ColumnApi;
protected constructor(gridOptions: GridOptions) {
this._gridOptions = Object.assign({}, this._gridOptions, gridOptions);
}
refreshColumns(): void {
if (this._gridApi) {
this._gridApi.setColumnDefs(this.createColumns());
}
}
abstract createColumns(): AbstractColDef[];
onGridReady(event): void {
this._gridApi = event.api;
this._gridColumnApi = event.columnApi;
}
get gridOptions(): GridOptions {
return this._gridOptions;
}
get gridApi(): GridApi {
return this._gridApi;
}
get gridColumnApi(): ColumnApi {
return this._gridColumnApi;
}
}
Run Code Online (Sandbox Code Playgroud)
AgGridComponent
@Component({
selector: 'ag-grid',
templateUrl: './ag-grid.component.html', …Run Code Online (Sandbox Code Playgroud) 正如您在图像中看到的那样。
当网格重新加载第二个和第三个网格选择时,屏幕上不会显示。
但是当我向下滚动到网格时,我可以看到它被选中。这个问题发生在企业中,因为(可能是该行不在屏幕上,因为企业一次显示 100 行)。任何人处理这种情况
对于每个节点,我正在选择这样的行,但它在屏幕上不是自动可见的
setTimeout(() => {
if (node.selectedChildNode) {
params.api.forEachNode((item: any) => {
if (item.data === node.selectedChildNode) {
item.setSelected(true, true);
}
});
}
}, 0);
Run Code Online (Sandbox Code Playgroud)