MS Word License Doesn't Work


#1

I'm using the following code to load the license file (in my global.asax file's Session_Start method) and I can step through my web application code, but still, I get garbage text in my documents. My MS Word Template documents are being retrieved from the backend mssql database. Does that affect anything? I tried breaking the code by placing an incorrect license file and it does break, so I know that my license file is being used. I wrote a page that uploads an MS Word Template document, then uses that to do merges, in that case, my final document does NOT show garbage text and works fine. I can't figure out what is different between the two processes. The two methods I use (one for loading the template doc from database, the other to load template doc from webpage) are also provided below. Any help would be appreciated.

-Munzoor.

*****

License li = new License();

String licenseFileFullPath = ConfigurationSettings.AppSettings.Get("AsposeLicenseFileFullPath");

li.SetLicense(licenseFileFullPath);

************** Loading Template Document From Database **************

public static Document getDBDocument()

{

byte[] b = // I use an OR mapping tool to get the column that has the byte[] value, the column is of type "image";

MemoryStream ms = new MemoryStream(b);

Document doc = new Document(ms);

return doc;

}

************** Loading Template Document From Webpage **************

// The uploadedFile byte[] is coming from the front end where I have a FileUpload control

// called fuBrowse and I use fuBrowse.FileBytes to get the byte[]

public static Document getDocumentFromUpload(byte[] uploadedFile)

{

MemoryStream ms = new MemoryStream(uploadedFile);

Document doc = new Document(ms);

return doc;

}


#2

Make sure that the document that you have in the database does not contain a watermark already. Aspose.Words does not remove existing watermarks. It just does not add watermarks when it runs with a license. If you use Aspose.Words to store the documents into the database before you had a license, this means they have a watermark in them.


#3

I also think that Session_Start is not a good place to load your licence. Try putting it into Application_Start method.

Regards,