您的位置:首页 > 编程语言 > Java开发

java中将word转String

2015-08-31 11:11 351 查看
/**

* 读取doc文件内容

*

* @param file 想要读取的文件对象

* @return 返回文件内容

*/

public static String doc2String(File file)

{

String result = “”;

try

{

FileInputStream fis = new FileInputStream(file);

HWPFDocument doc = new HWPFDocument(fis);

Range rang = doc.getRange();

result += rang.text();

fis.close();

}

catch (Exception e)

{

e.printStackTrace();

}

return result;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  word java