The following example demonstrates how to use the SaveAsXml and LoadFromXml methods to serialize and deserialize an UltraPrintDocument.
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Printing
Private xmlMemoryStream As System.IO.MemoryStream = Nothing
Private Sub btnXmlSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnXmlSave.Click
If Not Me.xmlMemoryStream Is Nothing Then
Me.xmlMemoryStream.Close()
End If
Me.xmlMemoryStream = New System.IO.MemoryStream()
Me.UltraPrintDocument1.SaveAsXml(Me.xmlMemoryStream)
End Sub
Private Sub btnXmlLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXmlLoad.Click
If Me.xmlMemoryStream Is Nothing Then
Return
End If
Me.xmlMemoryStream.Position = 0
Me.UltraPrintDocument1.LoadFromXml(Me.xmlMemoryStream)
End Sub
'Declaration
Public Overloads Sub SaveAsXml( _
ByVal As Stream _
)
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Printing;
private System.IO.MemoryStream xmlMemoryStream = null;
private void btnXmlSave_Click(object sender, System.EventArgs e)
{
if (this.xmlMemoryStream != null)
this.xmlMemoryStream.Close();
this.xmlMemoryStream = new System.IO.MemoryStream();
this.ultraPrintDocument1.SaveAsXml(this.xmlMemoryStream);
}
private void btnXmlLoad_Click(object sender, System.EventArgs e)
{
if (this.xmlMemoryStream == null)
return;
this.xmlMemoryStream.Position = 0;
this.ultraPrintDocument1.LoadFromXml(this.xmlMemoryStream);
}
'Declaration
Public Overloads Sub SaveAsXml( _
ByVal As Stream _
)
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2