How to get the html string of a report?

Stimulsoft Reports.NET discussion
Post Reply
ChengXiong
Posts: 3
Joined: Mon Oct 08, 2012 8:59 am

How to get the html string of a report?

Post 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.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

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

Post by Alex K. »

Hello,

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

Thank you.
ChengXiong
Posts: 3
Joined: Mon Oct 08, 2012 8:59 am

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

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

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

Post 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.
ChengXiong
Posts: 3
Joined: Mon Oct 08, 2012 8:59 am

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

Post 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!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

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

Post 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.
Post Reply