发布时间 : 2025-03-17 14:11:20.750|阅读 14 次
概述:在本文中,我们将探讨 Stimulsoft 与WinUI项目的集成。
相关链接:
Stimulsoft Ultimate (原Stimulsoft Reports.Ultimate)是用于创建报表和仪表板的通用工具集。该产品包括用于WinForms、ASP.NET、.NET Core、JavaScript、WPF、PHP、Java和其他环境的完整工具集。无需比较产品功能,Stimulsoft Ultimate包含了所有内容!
WinUI是适用于 Windows 桌面应用程序的用户界面 (UI) 框架,包括使用 C# 和 .NET 的托管应用程序,以及使用 C++ 和 Win32 API 的本机应用程序。WinUI 3 使用最新的 UI 模式提供一致、直观且易于访问的体验。Stimulsoft 没有专门针对WinUI 的解决方案;但是,要嵌入报告系统,您可以使用Stimulsoft.Reports.Web.NetCore组件,如果需要集成分析系统,则可以使用Stimulsoft.Dashboards.Web.NetCore组件。重要提示!
.NET Core 的报告工具允许您创建任何复杂程度的报告,从标准发票到具有参数、交互式排序和向下钻取功能的复杂文档。但是,WinUI框架的本机可视化组件、报告查看器和报告设计器不可用,并且 .NET Core 包中的组件可能会表现得不可预测。这是由于WinUI框架本身的某些特性造成的。因此,目前我们不建议将查看器或设计器嵌入到WinUI项目中。
<?xml version="1.0" encoding="utf-8"?> <Window x:Class="App1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App1" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="App1"> <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <Grid.RowDefinitions> <RowDefinition Height="100" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Button x:Name="button" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Click To Show Report" Click="Button_Click" /> <WebView2 x:Name="webView" Grid.Row="1" />> </Grid> </Window>
using System; using System.IO; using System.Reflection; using Microsoft.UI.Xaml; using Stimulsoft.Report; using Stimulsoft.Report.Export; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. namespace App1 { /// <summary> /// An empty window that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); } private async void Button_Click(object sender, RoutedEventArgs e) { button.Content = "Clicked"; // Load the report var report = new StiReport(); var reportStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("App1.Assets.Christmas.mrt"); report.Load(reportStream); // Export the report to PDF report.Render(); using var pdfStream = new MemoryStream(); report.ExportDocument(StiExportFormat.Pdf, pdfStream, new StiPdfExportSettings()); var pdfString = Convert.ToBase64String(pdfStream.ToArray()); await webView.EnsureCoreWebView2Async(); // Display the PDF in a WebView2 control webView.NavigateToString( @$"<html><head></head><body><div><object type=""application/pdf"" width=""100%"" height=""100%"" data=""data:application/pdf;base64,{pdfString}""></object></div></body></html>"); } } }
因此,在开发空白应用程序、打包(桌面版 WinUI 3)应用程序时,无需集成报告查看器或设计器即可使用报告和数据分析系统。有关使用 .NET Core Stimulsoft 的更多详细信息,请参阅文档。Stimulsoft.Reports.Web.NetCore的激活可通过Reports.WEB订阅获得,而Stimulsoft.Dashboards.Web.NetCore则需要Dashboards.WEB订阅。此外,可以在网上商店购买 用于跨多个平台报告和分析的综合解决方案Stimulsoft Ultimate 。
---------------------------------------------------------------------------
关于慧都科技:
慧都科技是专注软件工程、智能制造、石油工程三大行业的数字化解决方案服务商。在软件工程领域,我们提供开发控件、研发管理、代码开发、部署运维等软件开发全链路所需的产品,提供正版授权采购、技术选型、个性化维保等服务,帮助客户实现技术合规、降本增效与风险可控。慧都科技是Stimulsoft的在中国区的合作伙伴,Stimulsoft作为图表报表领域的优秀产品,帮助企业实现轻松构建高性能的表格报告及图表。
下载|体验更多Stimulsoft产品,请联系在线客服咨询,或拨打产品热线:023-68661681
加入图表报表技术交流QQ群(740060302),与更多小伙伴一起探讨提升开发技能。