Variant variant = oleAutomation.getProperty(ids[0]); if (variant != null) { OleAutomation application = variant.getAutomation(); ids = application.getIDsOfNames(new String[] { "ActiveDocument" }); //$NON-NLS-1$ if (ids != null) { variant = application.getProperty(ids[0]); if (variant != null) { OleAutomation activeDocument = variant.getAutomation(); ids = activeDocument.getIDsOfNames(new String[] { "Final" }); //$NON-NLS-1$ if (ids != null) {
int idAddIns = application.getIDsOfNames(new String[] {"COMAddIns"})[0]; Variant addInsVar = application.getProperty(idAddIns); OleAutomation addIns = addInsVar.getAutomation(); int countID = addIns.getIDsOfNames(new String[] {"Count"})[0]; Variant countVariant = addIns.getProperty(countID); int addInsItemID = addIns.getIDsOfNames(new String[] {"Item"})[0]; for (int i = 1; i <= countVariant.getInt(); i++) { Variant addInsItemVariant = addIns.invoke(addInsItemID, new Variant[] {new Variant(i)}); OleAutomation addInsItem = addInsItemVariant.getAutomation(); int addInsItemConnectID = addInsItem.getIDsOfNames(new String[] { "Connect" })[0]; if (addInsItem.getProperty(addInsItemConnectID).getBoolean()) { int addInsItemNameID = addInsItem.getIDsOfNames(new String[] { "ProgId" })[0]; Variant addInsItemNameVariant = addInsItem.getProperty(addInsItemNameID); String name = addInsItemNameVariant.getString(); addInsItem.setProperty(addInsItemConnectID, new Variant(false)); } }
OleAutomation active = activeDocument.getAutomation(); if(active!=null){ int[] paragraphsId = getId(active, "Paragraphs"); if(paragraphsId.length > 0) { Variant vParagraphs = active.getProperty(paragraphsId[0]); if(vParagraphs != null){ OleAutomation paragraphs = vParagraphs.getAutomation(); if(paragraphs!=null){ int[] countId = getId(paragraphs, "Count"); if(countId.length > 0) { Variant count = paragraphs.getProperty(countId[0]); if(count!=null){ int numberOfParagraphs = count.getInt(); for(int i = 1 ; i <= numberOfParagraphs ; i++) { Variant paragraph = paragraphs.invoke(0, new Variant[]{new Variant(i)}); if(paragraph!=null){ System.out.println("paragraph " + i + " added to list!"); listOfParagraphs.add(paragraph); } } return listOfParagraphs; } } } } }
OleAutomation resultDocuments = pVarResult.getAutomation();