Stimulsoft Reports Flex教程:自定义报表查看器

发布时间 : 2019-10-29 15:45:25.663|阅读 160 次

概述:本示例说明如何更改报表查看器的外观。

相关链接:

立即点击下载Stimulsoft Reports.Flex最新版

本示例说明如何更改报表查看器的外观。为了从代码创建和显示查看器,您将需要调用StiViewerFx.initialize()静态方法。在应用程序的initialize事件中调用此方法:

<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"    minWidth="1024" minHeight="768" backgroundColor="#e8e8e8"    initialize="onInitialize()" xmlns:viewer="stimulsoft.viewer.*">...private function onInitialize(): void{    StiViewerFx.initialize();    ...}

要自定义报表查看器,您可以从StiOptions类中更改静态选项。例如,以下代码根据复选框的值启用或禁用查看器某些元素的可见性:

private function onShowCustomizedViewerClick(): void
{
    // Create new report object
    var report: StiReport = new StiReport();
    // Load document from XML string
    report.loadDocumentFromString(documentString);
 
    // Customize Viewer toolbar
    StiOptions.viewer.toolbar.showPrintButton = checkBoxShowPrintButton.selected;
    StiOptions.viewer.toolbar.showOpenButton = checkBoxShowOpenButton.selected;
    StiOptions.viewer.toolbar.showSaveButton = checkBoxShowSaveButton.selected;
    StiOptions.viewer.toolbar.showBookmarksButton = checkBoxShowBookmarksButton.selected;
    StiOptions.viewer.toolbar.showParametersButton = checkBoxShowParametersButton.selected;
    StiOptions.viewer.toolbar.showThumbnailsButton = checkBoxShowThumbnailsButton.selected;
    StiOptions.viewer.toolbar.showFindButton = checkBoxShowFindButton.selected;
    StiOptions.viewer.toolbar.showExitButton = checkBoxShowExitButton.selected;
    StiOptions.viewer.toolbar.showAboutButton = checkBoxShowAboutButton.selected;
    StiOptions.viewer.toolbar.showFirstPageButton = checkBoxShowFirstPageButton.selected;
    StiOptions.viewer.toolbar.showPreviousPageButton = checkBoxShowPreviousPageButton.selected;
    StiOptions.viewer.toolbar.showGoToPageButton = checkBoxShowGoToPageButton.selected;
    StiOptions.viewer.toolbar.showNextPageButton = checkBoxShowNextPageButton.selected;
    StiOptions.viewer.toolbar.showLastPageButton = checkBoxShowLastPageButton.selected;
    StiOptions.viewer.toolbar.showPageViewModeSingleButton = checkBoxShowPageViewModeSingleButton.selected;
    StiOptions.viewer.toolbar.showPageViewModeContinuousButton = checkBoxShowPageViewModeContinuousButton.selected;
    StiOptions.viewer.toolbar.showPageViewModeMultipleButton = checkBoxShowPageViewModeMultipleButton.selected;
    StiOptions.viewer.toolbar.showZoom = checkBoxShowZoom.selected;
    // Create bounds of Viewer window
    var rect: Rectangle = new Rectangle(100, 100, 900, 600);
    // Show report in Viewer dialog window
    report.showDialog(rect, "Customized ViewerFx", true, true);
}

在下面的屏幕截图中,您可以看到示例代码的结果。

Stimulsoft Reports Flex教程:自定义报表查看器

下载示例





在线
客服
微信
QQ 电话
023-68661681
返回
顶部