将报表分配给Viewer、更改报表查看器主题和查看器中的全屏模式

【下载Stimulsoft Reports.JS最新版本】

(一)将报表分配给Viewer

此示例显示如何加载报表并将其分配给查看器,创建StiReport 类型的报表对象 ,然后通过调用loadFile()方法加载报表模板文件 。要在查看器中显示报表,将报表对象分配给查看者的报表属性即可。如果未呈现报表,则查看器会自动呈现它:

// Create the report viewer with default options
var viewer = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
// Create a new report instance
var report = new Stimulsoft.Report.StiReport();
// Load report from url
report.loadFile("../reports/SimpleList.mrt");
// Assign report to the viewer, the report will be built automatically after rendering the viewer
viewer.report = report;

示例代码的结果如下图所示。

stimulsoftJS


 

(二)更改报表查看器主题

此示例显示如何更改查看器默认主题。将head部分中主题的CSS文件替换为另一个可用主题,可用于超过15个 就绪主题,还可以根据需要调整CSS文件。例如,将Office2007 Blue主题应用于查看器:

<!-- Report viewer Office2007 Blue style -->
<link href="../css/stimulsoft.viewer.office2007.blue.css" rel="stylesheet">

示例代码的结果如下图所示。

stimulsoftJS


 

(三)查看器中的全屏模式

此示例显示如何在默认情况下以全屏模式显示报表查看器,在全屏模式下,查看器将显示在浏览器窗口的所有可用区域中。此外,要切换此模式,使用查看器工具栏上的全屏阅读按钮。要在默认情况下启用此模式,您需要在StiViewerOptions对象中设置fullScreenMode选项。例如,还设置为启用scrollbarsMode选项,此选项允许在查看器内使用内置报表窗口:

// Set full screen mode for the viewer
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.appearance.scrollbarsMode = true;
options.appearance.fullScreenMode = true;
 
// Create the report viewer with specified options
var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);

示例代码的结果如下图所示。

stimulsoftJS

查看本文,下载示例

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Test_FastReportPrint4万能fr3报表查看器 自设计支持按文本格式查看fr3报表, 前提是报表最好不要有图片,否则打开会无响应或反应很慢 测试fr3文件2M左右反应很慢 procedure TFrm_BarCode.FallBitBtn6Click(Sender: TObject); begin //默认设计 MyTmsPrintDropBtn1.FrxReport.DesignPreviewPage end; procedure TFrm_BarCode.FallBitBtn3Click(Sender: TObject); begin //自写设计 MyTmsPrintDropBtn1.PrintRpt_DesignerW(FrptPrintIDX,Frpttitle,FrptFile); end; procedure TFrm_BarCode.FallBitBtn5Click(Sender: TObject); begin //预览 MyTmsPrintDropBtn1.PrintRpt_PreviewNoDialog(FrptPrintIDX,Frpttitle,FrptFile); end; procedure TFrm_BarCode.FallBitBtn4Click(Sender: TObject); begin //无对话框打印 MyTmsPrintDropBtn1.PrintRpt_PrintNow(FrptPrintIDX,Frpttitle,FrptFile); end; procedure TFrm_BarCode.MyTmsPrintDropBtn1BeforeDropMenuClick( Sender: TMenuItem; ItemsTag: Integer; var CanClick: Boolean; var Memo: String); begin MyTmsPrintDropBtn1.RptFileName:=''; end; procedure TFrm_BarCode.AdvStringGrid1GetEditorType(Sender: TObject; ACol, ARow: Integer; var AEditor: TEditorType); begin if (ACol=0 ) and (ARow=0) then begin AEditor:=edComboList; end; end; procedure TFrm_BarCode.MyTmsPrintDropBtn2BeforeDropMenuClick( Sender: TMenuItem; ItemsTag: Integer; var CanClick: Boolean; var Memo: String); begin with MyTmsPrintDropBtn1 do begin RptPrintIDX:=0; RptPrtTitle:='xxxxxx'; RptFileName:=gsPath+'data\test.fr3' end; end; procedure TFrm_BarCode.FallBitBtn1Click(Sender: TObject); begin MyTmsPrintDropBtn1.FrxReport.PreviewPages.Export(frxXLSExport1) ; end; procedure TFrm_BarCode.FallBitBtn8Click(Sender: TObject); begin //初始化数据 with MyTmsPrintDropBtn1 do begin RptPrintIDX:=StrToInt(Trim(lbe_idx.Text)); //打印机 RptPrtTitle:=Trim(lbe_title.Text); //打印时显示的文件名 RptFileName:=Trim(lbe_file.Text) //打印模板 end; end; end.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值