cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get contents of a Document?

ash
Regular Member
Regular Member

How to get contents of a Document?

I have a document. I making a copy of that document, thru code. When I create a new document, the contents/file attached to the original document does not get copied. I am using the ContentHolder & ContentHelper API.

ContentHelper.getApplicationData() to get the data. Following is the code

  ContentHolder content = null;

  try

  {

      content = ContentHelper.service.getContents((ContentHolder)document_object);

  }

  catch (PropertyVetoException e)

  {

      e.printStackTrace();

  }

        Vector vcontent = ContentHelper.getApplicationData(content);

          newDocument.setContentVector(vcontent);

Which API would help to get data from a document & set it to a new document?

Tags (1)
2 REPLIES 2

Re: How to get contents of a Document?

User the ContentHelper service :

import wt.content.ContentHelper
import wt.content.ContentHolder
import wt.doc.WTDocument

WTDocument source,target

// Get the docs...

ContentHelper.service.copyContent(source, target);

Re: How to get contents of a Document?

That helped. Thanks!

Polls

Windchill Customers

What browser do you most commonly use? (Chrome, Firefox, Edge Chromium, Internet Explorer 11, Safari, Other)

Announcements
Learn more about how we are using our browser poll here