Telerik Forums
Reporting Forum
1 answer
1.0K+ views

   I'm having a problem using the Telerik Reporting WPF ReportViewer control.  I'm using Visual Studio 2017 v15.9.38 along with Telerik UI for WPF and Telerik Reporting v 15.2.21.915 (latest version).  My application is targeting .NET 4.5.2.

   In my application, I need to allow users to generate printed documents from system objects.  For example, a Purchase Order.  The user creates the Purchase Order, then needs to print it.  I'm trying to use Telerik Reporting to do this, much like other applications use embedded Crystal Reports.

   My application stores the reports as a byte array/varbinary in an MSSQL database.  To test, I copied the sample Invoice report, and removed all data sources and everything except a simple line of text and image to make sure it renders.  Later on I plan on adding data sources and binding those to internal system objects.  My application handles the uploading of the report document and pulls it from the database and generates a Telerik.Reporting.InstanceReportSource before showing it.

        Dim rsTelerik As New Telerik.Reporting.InstanceReportSource
        Dim rPack As New Telerik.Reporting.ReportPackager

            rsTelerik.ReportDocument = rPack.UnpackageDocument(New MemoryStream(MyByteArray))

   This all seems to work fine.  To display the report I have a custom control that hosts the Telerik ReportViewer and passes the ReportSource via DataBinding with a DependencyProperty.  I've made it extremely simple just to test things.

<base:TBaseUserControl

             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:tr="http://schemas.telerik.com/wpf" 
             xmlns:localcontrols="clr-namespace:Redstone.Controls"
             xmlns:base="clr-namespace:Redstone.Controls"
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="400"
        >

    <tr:ReportViewer x:Name="rptViewer" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type base:CtrlTelerikReportBinding}}}">
        <tr:ReportViewer.ReportSource>
            <Reporting:InstanceReportSource x:Name="rsInstance"/>
        </tr:ReportViewer.ReportSource>
    </tr:ReportViewer>
</base:TBaseUserControl>

   However the Visual Studio designer shows the ReportViewer control as a completely blank and transparent object.  See attached screenshot.  I've verified that I have references to both Telerik.Reporting and Telerik.ReportViewer.Wpf, and I verified that the References are set to copy local.  I dragged and dropped the report control to let it create the references.  I also verified that my Application.xaml has the Resource Dictionaries:

        <ResourceDictionary x:Key="keuUI">
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemeResources />
                <ui:XamlControlsResources />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/System.Windows.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.Input.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.Windows.Controls.Navigation.xaml" />
                <ResourceDictionary Source="/Telerik.ReportViewer.Wpf.Themes;component/Themes/Fluent/Telerik.ReportViewer.Wpf.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>

   Both the VS designer and my application show the control as completely blank and transparent.  See attached screenshot from the application.  I tried uninstalling and re-installing the Telerik Reporting module, but still have the same issue.  I get information in the Output window about the control loading and some warnings about a Telerik XML package, but no errors.  I'm guessing that this is some kind of error with the References or DLLs since the designer won't show the control either.  Any suggestions?

Dimitar
Telerik team
 answered on 05 Nov 2021
2 answers
247 views

I want to remove these space when column ends next column should start and cut text for other page please tell me solution

Todor
Telerik team
 answered on 05 Nov 2021
0 answers
121 views
Hello, I am new to telerik, could you help me, I have several reports with a .cs extension, how can I view them in a ReportViewer
n/a
Top achievements
Rank 1
 asked on 03 Nov 2021
2 answers
300 views
HI All,

I have created a telerik report, In that report i have a table. If the table cell Contains more data then it is rendering to the next page and also it is rendering table header in one page and data in another page. I have tried KeepTogether=false property also but still the problem exist. Please refer the attached screen shot. Please help me.

Thanks,
Satya
Arslan
Top achievements
Rank 1
Iron
 updated answer on 03 Nov 2021
1 answer
438 views

Hi guys,

 

