Data Dynamics Reports Support

Started by tdavis34 at 07-13-2007 4:35 PM. Topic has 12 replies.

Print Search Rate
Sort Posts:    
   07-13-2007, 4:35 PM
tdavis34 is not online. Last active: 7/14/2007 12:11:08 AM tdavis34

Not Ranked
Joined on 07-14-2007
Posts 5
Rendering to Memory
Hello, I want to render a report to memory (in my case as PDF), such that I may open it up with a separate PDF library, modify it and stream it out from there, all without ever having to write something to disk. In looking at the DataDynamics.Reports.Rendering.IO, I only see a single provider (FileStreamProvider). Please tell me there is, or soon will be, some way to stream an export to something other than a file... this is a critical issue to us. Thanks for any info!
   Report 
   07-13-2007, 6:01 PM
James Johnson - DD is not online. Last active: 1/21/2012 12:07:51 AM James Johnson - DD

Top 50 Posts
Joined on 01-05-2006
Columbus, Ohio
Posts 502

DDStaff
Re: Rendering to Memory

Attachment: MemoryStreamProvider.zip
Currently, we only provide the FileStreamProvider out of the box for use in your own code; however, the FileStreamProvider inherits from an abstract class called StreamProvider.  This abstract class is the type that the Render method is looking for. So you can implement your own StreamProvider that uses a MemoryStream in its implementation.

I've attached a solution that contains a sample implementation that you can use.  I have also entered suggestion CR 25229 and attached your e-mail address to it, this CR is to have us provide another StreamProvider based on the MemoryStream.

HTH,

James

   Report 
   07-14-2007, 10:04 AM
tdavis34 is not online. Last active: 7/14/2007 12:11:08 AM tdavis34

Not Ranked
Joined on 07-14-2007
Posts 5
Re: Rendering to Memory
Hi James,

Ok, I used the sample you attached and was able to call Render, using that new Stream provider. However, when the Render method is complete, the CanRead property of the Stream is "false", meaning I guess I can't read from it, so it's basically useless. Perhaps this is just a limitation of my coding skills, but how can I get to the data that's been written to the memory stream after the Render method is called?
   Report 
   07-14-2007, 1:13 PM
James Johnson - DD is not online. Last active: 1/21/2012 12:07:51 AM James Johnson - DD

Top 50 Posts
Joined on 01-05-2006
Columbus, Ohio
Posts 502

DDStaff
Re: Rendering to Memory

Once the report is rendered you can make a few method calls to get the data back from the memory stream.

MemoryStreamInfo memoryStreamInfo = streamProvider.GetPrimaryStream() as MemoryStreamInfo;
if( memoryStreamInfo != null ) 
{
    MemoryStream memoryStream = memoryStreamInfo.Open() as MemoryStream;
 
    byte [] data = memoryStream.ToArray();
    // data now contains all of the data that was written to the stream
    // you can then use this as-is, or base another memory stream off it
    // MemoryStream renderedStream = new MemoryStream( data );
}

HTH,

James


   Report 
   06-27-2008, 4:11 PM
grimsaado is not online. Last active: 6/27/2008 12:10:15 AM grimsaado

Top 150 Posts
Joined on 11-22-2005
Posts 63
Re: Rendering to Memory
I'm using this technique to render a report that has a master report defined. The master report is in the same directory as the report I'm rendering and the master report isn't rendering. (IE, its just rendering the report that uses the master but without the master report)

Do I need to do something special to make it work? I tried using MergeWithMaster() even though it says for internal use only but that doesn't seem to do it either.

Note: Rendering to PDF using a memory stream DOES include the master with no problems but rending to HTML does not.

   Report 
   06-27-2008, 5:02 PM
Jon Smith - DD is not online. Last active: 2/1/2012 6:50:14 PM Jon Smith - DD

Top 25 Posts
Joined on 02-21-2007
Raleigh, NC
Posts 958

DDStaff
Re: Rendering to Memory

Attachment: RenderingTest.zip
You must ensure that the MasterReport property has the correct path to the MasterReport. Calling Render on a ReportRuntime should automatically merge master and content reports.

See the attached sample for an example.


If you have any more questions, feel free to ask.

Thanks,
Jon

   Report 
   06-27-2008, 5:19 PM
grimsaado is not online. Last active: 6/27/2008 12:10:15 AM grimsaado

Top 150 Posts
Joined on 11-22-2005
Posts 63
Re: Rendering to Memory
Thank you for the example you provided.
FileInfo masterReportFile = new FileInfo(@"C:\ClientTrack.NET\Customer\Data Systems\Reports\ClientTrack.rdlx-master");
if (!masterReportFile.Exists)
{
throw new Exception("Noob!");
}
ddlRD.Report.MasterReport = masterReportFile.FullName;

Exception is not thrown and as before, it renders fine as PDF but when rendered as HTML using this memorystream technique referanced in this thread the master report is not applied to the HTML version.

   Report 
   06-27-2008, 5:31 PM
grimsaado is not online. Last active: 6/27/2008 12:10:15 AM grimsaado

Top 150 Posts
Joined on 11-22-2005
Posts 63
Re: Rendering to Memory
Rendering to HTML using the default FileStreamProvider does the same thing, no master applied. PDF still fine using both memorystream and filestream.

   Report 
   06-27-2008, 5:38 PM
grimsaado is not online. Last active: 6/27/2008 12:10:15 AM grimsaado

Top 150 Posts
Joined on 11-22-2005
Posts 63
Re: Rendering to Memory
Similar, possibly related, issue. My master report has embedded images but the report I'm playing with that uses the master does not.

DataDynamics.Reports.ReportDefinition ddlRD = new DataDynamics.Reports.ReportDefinition(new FileInfo(ReportPath));
DataDynamics.Reports.ReportRuntime ddrRT = new DataDynamics.Reports.ReportRuntime(ddlRD);

FileInfo masterReportFile = new FileInfo(@"C:\ClientTrack.NET\Customer\Data Systems\Reports\ClientTrack.rdlx-master");
if (!masterReportFile.Exists)
{//Paranoidly proving the file exists on the hardcoded path that I know is correct.
throw new Exception("Noob!");
}
//Before assignment, MasterReport="ClientTrack.rldx-master"; Said master is in same folder as the report.
ddlRD.Report.MasterReport = masterReportFile.FullName;

ddlRD.Report.EmbeddedImages.Count==0

IE, the EmbeddedImages collection isn't seeing the images that are embedded in my master report, thus I can't swap them out even in PDF which I can render with the master.

   Report 
   06-30-2008, 12:57 PM
Jon Smith - DD is not online. Last active: 2/1/2012 6:50:14 PM Jon Smith - DD

Top 25 Posts
Joined on 02-21-2007
Raleigh, NC
Posts 958

DDStaff
Re: Rendering to Memory
I have entered Case 111310 in regards to the issue with the HTML Rendering Extension not outputting page headers and page footers when it renderings in Galley Mode (its default rendering mode).

For your issue with the Master report's EmbeddedImages, they are not supposed to be editable from the content report, this is by design. I think the best option in this case would be to create a theme file for each of your customers and embed the images there.


If you have any more questions, feel free to ask.

Thanks,
Jon

   Report 
   06-30-2008, 1:22 PM
grimsaado is not online. Last active: 6/27/2008 12:10:15 AM grimsaado

Top 150 Posts
Joined on 11-22-2005
Posts 63
Re: Rendering to Memory
A couple of questions on that one. A good number of our customers just run with the canned reports we ship with (and our low volume customers we don't even give the option of authoring reports but they still want their own logo). As a result generating a custom theme by hand of each of our customers is not an idea I like really at all. At the moment, deploying a new customer is pushbutton + uploading their custom logo which we apply all kinds of places. Adding "Create Custom Theme for reports that embeds customer logo" would be another task our implementation support team would probably hate me for.

Is the master supplied content completely non-editable via the report object model?

There are two things in the master I want to dynamically change for the report runtime:
1) Swapping logos (changing the image in the panel in the master). If I can't change the embedded images, is it at least possible to address the picture element and change its source?
2) Dynamically adding some TextBoxes containing parameters.

Is the only way to do this is to not use master reports at all? This being the case, I'll need to change my approach to not use master reports and assess if we can/should use DD. Then again there are no master reports at all in AR (we dynamically add all the header stuff at runtime with code) so it should be swallowable. I just need to do a bit more work.

   Report 
   06-30-2008, 4:37 PM
Jon Smith - DD is not online. Last active: 2/1/2012 6:50:14 PM Jon Smith - DD

Top 25 Posts
Joined on 02-21-2007
Raleigh, NC
Posts 958

DDStaff
Re: Rendering to Memory
Well, what you could do is dynamically generate a Theme file when the user uploads the image. This could then be stored on the server somewhere and then be tied to the customer's profile somehow. Once the generated theme is tied to the customer, a custom implementation of the ResourceLocator could be used to provide the correct theme file to the master report.

Currently it is not possible to change the ReportDefinition's ResourceLocator in the latest public build, therefore, I will send you an email with a link to an interim build with this functionality as well as a sample project which demonstrates a basic implementation of a custom resource locator.


If you have any more questions, feel free to ask.

Thanks,
Jon

   Report 
   06-30-2008, 4:50 PM
grimsaado is not online. Last active: 6/27/2008 12:10:15 AM grimsaado

Top 150 Posts
Joined on 11-22-2005
Posts 63
Re: Rendering to Memory
Hang on, dont go to the effort yet, trying a different strategy at the moment, i'll let you know if it works.

   Report 
GrapeCity » Product Support » Data Dynamics R... » Rendering to Memory

Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.