现在需要使用poi读取word中的各种数据 然后添加到数据库中 主要是做试题管理的系统读取图片已经解决,现在还有一个问题 就是怎样读取word中的公式 例如 U=0V 

解决方案 »

  1.   

    public void extractImagesIntoDirectory(String directory) throws IOException {
    PicturesTable pTable = msWord.getPicturesTable();
    int numCharacterRuns = msWord.getRange().numCharacterRuns();
    for (int i = 0; i < numCharacterRuns; i++) {
    CharacterRun characterRun = msWord.getRange().getCharacterRun(i);
    if (pTable.hasPicture(characterRun)) {
    System.out.println("have picture!");
    Picture pic = pTable.extractPicture(characterRun, false);
    String fileName = pic.suggestFullFileName();
    OutputStream out = new FileOutputStream(new File(directory
    + File.separator + fileName));
    pic.writeImageContent(out);
    text = text + "<image src='"+fileName+"'>";
    }else{
    text = text + characterRun.text();
    }
    }
    }
      

  2.   

    word中的公式?
    你确定不是excel中的??