|
[SetUp]
public void Initializing()
{
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("License Key");
}
[Test]
public void SaveAsText()
{
//Creates an instance of WordDocument Instance (Empty Word Document)
WordDocument document = new WordDocument();
//Add a section & a paragraph in the empty document
document.EnsureMinimal();
//Append text to the last paragraph of the document
document.LastParagraph.AppendText("Hello World");
MemoryStream memoryStream = new MemoryStream();
document.Save(memoryStream, Syncfusion.DocIO.FormatType.Txt);
string outputText = string.Empty;
memoryStream.Position = 0;
// Reads the stream and assigned the string to Text property
using (StreamReader reader = new StreamReader(memoryStream))
{
outputText = reader.ReadToEnd();
}
Assert.IsTrue(outputText == "Hello World");
} |