We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

SetLicense with stream from string

Hi, i’m trying to use a 30-day license (then i’ll have a real license): as read in your site pages i used a static contructor in my class library.

when i use phisical license file that way:

Aspose.Words.License oWlicense = new Aspose.Words.License();


it’s ok but i need to insert license file content in a string variable and pass it as stream to license class

when i try to use this code:

System.IO.MemoryStream myStream = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(<string_variable>));


i’m getting some errors from aspose.cells rather than aspose.words (not tried slides or Others for now):

if i use system.encoding.UTF8…

aspose.cells thow an exeption: “Object reference not set to an instance of an object.” (words works)

instead if i use system.encoding.unicode…

aspose.words throw this exeption: “Name cannot begin with the ‘.’ character, hexadecimal value 0x00. Line 1, position 40.”

There is Some way or workaround to get working this way for total libraries classes of Aspose?

thank’s a lot


I used following code to load license from streams and did not notice any issue.

using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(@"D:\AsposeAspose.Total.lic")))


Aspose.Words.License wLicense = new Aspose.Words.License();



using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(@"D:\Aspose\Aspose.Total.lic")))


Aspose.Cells.License cLicense = new Aspose.Cells.License();


}<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />

Best Regards,

My problem is i’can’t start from phisical file: you use a memorystream with file.readallbytes

i have to use a memorystream with some other Methow for reading bytes from a string containing license… or other way that i don’t know (store license file directly in a byte array? how?)

thank you


You can include the license file as an embedded resource and pass license file name to SetLicense method. Please check http://www.aspose.com/docs/display/wordsnet/Including+the+License+File+as+an+Embedded+Resource for more details and let us know if this does not suit your requirement either.

Best Regards,