Java byteArray []到docx [英] Java byteArray[] to docx

查看:82
本文介绍了Java byteArray []到docx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

doc文件,类型为 byte []
是否可以将其从byte []转换为.docx文件。

doc file in byte[] type. Is it possible to convert it from byte[] into .docx file.

试图仅更改文件扩展名programilly,但它不起作用。
有任何建议吗?

tried just change file extension programilly but it does not work. any suggestions?

我使用BiRT eclipse生成报告
保存文档的代码:

I generate report using BiRT eclipse code of saving doc:

options = new RenderOptionBase();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
options.setOutputStream(bos);
options.setOutputFormat("doc");
if(parameters != null){
    task.setParameterValues(parameters);
}
task.setRenderOption(options);
task.run();

return bos.toByteArray()

//IRunAndRenderTask task;

问题是我们使用的BIRT 3.7不支持 DocxRenderOption

problem is that we use BIRT 3.7 which not support DocxRenderOption

推荐答案

看看Aspose.Words for Java- http://www.aspose.com/java/word-component.aspx

Take a look at Aspose.Words for Java -- http://www.aspose.com/java/word-component.aspx

它也具有非常好的文档- http ://www.aspose.com/docs/display/wordsjava/load+or+create+a+document

It has really good doc too -- http://www.aspose.com/docs/display/wordsjava/load+or+create+a+document

代码就像

//打开文档。

Document doc = new Document( input.doc);

Document doc = new Document("input.doc");

//保存文档。

doc.save( output.docx);

doc.save("output.docx");

第一步:保存文档文件
步骤2:使用此lib转换文件并另存为docx文件。

Step1: save the doc file Step2: using this lib convert the file and save as docx file.

这篇关于Java byteArray []到docx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