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
Report Template Thumbnail
Thanks,
John Hamilton
Hamilton & Company, LLC
John Hamilton
Hamilton & Company, LLC
Report Template Thumbnail
Hello John,
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.
You can use method GetThumbnail(int width, int height, bool isDesignTime). For example: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?
Code: Select all
bmp = report.Pages[0].GetThumbnail(100, 100, true);
Thank you.
Report Template Thumbnail
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.
Edit: Looks like the master above got in their first 
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;
}

Report Template Thumbnail
You guys have thought of everything!
Thanks,
John Hamilton
POSitive Software Company
http://www.gopositive.com
Thanks,
John Hamilton
POSitive Software Company
http://www.gopositive.com
Thanks,
John Hamilton
Hamilton & Company, LLC
John Hamilton
Hamilton & Company, LLC
Report Template Thumbnail
Hello John,
Thank you.
We can't know everything, but your request is not first and we make this feature some of years ago.You guys have thought of everything!
Thank you.