![]() ![]() The only class in the object model that exposes "new" is the Application object. Word (indeed, most Office object models) doesn't allow you to create a "new" object. But that doesn't mean the document actually exists. The way Visual Studio functions, it allows you to create a ThisDocument constructor (although you shouldn't!), and you can call it and instantiate a "ThisDocument" object. In order for a Word document object to exist it must be OPEN in the Word application. You can't procede the way you're trying to go as far as working with the Word application: And I believe I'm following the logic you're trying to apply, now. OK, I think I've finally reconstructed the "framework" you're working in. If you try my code above that is so simple you will see the problem. Application.Documents which receive an VSTOdoc.InnerObject I don't see an overload method for "Add" in Interop.Word. I agree whith you that this seems to be simple but i don't understand why the Property Application is null and why Application" (wdApp) who is not null and his Document property listĬontains a reference to the VSTOdoc.InnerObject previously created. ![]() This is because the Application Property is null and not defined. Application wdApp = Īnd i got an exception "Object reference not set to an instance of an object" when the line two run. > who gets an instance of " .Document" or " .Document" How can i set the property doc.Application with this instance wdApp. In other words if i also have this line of code I get an exception because the property Application of the document instance is null. In the server side of the docx i added a public method who receive an integer and connect to database for retreiving some data and bind them to a PlainTextContentControl.īut if i want from another application project like a console application or window application who reference the project based on word document 2007 template created previously and i want from it make this call:ĭocProj.ThisDocument doc = new docProj.ThisDocument() I open a solution in visual 2008, then i create a project based on word document 2007 template. I want to create word documents on the fly. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |