Page 1 of 1

How to get the html string of a report?

Posted: Mon Oct 08, 2012 9:08 am
by ChengXiong
I need to put a Html format report into the content part of a http respond, but I do not know how to get the Html string, does anyone know how to do this? thanks in advance.

Re: How to get the html string of a report?

Posted: Tue Oct 09, 2012 10:43 am
by Alex K.
Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your task in more details?

Thank you.

Re: How to get the html string of a report?

Posted: Wed Oct 10, 2012 2:23 am
by ChengXiong
Hi,

Sorry, I did not explain it clearly, my task is to create a report at runtime, and display it on a exist page, the steps may be like this:
1. On the client side, make a Ajax request with some parameters;
2. Server process the request, get the parameters, create a report by using the parameters;
3. Respond the html representation of the report. The code might like this:
String htmlString = report.getHtml();
respond.setContent(htmlString);
4. In the callback function of the Ajax request, process the respond and put the html into somewhere of this page.

I stucked in step 3 because I did not find the report.getHtml()-like fuction.

Or may be I can request a aspx page directly?

Thank you.

Re: How to get the html string of a report?

Posted: Wed Oct 10, 2012 7:28 am
by HighAley
Hello.

You could use next code to get report in HTML format:

Code: Select all

MemoryStream ms = new MemoryStream();
report.ExportDocument(StiExportFormat.Html, ms);
But why not to use our StiWebViewer on your page?

Thank you.

Re: How to get the html string of a report?

Posted: Fri Oct 12, 2012 1:53 am
by ChengXiong
Hello,

It works, Thank you.

I need to create report dynamically, so I'm not sure StiWebViewer works for this situation.

Thanks again!

Re: How to get the html string of a report?

Posted: Fri Oct 12, 2012 10:35 am
by HighAley
Hello.

StiWebViewer just show report. And it will should any report either report loaded from file or report created dynamically.
You could find the RuntimeBuildReport sample project in the Stimulsoft Reports.Net installation. In this sample you could find code to create report.

Thank you.