ActiveReports Developer 7
SaveLayout(Stream) Method
See Also  Example
GrapeCity.ActiveReports.v7 Assembly > GrapeCity.ActiveReports Namespace > SectionReport Class > SaveLayout Method : SaveLayout(Stream) Method

stream
Stream object where the report's layout will be saved.

Glossary Item Box

This overload has been deprecated. Please use the new SaveLayout(XmlWriter) overload.

Syntax

Visual Basic (Declaration) 
Public Overloads Sub SaveLayout( _
   ByVal stream As System.IO.Stream _
) 
C# 
public void SaveLayout( 
   System.IO.Stream stream
)

Parameters

stream
Stream object where the report's layout will be saved.

Remarks

You can use this method to save the report's layout as a stream, then store it in a database or a resource file.

The SaveLayout(Stream) method uses the UTF-16 encoding when you save to a stream.

When using this method, any code behind the report is ignored. To embed code in the report, use Scripting.

Example

C#Copy Code
private void mnuPrintPreview_Click(object sender, System.EventArgs e)
{
    GrapeCity.ActiveReports.SectionReport rpt = new GrapeCity.ActiveReports.SectionReport();
    System.IO.MemoryStream m_stream = new System.IO.MemoryStream();
    this.designer1.Report.SaveLayout(m_stream);
    m_stream.Position = 0;    
    rpt.LoadLayout(m_stream);
    m_stream.Close();
    frmViewer frm = new frmViewer();    
    frm.SetReport(rpt);
    frm.ShowDialog(this);
}
VB.NETCopy Code
Private Sub mnuPrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _ 
    Handles mnuPrintPreview.Click
        Dim rpt As New GrapeCity.ActiveReports.SectionReport()
        Dim m_stream As New System.IO.MemoryStream()
        Me.Designer1.Report.SaveLayout(m_stream)
        m_stream.Position = 0
        rpt.LoadLayout(m_stream)
        m_stream.Close()
        Dim frm As New frmViewer()
        frm.SetReport(rpt)
        frm.ShowDialog(Me)
End Sub

See Also