Hi
Thanks for
your inquiry. Yes, you are right, Aspose.Words throws an exception when you
attempt to set an invalid license.
Also, for testing
purposes, you might find the following method useful:
/// <summary>
/// Returns
true if the Aspsoe.Words license is set.
/// </summary>
private static bool
IsLicenseSet()
{
// We will insert this text at the beggining of the
document.
// If the license set this text will be in the first
paragraph,
// if not an
evaluation watermark will be in the first paragraph.
const string text = "This is text used to check if the license is
set";
Document doc = new
Document();
DocumentBuilder builder = new
DocumentBuilder(doc);
builder.Write(text);
// Save and optn the document. If Aspose.Words works in
evaluation mote it will add a watermark.
using (MemoryStream
docStream = new MemoryStream())
{
doc.Save(docStream, SaveFormat.Doc);
docStream.Position = 0;
doc = new Document(docStream);
}
// Check text of the first paragraph.
return
(doc.FirstSection.Body.FirstParagraph.ToTxt().Trim() == text);
}
Best regards,
Alexey Noskov
Developer/Technical Support
Aspose Auckland Team