Skip to main content
1-Visitor
January 16, 2017
Question

How to get contents of a Document?

  • January 16, 2017
  • 1 reply
  • 1441 views

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?

1 reply

15-Moonstone
January 16, 2017

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);
ash1-VisitorAuthor
1-Visitor
January 17, 2017

That helped. Thanks!