BufferedReader bufferedReader = null
File file = new File("文档地址+文档名.docx")
if(!file.exists()){
System.out.println("文件不存在")
} else {
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "读取的字符格式(UTF-8或GBK)"))
String lineText = null
while((lineText = bufferedReader.readLine()) != null){
if (linText != null &&!lineText.eq("")){
System.out.println("一次读取一行,一行内容为:" + lineText)
}
}
}
网上很多相关的,都很简单,推荐一个,你去看看。http://www.cnblogs.com/ldcsaa/archive/2012/02/23/2364036.html
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)