HTML Export creation and display

Stimulsoft Reports.NET discussion
Post Reply
tobi
Posts: 9
Joined: Mon Jun 30, 2008 2:55 pm

HTML Export creation and display

Post by tobi »

Hi,

I want to create a asp.net application where a report is dynamically created, exported to html if necccessary and then the html report is shown without the use of the preview control !

Can anyone guide to into the right direction if this is possible ...

Thanks a lot
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

HTML Export creation and display

Post by Edward »

Please read the following topic on how to provide an image host for images after HTML export here:

http://forum.stimulsoft.com/Default.aspx?g=posts&t=572

After exporting of the report into HTML, you can display it as necessary.

Thank you.
tobi
Posts: 9
Joined: Mon Jun 30, 2008 2:55 pm

HTML Export creation and display

Post by tobi »

Dear Edward,

thanks for the reply. But I think this is not exactly what I want to do.

I want do display a report exactly like in the html preview in the designer !
We don´t need any features like saving, printing, zooming, ... of the stiwebviewer !

So I thought I can do this by using StiWebReport !? Just for displaying a html report in a aspx.net page ???
tobi
Posts: 9
Joined: Mon Jun 30, 2008 2:55 pm

HTML Export creation and display

Post by tobi »

Any Ideas anybody ? Thanks
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

HTML Export creation and display

Post by Vital »

Hello,

You can use following code in PageLoad event:
StiHtmlExportSettings settings = new StiHtmlExportSettings();
Stimulsoft.Report.Web.StiReportResponse.ResponseAsHtml(this, report, false, settings, htmlImageHost)
if you report will be contain images then you need create special class StiHtmlImageHost. This class help in image storing in web. Please see sample of this class:

Code: Select all

public class StiWebImageHost : StiHtmlImageHost
	{
		public override string GetImageString(Bitmap bmp)
		{
			Guid imageGuid = Guid.NewGuid();
			
			MemoryStream imageStream = new MemoryStream();
			bmp.Save(imageStream, webViewer.ImageFormat);

            if (webViewer.CacheMode == StiCacheMode.Page)
            {
                webViewer.Page.Cache.Add(imageGuid.ToString(), imageStream.ToArray(), null, Cache.NoAbsoluteExpiration,
                    webViewer.ServerTimeOut, System.Web.Caching.CacheItemPriority.Low, null);
            }
            else
            {
                webViewer.Page.Session.Add(imageGuid.ToString(), imageStream.ToArray());
            }

			string url = webViewer.Page.Request.Url.AbsolutePath;
            string query = webViewer.Page.Request.Url.Query;

            if (query != null && query.Length > 0)
            {
                return string.Format("{0}{1}&stimulreport_image={2}", url, query, imageGuid);
            }
            else
            {
                return string.Format("{0}?stimulreport_image={1}", url, imageGuid);
            }
		}

		private StiWebViewer webViewer = null;

		public StiWebImageHost(StiWebViewer webViewer) : base (null)
		{
			this.webViewer = webViewer;
		}
	}
Thank you.
Post Reply