I'm generating a report with an image of a chart on the first page.
The chart is generated from the application and saved to a file "chart.gif" (about 115K)
I can open the resultant file in numerous viewers/paint applications so I'm assumuing it's OK (also tried a bmp, that didn't work either).
In my application I:
Code: Select all
printReport = new StiReport();
printReport.Load(path);
StiPage page = printReport.Pages[0];
string imagePath = Path.GetTempFileName();
imagePath = Path.ChangeExtension(imagePath, CopyExport.DEFAULT_IMAGE_EXT);
CopyChartToFile(imagePath);
StiImage image = new StiImage();
image.Name = "CEL350ChartImage";
// Dummy size for now
image.ClientRectangle = new RectangleD(0, 0, 10, 10);
// This is a workaround for the FromFile function that keeps the file locked until
// the image is disposed of.
FileStream stream = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
image.Image = Image.FromStream(stream);
stream.Close();
File.Delete(imagePath);
page.Components.Add(image);
'System.Runtime.InteropServices.ExternalException'
occurred in stimulsoft.report.dll
Additional information: A generic error occurred in GDI+.
What am I doing wrong this time?
Thanks, Ian