I'm currently developing a program which allows us to save information in a TopSolid project(Client name, contact information, project data etc) and one of the features is to being able to import attachments into TopSolid using the Documents.Import method.
This works great; it imports my file into TopSolid(like a PDF) and i can open it in TopSolid by double clicking it. If i however want to open it from my application, it seems dat Documents.Open only works with TopSolid Documents.
I can't seem to open a simple PDF file that is sitting in my TopSolid project via my application. I load in a list of documents that my project has and display them in a Listbox. When selecting a document the user can press a 'open document' button to open the selected file. TopSolid documents work fine but anything other than that i keep getting an exception.
My code:
Code: Select all
//Get the PdmObjectId
PdmID = Controller.DocumentList(Index)
//Try and get the document using the PdmObjectId, this returns Empty if it can't get the Document, like a PDF
DocID = TopSolidHost.Documents.GetDocument(PdmID)
//Open the selected document. This gives me an exception since DocID is empty
TopSolidHost.Documents.Open(DocID)