JAcob word各級タイトルとタイトル対応コードの読み出し


詳細
Jacob開発パッケージをインターネットからダウンロードし、構成し、jarパッケージをeclipseで構成した後、jacob.dllはc:/windows/system 32に置けばいいです.以下はコードです.

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;

public class TestDocPage {
	
	
	 public static void main (String [] args) throws Exception {
		 
		   String filePath = "E:\\test.doc";
		   
		   ActiveXComponent word=new ActiveXComponent("Word.Application");
		   
		   word.setProperty("Visible", new Variant(false)); 
		   
		   Dispatch documents=word.getProperty("Documents").toDispatch();
		   
		   Dispatch wordFile=Dispatch.invoke(documents, "Open", Dispatch.Method, new Object[]{filePath,new Variant(true),new Variant(false)}, new int[1]).toDispatch();	
	
		   Dispatch paragraphs=Dispatch.get(wordFile, "Paragraphs").toDispatch();
           
           int paraCount=Dispatch.get(paragraphs, "Count").getInt();
           
          for(int i=0;i 
 
word , 。