Delphi 中的 FastReport 页面方向更改

发布于 2024-08-16 03:26:36 字数 121 浏览 7 评论 0原文

有谁知道如何在 FastReport 中设计报表,以便当用户更改页面方向时,所有列标题和数据自动适应新的页面宽度?我在那里找不到任何锚定机制。也许我可以在运行时这样做?但随后我需要以某种方式捕获页面方向更改事件。有人可以帮忙吗?

Does anybody know how to design report in FastReport so that when user changes page orientation all column headers and data autofits new page width? I couldn't find any anchor mechanism there. Maybe I can do that during run-time? But then I need to catch page orientation change event somehow. Can anybody help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

水中月 2024-08-23 03:26:36

我不知道问题是什么:默认情况下,带子对页面边框具有磁性,因此它们适合新的页面宽度。

但如果您希望 frxMemoview 对象根据新的页面大小移动和调整大小,则应使用报表的 beforeprint 事件来重新计算、移动或调整报表组件的大小。

如果您有一份可以纵向或横向打印的报告,最简单的构建方法是纵向布局和横向布局。您可以在加载报告之前显示打印机设置日志,并根据方向加载纵向或横向布局。

这可能不是最干净的方式。在代码中构建报表运行时是另一种选择,重新计算报表中的每个组件也是另一种选择。但它们涉及大量编码,如果用户选择“Letter”而不是“A4”怎么办?

问候,
特奥
荷兰FR经销商。

I don't know what the question is: Bands are magnetic to page borders by default, so they fit the new page width.

But if you want the frxMemoview objects to move and resize according to the new page size, you should use the beforeprint event of the report to recalculate and move or size the report components.

If you have a report that can be printed both in portrait or landscape, the easiest way to buid this would be a layout for portrait and one for landscape. You could show a printersetupdailog before loading the report and depending on the orientation load the portrait or landscape layout.

This may not be the cleanest way. Building your report runtime in code is another option and recalculating every component in the report is another. But they involve a lot of coding and what if the user selects "Letter" instead of "A4"?

Regards,
Teo
FR dealer in Holland.

我的黑色迷你裙 2024-08-23 03:26:36

您可以:

  • 使用每个的对齐属性
    TfrxMemoview...
  • 用脚本制作

You can :

  • use the Align property of each
    TfrxMemoview...
  • make it with Script
爱的故事 2024-08-23 03:26:36

有时需要通过代码修改报告页面设置(例如,修改纸张对齐方式或尺寸)。 TfrxReportPage 类包含以下属性,定义页面的大小:

   property Orientation: TPrinterOrientation default poPortrait;

   property PaperWidth: Extended;

   property PaperHeight: Extended;

   property PaperSize: Integer;

«PaperSize» 属性设置纸张格式。这是 Windows.pas 中定义的标准值之一(例如 DMPAPER_A4)。如果为此属性分配了值,FastReport 将自动填充 «PaperWidth» 和 «PaperHeight» 属性(纸张尺寸以毫米为单位)。将 DMPAPER_USER(或 256)值设置为格式,意味着设置了自定义纸张尺寸。在这种情况下,应手动填充“PaperWidth”和“PaperHeight”属性。

下面的例子展示了如何修改第一页的参数(假设我们已经有一个报告):

Pascal:

var
Page: TfrxReportPage; 
{ the first report’s page has [1] index. [0] is the Data page. } 
Page := TfrxReportPage(frxReport1.Pages[1]);  
{ modify the size } 
Page.PaperSize := DMPAPER_A2;   
{ modify the paper orientation }  
Page.Orientation := poLandscape;

C++:

TfrxReportPage * Page;
// the first report’s page has [1] index. [0] is the Data page. 
Page = (TfrxReportPage *)frxReport1.Pages[1];
// modify the size 
Page->PaperSize = DMPAPER_A2;
// modify the paper orientation 
Page->Orientation = poLandscape;

Sometimes it is necessary to modify report page settings (for example, to modify paper alignment or size) from a code. The TfrxReportPage class contains the following properties, defining the size of the page:

   property Orientation: TPrinterOrientation default poPortrait;

   property PaperWidth: Extended;

   property PaperHeight: Extended;

   property PaperSize: Integer;

The «PaperSize» property sets paper format. This is one of the standard values, defined in the Windows.pas (for example, DMPAPER_A4). If a value to this property is assigned, FastReport fills the «PaperWidth» and «PaperHeight» properties automatically (paper size in millimeters). Setting the DMPAPER_USER (or 256) value as a format, would mean that custom paper size is set. In this case, the «PaperWidth» and «PaperHeight» properties should be filled manually.

The following example shows, how to modify parameters of the first page (it is assumed that we already have a report):

Pascal:

var
Page: TfrxReportPage; 
{ the first report’s page has [1] index. [0] is the Data page. } 
Page := TfrxReportPage(frxReport1.Pages[1]);  
{ modify the size } 
Page.PaperSize := DMPAPER_A2;   
{ modify the paper orientation }  
Page.Orientation := poLandscape;

C++:

TfrxReportPage * Page;
// the first report’s page has [1] index. [0] is the Data page. 
Page = (TfrxReportPage *)frxReport1.Pages[1];
// modify the size 
Page->PaperSize = DMPAPER_A2;
// modify the paper orientation 
Page->Orientation = poLandscape;
溺渁∝ 2024-08-23 03:26:36

BeginDoc i 上,您可以使用 (frxPrincipal.FindObject('Page1') as TfrxReportPage).PaperSize := DMPAPER_A4; 访问其中的属性

On BeginDoc i you can acess the properties from it using (frxPrincipal.FindObject('Page1') as TfrxReportPage).PaperSize := DMPAPER_A4;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文