The WCF Service

The project consists of 2 parts: A WCF service that uses the ServerTextControl component to create a new document and an XBAP application using TX Text Control .NET for WPF that consumes the service.

The service implements a simple public method to create a new document. A new instance of the ServerTextControl component is created and the document is saved into a byte array in the internal TX Text Control format.

[C#]
public byte[] GetDocument()
{
	TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl();
	tx.Create();

	tx.Text = "This document has been loaded from the server";

	byte[] data;

	tx.Save(out data, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
	tx.Dispose();

	return data;
} 
[Visual Basic]
Public Function GetDocument() As Byte() Implements IService1.GetDocument
	Dim tx As New TXTextControl.ServerTextControl()
	tx.Create()

	tx.Text = "This document has been loaded from the server"

	Dim data As Byte() = Nothing

	tx.Save(data, TXTextControl.BinaryStreamType.InternalUnicodeFormat)
	tx.Dispose()

	Return data
End Function