Бизнес объекты и картинки
Задача такая, передать в FastReport бизнес-объект с катринкой
В дизайнере кладем объект Рисунок на бэнд и пивязываем его к полю Peoples.photo.
Далее строим отчет, все нормально. Закрываем превью и снова строим отчет - появляется ошибка:
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at X5sA7gbmET8P4YI5bEt.Jy3PcGbYmEOMUylr6Xf.urNIsTIVv(Image , Stream , ImageFormat )
at FastReport.PictureObject.Serialize(FRWriter writer)
at FastReport.Utils.FRWriter.Write(IFRSerializable obj, Object diff)
at FastReport.Utils.FRWriter.Write(IFRSerializable obj)
at VAiLKonJnthk7AtLlAk.TyjJYjnFknvIyqW4y6J.DsolyN7HY(Base , XmlItem )
at VAiLKonJnthk7AtLlAk.TyjJYjnFknvIyqW4y6J.DsolyN7HY(Base , XmlItem )
at VAiLKonJnthk7AtLlAk.TyjJYjnFknvIyqW4y6J.kLBDBdvxa(BandBase )
at FastReport.Preview.PreparedPages.AddBand(BandBase band)
at FastReport.Engine.ReportEngine.4jLj3S8oW(BandBase )
at FastReport.Engine.ReportEngine.tibL75mec(BandBase , Boolean )
at FastReport.Engine.ReportEngine.JVxs05dW7(BandBase , Boolean )
at FastReport.Engine.ReportEngine.ShowBand(BandBase band)
at FastReport.Engine.ReportEngine.Ijq5UspDR(DataBand , Int32 )
at FastReport.Engine.ReportEngine.v0a6OwXi3(DataBand , Int32 , Boolean , Boolean , Boolean )
at FastReport.Engine.ReportEngine.VWadnRfQB(DataBand )
at FastReport.Engine.ReportEngine.1eplcLRSZi(BandCollection )
at FastReport.Engine.ReportEngine.4WflvNJXPt(ReportPage )
at FastReport.Engine.ReportEngine.qPmlRKdmVv()
at FastReport.Engine.ReportEngine.E19wuaF4X(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.67TngNOnG(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at Hlaw6SLqritsVL1cglV.EwPZq0LR68QmB3JnLDC.HqfY6LoYl()
DataType свойства Peoples.photo после этого Int32.
public class Human
{
public string Name;
public Bitmap photo;
public int num;
public Human(string name, int number)
{
Name = name;
num = number;
}
}
....
List<Human> peoples = new List<Human>();
Human h = new Human("Human", 1);
h.photo = (Bitmap)global::WindowsApplication1.Properties.Resources.Test2;
peoples.Add(h);
Report report = new Report();
report.RegisterData(peoples, "Peoples", FastReport.Data.BOConverterFlags.AllowFields, 5);
report.Design();
В дизайнере кладем объект Рисунок на бэнд и пивязываем его к полю Peoples.photo.
Далее строим отчет, все нормально. Закрываем превью и снова строим отчет - появляется ошибка:
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(Stream stream, ImageFormat format)
at X5sA7gbmET8P4YI5bEt.Jy3PcGbYmEOMUylr6Xf.urNIsTIVv(Image , Stream , ImageFormat )
at FastReport.PictureObject.Serialize(FRWriter writer)
at FastReport.Utils.FRWriter.Write(IFRSerializable obj, Object diff)
at FastReport.Utils.FRWriter.Write(IFRSerializable obj)
at VAiLKonJnthk7AtLlAk.TyjJYjnFknvIyqW4y6J.DsolyN7HY(Base , XmlItem )
at VAiLKonJnthk7AtLlAk.TyjJYjnFknvIyqW4y6J.DsolyN7HY(Base , XmlItem )
at VAiLKonJnthk7AtLlAk.TyjJYjnFknvIyqW4y6J.kLBDBdvxa(BandBase )
at FastReport.Preview.PreparedPages.AddBand(BandBase band)
at FastReport.Engine.ReportEngine.4jLj3S8oW(BandBase )
at FastReport.Engine.ReportEngine.tibL75mec(BandBase , Boolean )
at FastReport.Engine.ReportEngine.JVxs05dW7(BandBase , Boolean )
at FastReport.Engine.ReportEngine.ShowBand(BandBase band)
at FastReport.Engine.ReportEngine.Ijq5UspDR(DataBand , Int32 )
at FastReport.Engine.ReportEngine.v0a6OwXi3(DataBand , Int32 , Boolean , Boolean , Boolean )
at FastReport.Engine.ReportEngine.VWadnRfQB(DataBand )
at FastReport.Engine.ReportEngine.1eplcLRSZi(BandCollection )
at FastReport.Engine.ReportEngine.4WflvNJXPt(ReportPage )
at FastReport.Engine.ReportEngine.qPmlRKdmVv()
at FastReport.Engine.ReportEngine.E19wuaF4X(Boolean , Boolean , ReportPage )
at FastReport.Engine.ReportEngine.67TngNOnG(Boolean , Boolean )
at FastReport.Report.Prepare(Boolean append)
at FastReport.Report.Prepare()
at Hlaw6SLqritsVL1cglV.EwPZq0LR68QmB3JnLDC.HqfY6LoYl()
DataType свойства Peoples.photo после этого Int32.
Комментарии