By using this site you agree to the use of cookies for analytics and personalized content.
I agree Learn More
Stimulsoft Reports.WinRT FAQ
 
1. Wie kann man den Bericht anzeigen?
2. Wie kann man den Bericht aus dem Code speichern?
1. Wie kann man den Bericht anzeigen?

Fügen Sie folgenden Code hinzu, um den gerenderten Bericht anzuzeigen (*.mdc, *.mdz, *.mdx):

XAML

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:viewerRT="using:Stimulsoft.Report.Viewer.RT">

   


C#

namespace Demo.RT
{
    public sealed partial class BlankPage : Page
    {
        #region Handlers
        async private void BlankPage_Loaded(object sender, RoutedEventArgs e)
        {
            StorageFolder folder = Windows.Storage.KnownFolders.DocumentsLibrary;
            StorageFile storageFile = await folder.GetFileAsync("SimpleList.mdc");

            StiReport report = new StiReport();
            await report.LoadDocumentAsync(storageFile);
            viewerControl.Report = report;
        }
        #endregion

        public BlankPage()
        {
            this.InitializeComponent();
            this.Loaded += BlankPage_Loaded;
        }
    }
}

Wenn der Bericht nur nicht gerendert ist, d.h. die Berichtsvorlage ist gespeichert (*.mrt, *.mrz, *.mrx), geben Sie folgenden Code ein:

XAML

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:viewerRT="using:Stimulsoft.Report.Viewer.RT">

   


C#

namespace Demo.RT
{
    public sealed partial class BlankPage : Page
    {
        #region Handlers
        async private void BlankPage_Loaded(object sender, RoutedEventArgs e)
        {
            StorageFolder folder = Windows.Storage.KnownFolders.DocumentsLibrary;
            StorageFile storageFile = await folder.GetFileAsync("SimpleList.mrt");

            StiReport report = new StiReport();
            await report.LoadAsync(storageFile);
            await report.RenderAsync();

            viewerControl.Report = report;
        }
        #endregion

        public BlankPage()
        {
            this.InitializeComponent();
            this.Loaded += BlankPage_Loaded;
        }
    }
}
2. Wie kann man den Bericht aus dem Code speichern?

Der Bericht kann aus dem Code gespeichert werden. Hier ist ein Beispiel des Codes für Speichern vom Bericht:

XAML

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:viewerRT="using:Stimulsoft.Report.Viewer.RT">

   


C#

namespace Demo.RT
{
    public sealed partial class BlankPage : Page
    {
        #region Handlers
        async private void buttonSaveReport_Click(object sender, RoutedEventArgs e)
        {
            StiReport report = new StiReport();
            StorageFolder folder = Windows.Storage.KnownFolders.DocumentsLibrary;
            StorageFile storageFile = await folder.CreateFileAsync("Report1.mdc");

            await report.SaveDocumentAsync(storageFile);
        }
        #endregion

        public BlankPage()
        {
            this.InitializeComponent();
            this.Loaded += BlankPage_Loaded;
        }
    }
}
TwitterTwitterFacebookFacebookRSSRSSLinked inLinked inYoutubeYoutubeStimulsoft BlogStimulsoft BlogViberViberWhatsAppWhatsAppSkypeSkypeTelegramTelegram