Page 1 of 1

HTML Export creation and display

Posted: Fri Jul 04, 2008 11:26 am
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

HTML Export creation and display

Posted: Sat Jul 05, 2008 12:56 am
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.

HTML Export creation and display

Posted: Sun Oct 05, 2008 8:35 am
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 ???

HTML Export creation and display

Posted: Tue Oct 07, 2008 11:35 am
by tobi
Any Ideas anybody ? Thanks

HTML Export creation and display

Posted: Wed Oct 08, 2008 6:43 pm
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.