You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

DevExpress CxGrid ComponentPrinter如何去除打印文档中的<Filter is Empty>行?

How to Remove the <Filter is Empty> Line When Printing CxGrid with DevExpress

Hey there! That <Filter is Empty> line showing up in your print preview is DevExpress's default filter status panel—it’s meant to display the grid’s current filter state. Getting rid of it is super straightforward, though.

You just need to toggle one property on your TcxGridReportLink (which is dxComponentPrinter1Link1 in your code) to hide this panel. Here’s how to do it:

  1. Add this line of code right after your ReportPageSetUp call in the Btn_PrintClick procedure:
    dxComponentPrinter1Link1.OptionsView.ShowFilterPanel := False;
    

Modified Code Example

Here’s what your updated Btn_PrintClick procedure will look like:

procedure TFormMain.Btn_PrintClick(Sender: TObject);
procedure ReportPageSetUp(APL : TBasedxReportLink; APaperSize : Integer; AOrientation : Integer; AFitToPage : Boolean; ATitle : String; ACenterTitle : String; ATitleFont : String; AFontStyle : TFontStyles; ATitleSize : Integer);
begin
  APL.PrinterPage.DMPaper:=APaperSize;
  case AOrientation of
    0 : APL.PrinterPage.Orientation:=dxPrnDev.poPortrait;
    1 : APL.PrinterPage.Orientation:=dxPrnDev.poLandscape;
  end;
  APL.ShrinkToPageWidth:=AFitToPage;
  APL.ReportTitle.Text:=ATitle;
  APL.PrinterPage.PageHeader.LeftTitle.Clear;
  APL.PrinterPage.PageHeader.CenterTitle.Clear;
  APL.PrinterPage.PageHeader.RightTitle.Clear;
  APL.PrinterPage.PageHeader.Font.Name:=ATitleFont;
  APL.PrinterPage.PageHeader.Font.Style:=AFontStyle;
  APL.PrinterPage.PageHeader.Font.Size:=ATitleSize;
  APL.PrinterPage.PageHeader.LeftTitle.Add('username');
  APL.PrinterPage.PageHeader.CenterTitle.Add(ACenterTitle);
  APL.PrinterPage.PageHeader.RightTitle.Add('[date printed] [time printed]');
  APL.PrinterPage.ApplyToPrintDevice;
END;
var
  AOrientation: byte;
begin
  AOrientation := Integer(True);
  ReportPageSetUp(dxComponentPrinter1Link1, DMPAPER_A4, AOrientation, true, 'Title 1' , 'Title 2', 'Times New Roman',[fsBold],10);
  // Hide the filter status panel including "<Filter is Empty>" line
  dxComponentPrinter1Link1.OptionsView.ShowFilterPanel := False;
  dxComponentPrinter1.Preview(true, dxComponentPrinter1Link1);
end;

Alternative: Set It in Design Mode

If you don’t need to toggle this setting dynamically, you can set it directly in the IDE:

  • Locate dxComponentPrinter1Link1 in your form’s component list
  • Expand the OptionsView property
  • Uncheck the ShowFilterPanel option

This will permanently disable the filter panel for all print jobs using this report link.


内容的提问来源于stack exchange,提问作者DevPau

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 07:35:05