Page 1 of 1
Report Template Thumbnail
Posted: Thu Oct 09, 2008 3:53 pm
by johnham
I store my reports in a table in my SQL Database. As a peice of eye-candy for my application I would like to show a thumbnail of the report template for my browse dialog when someone is selecting a report to edit in the designer.
Is there a way to generate a thumbnail of the Template Layout?
Thanks,
John Hamilton
POSitive Software Company
http://www.gopositive.com
Report Template Thumbnail
Posted: Thu Oct 09, 2008 5:01 pm
by Vital
Hello John,
johnham wrote:I store my reports in a table in my SQL Database. As a peice of eye-candy for my application I would like to show a thumbnail of the report template for my browse dialog when someone is selecting a report to edit in the designer.
Is there a way to generate a thumbnail of the Template Layout?
You can use method GetThumbnail(int width, int height, bool isDesignTime). For example:
Code: Select all
bmp = report.Pages[0].GetThumbnail(100, 100, true);
You need call this method for first page in your report. Also take in consideration that your report can contain more that one page.
Thank you.
Report Template Thumbnail
Posted: Thu Oct 09, 2008 5:02 pm
by Brendan
Hi John
Yes this can be done easily enough. First you need to load your report through the StiReport.Load method and then you can generate a thumbnail of any page in the Pages collection. Here is some sample code that generates a thumbnail to the size of a picturebox and then displays it in a picturebox. you can just replace this code with your own dimensions and save the Thumbnail to the DB or whatever.
Code: Select all
StiReport report = new StiReport();
//Load the Report to Generate Thumbnail
report.Load(mrtfile.FileName);
if (report.Pages.Count > 0)
{
//Use First Page of Report for Thumbnail
StiPage page = report.Pages[0];
//Generate Thumbnail (W x H) of Design Time Report Page 1
Bitmap bmp = page.GetThumbnail(pictureBox1.Width, pictureBox1.Height, true);
pictureBox1.Image = bmp;
}
Edit: Looks like the master above got in their first
Report Template Thumbnail
Posted: Thu Oct 09, 2008 5:06 pm
by johnham
You guys have thought of everything!
Thanks,
John Hamilton
POSitive Software Company
http://www.gopositive.com
Report Template Thumbnail
Posted: Thu Oct 09, 2008 5:14 pm
by Vital
Hello John,
You guys have thought of everything!
We can't know everything, but your request is not first and we make this feature some of years ago.
Thank you.