I just purchased Aspose.Word and am having trouble getting the license file to work. I don’t get any errors per se, but I still get the evaluation message at the top of all the documents I generate with the component. Here is what I have done:
in web.config I have the following:
<add key=“AsposeWordLicense” value=“dev_Aspose.Word.lic” />
then in my document builder file I have:
protected string AsposeWordLicense = ConfigurationSettings.AppSettings[“AsposeWordLicense”];
StreamReader WordLicenseReader = new StreamReader(Server.MapPath(“AsposeLicenses/” + AsposeWordLicense), UnicodeEncoding.UTF7);
Word.SetLicense(WordLicenseReader, this);
Document myAsposeDoc;
// This is a custom object I have written…
clsDocument myDocument = new clsDocument(myDocID);
myAsposeDoc = BuildPolicyDocument(myDocument, UniqueID);
DocExporter.SendToBrowser(myAsposeDoc, myDocument.DocumentName, OutputType, this);
private Document BuildPolicyDocument(clsDocument myDocument, int myUniqueID)
{
//Open the template document
Document myAsposeDoc = OpenDocFromBinary(myDocument.TemplateBinaryData);
// Get policy document data and put into dataset.
clsStoredProcedure mySP = new clsStoredProcedure(myDocument.DocumentType.DataSource);
mySP.AddInteger("@UniqueID", myUniqueID);
DataSet myDS = mySP.ExecuteDataSet(strConn);
myAsposeDoc.MailMerge.RemoveEmptyParagraphs = true;
myAsposeDoc.MailMerge.ExecuteWithRegions(myDS);
myAsposeDoc.MailMerge.DeleteFields();
return myAsposeDoc;
}
private Document OpenDocFromBinary(byte[] myBinaryData)
{
// Create stream from byte array…
MemoryStream myStream = new MemoryStream(myBinaryData, 0, myBinaryData.Length);
// Open the file in Aspose from the stream
Word app = new Word();
return app.Open(myStream);
}
I purchased the product yesterday and then downloaded the new Aspose.Word.dll file today for version 1.8.3. If the code is OK, perhaps this is the problem??
spotvader