Telerik Forums
Reporting Forum
0 answers
348 views
Hi,

I'm using Telerik Reporting Q1 2013 and I have a report which contains a subreport which I have been able to export to HTML, PDF, CSV, etc., etc., programmatically, but it throws an exception when attempting to export to Excel (XLS/XLSX).  I can export a different report that I have (which contains no subreport) to all formats (including Excel) without any exceptions.  As far as I can tell, the only real difference between the two is the subreport.

I get a Null Reference Exception when calling the RenderReport method of the ReportProcessor class.  Here's the stack trace:

{"Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.","ExceptionType":"System.NullReferenceException","StackTrace":" at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.RenderingItemContainer.RenderInternal(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.Table.RenderInternal(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.RenderingItemContainer.RenderInternal(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.Section.RenderInternal(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.Group.RenderInternal(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.RenderingItemContainer.RenderInternal(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.Report.RenderInternal(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.RenderingItem.Render(IWorksheet worksheet, TableLayoutInfo layoutInfo)\r\n at Telerik.Reporting.ExcelRendering.Report.Render(IWorkbook workbook)\r\n at Telerik.Reporting.ExcelRendering.Excel97.ExcelReport.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)\r\n at Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)\r\n at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)\r\n at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)\r\n at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo)\r\n at CPSReporting.TelerikCPSReportProcessor.RenderExcelReport(CPSReportDefinition reportDefinition) in c:\\Code\\CPS_SVN_REPO\\CPSReporting\\trunk\\TelerikCPSReportProcessor.cs:line 78\r\n at CreditPoint.Web.Controllers.WebAPI.ReportController.PrepResponse(HttpRequest request) in c:\\Code\\CPS_SVN_REPO\\Web\\branches\\RB-4.6\\Controllers\\WebAPI\\ReportController.cs:line 69\r\n at CreditPoint.Web.Controllers.WebAPI.ReportController.Post() in c:\\Code\\CPS_SVN_REPO\\Web\\branches\\RB-4.6\\Controllers\\WebAPI\\ReportController.cs:line 27\r\n at lambda_method(Closure , Object , Object[] )\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass13.b__c(Object instance, Object[] methodParameters)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<>c__DisplayClass5.b__4()\r\n at System.Threading.Tasks.TaskHelpers.RunSynchronously[TResult](Func`1 func, CancellationToken cancellationToken)"}

I believe the stack trace is the same for both XLS and XLSX device formats.  As I said, this is only happening with one of my reports (which happens to contain a subreport).  All other reports work just fine when exporting to Excel.

Here's the code:

InstanceReportSource instanceReportSource = new InstanceReportSource();
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.IgnoreWhitespace = true;
ReportXmlSerializer serializer = new ReportXmlSerializer();
XmlReader primaryReportXmlReader = XmlReader.Create(reportDefinition.PrimaryReport.TemplateLocation, xmlReaderSettings);
Telerik.Reporting.Report primaryReport = (Telerik.Reporting.Report)serializer.Deserialize(primaryReportXmlReader);
primaryReportXmlReader.Close();
this.SetConnectionStrings(ref primaryReport, reportDefinition.ConnectionString);
instanceReportSource.ReportDocument = primaryReport;
if (reportDefinition.PrimaryReport.ReportParameters != null)
{
    foreach (KeyValuePair<string, object> item in reportDefinition.PrimaryReport.ReportParameters)
        instanceReportSource.Parameters.Add(this.CreateParameter(item.Key, item.Value));
}
foreach (CPSReport cpsSubReport in reportDefinition.SubReports)
{
    XmlReader xmlReader = XmlReader.Create(cpsSubReport.TemplateLocation, xmlReaderSettings);
    Telerik.Reporting.Report subReportInstance = (Telerik.Reporting.Report)serializer.Deserialize(xmlReader);
    xmlReader.Close();               
    this.SetConnectionStrings(ref subReportInstance, reportDefinition.ConnectionString);
    Telerik.Reporting.SubReport subReport = primaryReport.Items.Find(cpsSubReport.ReportName, true).FirstOrDefault() as Telerik.Reporting.SubReport;
    ReportSource subReportSource_Type = subReport.ReportSource;
    InstanceReportSource subReportSource_Instance = new InstanceReportSource();
    subReportSource_Instance.ReportDocument = subReportInstance;
    foreach(Telerik.Reporting.Parameter param in subReportSource_Type.Parameters)
        subReportSource_Instance.Parameters.Add(param);
    subReport.ReportSource = subReportSource_Instance;
}
Hashtable settings = new Hashtable() {
    { "UseNativePageHeader", false },
    { "UseNativePageFooter", true },
    { "ShowGridLines", false }
};
//Exception thrown here:
RenderingResult result = _reportProcessor.RenderReport("XLS", instanceReportSource, settings);
return result.DocumentBytes;

Thank you in advance,
An otherwise extremely happy Telerik user  :)
Adam
Top achievements
Rank 1
 asked on 30 May 2013
