如何从ODT文件Java生成字节数组 [英] How can I generate Byte array from an ODT file java

查看:162
本文介绍了如何从ODT文件Java生成字节数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从ODT模板文件生成PDF,其中包含我需要填充的字段.

I am trying to generate a PDF from an ODT template file which contain the fields i need to populate.

我想获取此ODT模板的字节数组,该数组位于我的项目的根文件夹中.我的应用程序是通过提供字节数组来生成PDF的.

I wanted to get the byte array of this ODT template which is present in the root folder of my project. My application is in such a way that the byte array is provided to generate the PDF.

在不丢失模板属性的情况下,是否有任何特定的方法来生成字节数组??

Is there any specific method to generate the byte array without losing the properties of the template..?

推荐答案

尝试一下可能会帮助您:

Try this may help you :

URL url = this.getClass().getResource("/your_file");
File templateFile = new File(url.toURI());
org.apache.commons.io.FileUtils.readFileToByteArray(templateFile )

这篇关于如何从ODT文件Java生成字节数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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