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

Free Support Forum - aspose.com

Type Initializer Exception

Hi,

I'm using the trial version of Aspose.Words 6. I want to change some fields in a word file and save it as a pdf file. But it gives a Type Initializer exception. I attached the screenshot of the error. This error occurs in a .NET user control. I tried the same code in a windows application, it perfectly creates the pdf file. I pasted my code below. Any help is appreciated.

Aspose.Words.Document doc = new Aspose.Words.Document(someStream);

Aspose.Words.DocumentBuilder docBuild = new Aspose.Words.DocumentBuilder(doc);

docBuild.MoveToCell(0, 0, 4, 0);

docBuild.Write(someText);

docBuild.MoveToCell(0, 1, 1, 0);

docBuild.Write(someText);

docBuild.MoveToCell(0, 3, 1, 0);

docBuild.Write(someText);

docBuild.MoveToCell(0, 7, 0, 0);

docBuild.InsertHtml(someHtmlText);

doc.Save("C:\\WINDOWS\\Temp\\file.pdf");

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

Thanks for your request. I don’t think this is caused by Aspose.Words. Try creating simple web application and generate document on PageLoad. I am sure this will work without any issues.

Do you use any third party UI components in your Web application?

Best regards.

Hi,

Thanks for your interest. You're right. Problem is solved by giving RegistryPermission.

Best regards,

Kerem.