3 answers
59 views
Hi ,
    I have web application where i am using 2 reports in the same page , when I access the web application from IPAD safari (IOS6) when a telerik report page opens ,  randomly either the first or the second report will be blank and if I click on next button report loads the next page and then I have to click the previous to see the first page which was blank. im using Telerik Q1 20113 build 7.0.13.412(7.0.13.412) and this is an urgent issue to fix.
Stef
Telerik team
 answered on 30 May 2013
7 answers
406 views
Hi there!

We’ve identified that the reporting component returns verbose error messages with a 200 HTTP status code, making our application vulnerable to XSS attacks. 

Please could you contact us privately, as soon as possible for more details.

Thanks, in advance.
Bill
Top achievements
Rank 1
 answered on 30 May 2013
0 answers
73 views
Hello,

1. I need the image filter (ie, it must allow only image files) when i click Select Button in RAD UPLOAD control and not in validation.

2. I change "a.doc" files extension as "a.jpeg" and trying to upload the "a.jpeg" file. How to stop uploading the a.jpeg file as because it's not an image file.
How to do validation using java script?

Regards
Jayanthi
jayanthi
Top achievements
Rank 1
 asked on 30 May 2013
4 answers
195 views
Hello,

I see that the converter is still stuck on (now very old) ActiveReports 3 series. I have a myriad of reports I would love to bring into the Telerik fold, but don't have the resources to rewrite from scratch.

Is there any hope of seeing a 6 or 7 converter in the future? I can see from 2009 posts that it was "in the works".

Best,

John
junk
Top achievements
Rank 1
 answered on 29 May 2013
1 answer
140 views
I have successfully implemented the PrintReport method found here: http://www.telerik.com/help/reporting/m_telerik_reporting_processing_reportprocessor_printreport.html

But, I find that that when I use identity impersonation to allow this code to work (configured via web.config), the impersonated account needs admin rights on the web server.  Our network admin would prefer to give specific rights to this account, vs. just adding to the administrators group.  Can you tell us what those would be?  He thought maybe a temp file was being created somewhere on the server to support the printing.

Thanks in advance!

Stef
Telerik team
 answered on 29 May 2013
2 answers
97 views
Telerik Team,

I am having an issue with a crosstab report. I have created a small demo project that easily shows the issue, much faster than typing out several paragraphs and code snippets to try and describe it.

I have zipped the file but cannot upload with your file attachment tool below. (only image files allowed)
Is there anyway I can send the zipped file to you and associate with this thread?

Thanks.
Stef
Telerik team
 answered on 29 May 2013
1 answer
217 views
Hello all,

I have a report that contains a chart.  In the chart plot area, I set the background image using relative path (~/Image/myimage.png). Everything works as expected using ReportViewer on asp.net page.  The problem I have is when I export the report to pdf format programmatically, the chart background is not set.

Here is how I export it.

           
   public Stream GetReportBytes(Guid studyId, string userName)
        {
            ReportProcessor reportProcessor = new ReportProcessor();
            Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
 
            ProjectReport reportToExport = new ProjectReport();           
            reportToExport.ReportParameters[0].Value = studyId.ToString();
            reportToExport.ReportParameters[1].Value = userName;
            instanceReportSource.ReportDocument = reportToExport;
            RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
 
            return new MemoryStream(result.DocumentBytes);           
        }

And background image is set like this

MainChart.PlotArea.Appearance.FillStyle.FillSettings.BackgroundImage = "~/Images/ci_bg.png";


Please advice.

Cheers!
Stef
Telerik team
 answered on 28 May 2013
5 answers
613 views
Before calling my report, I generate a generic list of business objects. The processing is quite complex and I do not want to try to use Telerik's parameter facility to do this. 

How can I pass this List<BusinessObject> to Telerik Reporting at runtime? What do I use as a datasource in order to design the report?

I am using VS2010 and Report Q1 2011.

(Sorry I mis-posted this issue in the Winforms area - could not move it)
Stef
Telerik team
 answered on 28 May 2013
3 answers
239 views
I have a report that has a single parent (Patient) and multiple children (test results, recommendations, background information) with forced page breaks before each section. This is NOT a hierarchy it is distinct sets of information for the patient. 

In other products that I am familiar with you would create multiple detail sections but i understand from reading that this is not supported. I've tried to simulate this feature with groups but there only seems to be one hierarchy of groups. 

I've tried dropping each logical detail section in panels but:
a. there does not seem to be a way to create a page break for a panel
b. keeptogether does not always work as I would expect when the height of the section changes (i.e. if the kept-together section is longer than a page the first lines of it will be pushed to the prior page rather than creating a page break)

I am using report designer and pushing the XML report definitions to a server and then running them from there so assembling a set of subreports is not practical.

Any suggestions would be greatly appreciated.
Don Rule
Translational Software
Stef
Telerik team
 answered on 27 May 2013
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?