In my report I have a table like thing (it needs to be like this because of complicated data and a normal table isn't capable of everything I need).
Based on the type of data (there are doors, walls etc.) I have different "columns" visible.
So I made a few panels right docking, a few left docking and the middle "Teile-Art" is fill.
The problem is now, that even though this "Teile-Art" has enough space because other columns are not visible, it uses space like there is not enough.
If I set the Textbox in it to Multiline=False it not grows, but I actually want it multiline if there would be not enough space.

I attached my report, you cant preview it, cause you want have the database, but you should see how the elemts are set with Docking.
I played around with Docking and Anchor but don't get it to work as I want.

 

Maybe you have an idea.

Greetings, Benedikt

Todor
Telerik team
 answered on 02 Nov 2021
1 answer
274 views

Hi,

 I ma running a report that has 1 chart, but for some reason when I run it multiple duplicates of the same chart show up on the report.

Does anyone have suggestions on what setting to tweak?

Thanks

Todor
Telerik team
 answered on 02 Nov 2021
0 answers
1.4K+ views

Hi Technical team,

I added a parameter in a report parent by following this link: https://docs.telerik.com/reporting/designing-reports-parameters-adding-parameters

I let all the values by defaults.

Then, I tried to pass the parameter to a SubReport under the parent report by following this link: https://docs.telerik.com/reporting/report-items-sub-report

All I did is in Report Designer.

However, after that the parent report is initiated, I found the value of parameters always null or empty.

Could you tell me where I did wrong?

Many thanks,

minh
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 28 Oct 2021
4 answers
819 views
Hi,
I'm having trouble extending Report Designer with User Function.

I've created an assembly with 3 functions the following code:

using System;
using Telerik.Reporting.Expressions;


namespace ReportLib
{
    public static class SVFunctions
    {
        [Function(Category = "My Functions", Namespace = "ReportLib", Description = "Duration")]


        public static string Duration(DateTime Start, DateTime End)
        {
            TimeSpan ts = End- Start;
            double Ore = ts.TotalHours;
            double Minuti = ts.TotalMinutes - (Ore*60);
            double Secondi = ts.TotalSeconds - (Ore*60) - (Minuti*60);
            return string.Format("{0:0}:{1:0}:{2:0}", Ore, Minuti, Secondi);


        }

        [Function(Category = "My Functions", Namespace = "ReportLib", Description = "ToLocalTime")]
        public static DateTime ToLocalTime(DateTime utc)
        {
            return utc.ToLocalTime();
        }


        [Function(Category = "My Functions", Namespace = "ReportLib", Description = "Adesso")]
        public static string Adesso()
        {
            return "12/12/2014";
        }
   }

I've added the reference of the assembly inside the ReportDesigner config file.

<Telerik.Reporting>
     <AssemblyReferences>
         <add name="ReportLib" version="1.0.0.0" />
     </AssemblyReferences>
</Telerik.Reporting>



I've created a report and with a text field using an expression that references to the function Adesso() as you can see in to the attached picture.

When I run the report I've the following error (shown into the picture)
An error was occurred while processing TexBox 'xxx'. The Expression contains object 'ReportLib' that is not defined in the current context.

What's I'm doing wrong

Michele



























Brandon
Top achievements
Rank 1
Iron
 answered on 26 Oct 2021
1 answer
1.2K+ views

Hi,

is there a working example of Telerik Reporting used in Blazor WebAssembly? I've only found server-side Blazor examples.

Thanks.

Dimitar
Telerik team
 answered on 26 Oct 2021
7 answers
1.2K+ views

Hello,

We have a web site hosted in Azure, and we are trying to add Telerik report generation to it. It works just fine when running in Visual Studio, but when we publish it to Azure and run it from there, we get the below error.  I realize this is a very generic question--I don't have a little test project that I can provide--but does this symptom sound familiar to anybody?  A known issue with deploying Telerik.Reporting to Azure, perhaps?

Using Telerik Q1 2014.

Method in Question:

            try
            {
                var monthlyInvoice = new Reports.MonthlyInvoice(model);
                var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
                var generatedReport = reportProcessor.RenderReport("PDF", monthlyInvoice, null); //*** where it crashes
                return generatedReport.DocumentBytes;
            }
            catch (Exception exp)
            {
                Tracker.TrackError(exp, ErrorTrackerTags.Report, ErrorTrackerTags.Invoice);
                return null;
            }

The Error:

Message: [ArgumentException: Parameter is not valid.]
 System.Drawing.Graphics.GetHdc():29
 Telerik.Reporting.Pdf.PdfContext..ctor():36
 Telerik.Reporting.Pdf.PdfDocument..ctor():38
 Telerik.Reporting.ImageRendering.DocumentPdf.FindOrCreateDocument():48
 Telerik.Reporting.ImageRendering.DocumentPdf..ctor(PdfRenderingContext context, IMeasureContext measureContext):15
 Telerik.Reporting.ImageRendering.PdfReport.CreateDocument(IDictionary renderingInfo, IDictionary deviceInfo, CreateStream createStreamCallback, PageSettings pageSettings):11
 Telerik.Reporting.BaseRendering.DocumentRenderingExtensionBase.CreateWriter(IDictionary renderingContext, IDictionary deviceInfo, CreateStream createStreamCallback, PageSettings pageSettings):0
 Telerik.Reporting.ImageRendering.PdfReport.CreateWriter(IDictionary renderingContext, IDictionary deviceInfo, CreateStream createStreamCallback, PageSettings pageSettings):0
 Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback):120
 Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback):388
 Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback):27
 Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback):0
 Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo):36
 Billing.Reporting.Generator.GenerateMonthlyInvoice(MonthlyInvoiceModel model):7

 

 

Todor
Telerik team
 updated answer on 26 Oct 2021
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?