Telerik Forums
Reporting Forum
1 answer
162 views
Hello,

I am currently evaluating the use of Reporting in a project and I got a test page up and running in ASP.NET 4.5.

However, I noticed that my report (which uses a SQL Server Data Source) is executing the query using the application pool identity. Is there any way to run the query using the current user's identity?


Thanks in advance
Stef
Telerik team
 answered on 10 Mar 2014
1 answer
159 views
So we have used the standalone designer to create a report, we are using an ObjectDataSource (and access method of that object to return data). This works completely fine, and we are able to preview our test data while designing the report.

In our web application we deserialize the report file (*.trdx) in order to change the report DataSource and use real data like this:

      XmlReaderSettings settings = new XmlReaderSettings() { IgnoreWhitespace = true };
      Telerik.Reporting.Report rpt;
      String file = Server.MapPath("~/Reports/OurReport.trdx");
      using (XmlReader xmlReader = XmlReader.Create(file, settings)) {
        ReportXmlSerializer xmlSerializer = new ReportXmlSerializer();
        rpt = (Telerik.Reporting.Report)xmlSerializer.Deserialize(xmlReader);
      }
      InstanceReportSource ReportSource = new InstanceReportSource();
      ReportSource.ReportDocument = rpt;
      ReportSource.ReportDocument.Reports.FirstOrDefault().DataSource = GetData();

What I am unclear about, is whether or not the report goes through the process of loading up all our test data first, before we acquire the real data (i.e. GetData()) and assign it to the DataSource. If we comment out the DataSource assignment we'll see the test data displayed in the report viewer, which makes me wonder. I definitely don't want the report to go through the trouble of generating data that is just going to be overwritten. Can someone clue me in on the order of operations in regards to this, so we can avoid any unnecessary overhead.


Stef
Telerik team
 answered on 07 Mar 2014
1 answer
208 views
Hi,

I have just noticed an exception when trying to export a report to RTF from the WebViewer control which now throws the following error:

Attempt by security transparent method
'Telerik.Reporting.Rtf.ImageUtils.GetMetafileBounds(System.Drawing.SizeF)' to
call native code through method
'Telerik.Reporting.Rtf.GdiNativeMethods.GetDeviceCaps(IntPtr, Int32)' failed.
 Methods must be security critical or security safe-critical to call
native code.

The exception occurs on my local Dev Environment (Windows 8 with IIS 8) and our Staging server (Windows Server 2012 R2 with IIS 8.5) and is using .Net 4.5

Any ideas why this is occurring?

Stef
Telerik team
 answered on 07 Mar 2014
0 answers
462 views
Hi David,

