Hi Team,
When I include a OLE into a word document, I could see ONLY part of the image from the OLE in the front. Once I double click, I could see full image. Is there are a way to set it to show up as much of image as per available page width?
See attached code and document. In the attached document, even though there is enough width available, the OLE is not seen completely. Instead, it is half cut.
You could used the attached doc as the rtf file to be included as physical embedding.
Thanks,
Kumar
public class TestIncludeOLE
{
public static void main(String[] args) throws Exception
{
TestAsposeUtils.setupLicense(TestAsposeUtils.lICENSE_FILE_PATH);
Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
docBuilder.getCurrentSection().getPageSetup().setOrientation(Orientation.LANDSCAPE);
String includeDcoPath = "D:\\OLE_505c332a17a813b6_000010532Object_Text_0.rtf";
insertOLEDocument(new Document(includeDcoPath), docBuilder, doc);
doc.updateFields();
String unique = UUID.randomUUID().toString().replaceAll(" ", "_");
String docpath = System.getProperty("java.io.tmpdir") + "test_" + unique + "_" + BuildVersionInfo.getVersion(); //$NON-NLS-1$ //$NON-NLS-2$
doc.save(docpath + ".doc"); //$NON-NLS-1$
System.out.println(docpath + ".doc");
}
private static void insertOLEDocument(Document srcDoc, DocumentBuilder docBuilder, Document doc) throws Exception
{
// This object will be translating styles and lists during the import.
NodeImporter importer = new NodeImporter(srcDoc, doc, ImportFormatMode.USE_DESTINATION_STYLES);
// Node lastNode = docBuilder.getCurrentParagraph();
CompositeNode<?> dstStory = docBuilder.getCurrentParagraph();
Node lastNode = dstStory.getLastChild();
for (Section srcSection : srcDoc.getSections())
{
for (Node srcNode : srcSection.getBody())
{
NodeCollection shapes = ((CompositeNode<?>) srcNode).getChildNodes(NodeType.SHAPE, true);
for (Shape shape : shapes)
{
Node newNode = importer.importNode(shape, true);
try
{
Node importedNode = dstStory.insertAfter(newNode, lastNode);
lastNode = importedNode;
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
}
}