I've been implementing this using a business object and
devexpress xtrareports over the past couple of weeks. We have numerous other
properties attached to the business object, but the report itself is created
and saved through a single property which returns or accepts an XtraReport
object. This converts it to a stream, which I then save to a private string and
save to the database with the rest of the object. When I need to return the report I read the private
string and then return the report object. Can't say that this is the best way
to do it, but it is working great for us.
Private _Definition
As String = String.Empty
Public Property Report() As XtraReport
Set(ByVal value As XtraReport)
Dim Stream As MemoryStream = New MemoryStream()
value.SaveLayout(Stream)
Stream.Position = 0
Using sr As New StreamReader(Stream)
_Definition = sr.ReadToEnd
End Using
End Set
Get
Using sw As New StreamWriter(New MemoryStream())
sw.Write(_Definition)
Return XtraReport.FromStream(sw.BaseStream,
False)
End Using
End Get
End Property
Copyright (c) Marimer LLC