The CDbl function converts the expression to double and this is limitation of the data type. For more info see: double (C# Reference). Still you can utilize user functions to convert the values and make the required calculation.

Best Regards,
Petar
Peter
Telerik team
 asked on 07 Mar 2014
3 answers
113 views
What Im trying to achieve is to load a dynamic externalstylesheet, where in the style rules can be configurable.

Unfortunately, I can not make this to work. Im getting the following error:

An error has occurred while processing Report 'MyReport':
For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing

I also tried to use stream buy the errors says the buffer can not be null even though Im passing the right byte array.

Here are the codes:

public MyReport(Uri stylesheet): this()
{
   this.ExternalStyleSheets.Clear();
   this.ExternalStyleSheets.Add(new ExternalStyleSheet(stylesheet));
}

ReportController

public ActionResult MyReport()
{
   var xml = new Uri("http://mydomain.com" + Url.Action("ReportStyleSheet", "Theme"));
   var report = new MyReport(xml);
   return ReportViewer(report);
}
 
private ViewResult ReportViewer(Report report)
{          
   return View("ReportViewer", report);
}

ThemeController
public ActionResult ReportStyleSheet()
{
   var xml = string.Empty;
 
   if (this.Request.IsAuthenticated)
   {
    //replaceDictionary replaces the color schemes
    xml = template.BuildTemplate("ReportStyleSheet.xml", replaceDictionary);
   }
 
   return Content(xml, "application/xml");
         
}


ReportViewer.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Telerik.Reporting.Report>" %>
 
<%@ Register assembly="Telerik.Reporting, Version=7.0.13.521, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" namespace="Telerik.Reporting" tagprefix="telerik" %>
 
<%@ Register assembly="Telerik.ReportViewer.WebForms, Version=7.0.13.521, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" namespace="Telerik.ReportViewer.WebForms" tagprefix="telerik" %>
 
<telerik:ReportViewer ID="ReportViewer1" style="height: 700px; width: 100%; margin-bottom: 30px;" runat="server"></telerik:ReportViewer>


<script runat="server">
     
public override void VerifyRenderingInServerForm(Control control)
{
   // to avoid the server form (<form runat="server"> requirement
}
 
protected override void OnLoad(EventArgs e)
{
   base.OnLoad(e);
   try
   {
      var instanceReportSource = new InstanceReportSource();
                 
      instanceReportSource.ReportDocument = Model;
      ReportViewer1.ReportSource = instanceReportSource;
   }
   catch (Exception ex)
   {
      Response.Write(ex.Message);
   }
}    
        
</script>
Stef
Telerik team
 answered on 06 Mar 2014
6 answers
673 views
If I create a blank report, add a picturebox control, set the value to point to a JPG file (logo in this case) and then try to preview either in VS or with a test page using the viewer control, I get this error (numerous times):

Code generation for property 'Value' failed. A generic error occuered in GDI+.

Anybody have any ideas? The error was discovered on a more complex report but in testing it I discovered I could reproduce it with a blank/empty report. Any help or sugestions would be appreciated.

Thanks
richard
Top achievements
Rank 1
 answered on 06 Mar 2014
1 answer
558 views
Current Telerik Version: Q1 2014 (Just updated)
Type of project: WinForms

Hello,

I am currently having a problem with my report viewer showing an inaccurate count of page numbers for my Telerik Report.  After looking into the issue more, I found that the viewer shows additional rows when viewing, then what is printed out on paper.  It looks to be around the height for a normal Portrait view when viewing it, andit still stretches its width to fit a landscape view (so its around 11" x 11" when viewing, but 11"w x 8.5"h when printing).

I have set the report PageSettings as follows:

this.PageSettings.Landscape = true;
this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter;

I assumed that having it set to Landscape true would get the desired results for the report.  I also have been unable to find a setting in the report viewer that forces the document viewer to view the report in a specific size.

Is there something I am doing wrong?  Is there a setting that I need to set in order for the viewer to recognize that it is a landscape layout and not a portrait layout?

Thank you for your assistance.
Nasko
Telerik team
 answered on 06 Mar 2014
3 answers
877 views
Hello,
I'm having trouble finding out how to accomplish this...I'm on Reporting Q1 2010.

I'm creating an invoice report.  It has a header, footer, and a detail section in the middle with the line items on the invoice.  It's a half page report (8.5 x 5.5) that needs to print twice on one full page, and will be torn on a perforation in the middle, giving the user 2 copies.  If there's not too many line items, there's no problem.  However, when the line items exceed what fits on the first page, I need them to overflow to a 2nd page.  I've attached an image to represent what I'm trying to do.

I've tried the Report Book, but each report starts on a new page, so that won't work.

I've also tried doing it with Subreports.  However, the detail section just keeps going when there's too many items, which eventually just "pushes" the 2nd copy over onto a new page.

What is the best way to accomplish this?

Thanks,
Jay
Stef
Telerik team
 answered on 06 Mar 2014
6 answers
635 views
As odd as it may sound, this is what i am facing.
I am printing the barcode report to Agrox CP-2140 PPLB label printer.
The paper size is set to 104 mm (W) and 60mm (H).
When print, the label appears in landscape orientation (which is not what i want because it occupies 2 stickers)

When the paper size is set to 104mm (W) and 104mm(H), the label is printed in portrait orientation. However, this is also not desirable because the printer is advancing more empty labels.

I am using Q3 2013 SP1, version 7.2.14.127.

Here is my print code:
m_ReelLabel.UnitOfMeasure = UnitType.Mm;
m_ReelLabel.Width = new Unit(98.0, UnitType.Mm);
DetailSection detail = new DetailSection();
detail.Height = new Unit(50.0, UnitType.Mm);

m_ReelLabel.PageSettings.PaperKind = PaperKind.Custom;
m_ReelLabel.PageSettings.PaperSize = new SizeU(new Unit(104, UnitType.Mm), new Unit(60, UnitType.Mm));
m_ReelLabel.PageSettings.Margins.Left = new Unit(2.0, UnitType.Mm);
m_ReelLabel.PageSettings.Margins.Right = new Unit(2.0, UnitType.Mm);
m_ReelLabel.PageSettings.Margins.Top = new Unit(2.0, UnitType.Mm);
m_ReelLabel.PageSettings.Margins.Bottom = new Unit(2.0, UnitType.Mm);
 
InstanceReportSource src = new InstanceReportSource();
src.ReportDocument = m_ReelLabel;
 
PrinterSettings printerSettings = new PrinterSettings();
PrintController standardPrintController = new StandardPrintController();
Telerik.Reporting.Processing.ReportProcessor processor = new Telerik.Reporting.Processing.ReportProcessor();
processor.PrintController = standardPrintController;
processor.PrintReport(src, printerSettings);

Nasko
Telerik team
 answered on 06 Mar 2014
1 answer
128 views
Hi there -

I am using VB 2010 with 2013 Q3 reporting to generate a quick app that creates a report from a dataset created at runtime.
I followed the "best practices" in creating the solution; my UI app that contains the report viewer and a second project that contain the reports.

I create a dataset, datatable and manually add rows.  I followed previous examples to assign the created dataset to the report, however when I view the report, no rows are displayed.

The datatable contains two columns named BinTextValue and BinBarcodeValue.  On the report, the text fields value property is =Fields.[BinTextValue] and =Fields.[BinBarcodeValue].

Below is the code I am using to generate the dataset and set the datasource to the report.  Please let me know what I am missing.

Thanks
Bob

    Private Sub printBinLabels()
        Dim rpt As New BarcodeReport
        Dim rDS As New Telerik.Reporting.ObjectDataSource
        rDS.DataSource = getBinLabels()
        rDS.DataMember = "BinLabels"

        ' Print the labels
        Dim report As New Report
        report.DataSource = rDS


        Dim reportSource As New InstanceReportSource
        reportSource.ReportDocument = report
        rpt.ReportViewer1.ReportSource = reportSource
        rpt.ReportViewer1.RefreshReport()

        rpt.ShowDialog()
    End Sub

    Private Function getBinLabels() As DataSet
        Dim ds As New DataSet
        ds.DataSetName = "BarCodeLabels"

        Dim dt As New DataTable("BinLabels")
        dt.Columns.Add("BinTextValue", GetType(String))
        dt.Columns.Add("BinBarcodeValue", GetType(String))

        For Each line In BinNumbersTextBox.Text.Split(CChar(vbCrLf))
            If line.Trim.Length > 0 Then
                dt.Rows.Add(line.ToString, line.Replace("-", ""))
            End If
        Next

        ds.Tables.Add(dt)

        Return ds
    End Function

Bob
Top achievements
Rank 2
 answered on 06 Mar 2014
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?