import java.util.ArrayList;
import java.util.List;
import com.heavenlake.wordapi.Document;
public class Test {
public static void main(String[] args) {
try {
Document doc = new Document();
// 打开word文档
doc.open("c:/图书.doc");
List<ArrayList> list = doc.readTable(1, 1);
for (int i = 0; i < list.size(); i++) {
ArrayList<String> al = list.get(i);
for (int j = 0; j < al.size(); j++) {
System.out.print(al.get(j).trim() + "|");
}
System.out.println();
}
// 关闭word文档
doc.close(true);
} catch (Exception e) {
e.printStackTrace();
}
}
}
java2word读取word表格
最新推荐文章于 2022-04-11 18:46:36 发布