以表格形式将数据存储在文件中 [英] Store Data in Tabular form in file

查看:90
本文介绍了以表格形式将数据存储在文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Java在Microsoft Office Word或Text文件中创建一个表.有人可以告诉我如何举一个例子吗?

I want to create a table in a Microsoft Office Word or Text file using Java. Can anybody tell me how to do it with an example?

推荐答案

文本文件中的表格非常简单,因为您只需确定每个字段应保留多长时间并确保您用适当数量的空格填充文本的每一行,最后得到类似以下内容的内容:
A table in a text file is quite simple as you just decide how long each field should be and ensure you fill out each line of text with the appropriate number of spaces, to end up with something like:
==========+==============+===================
| field 1 | field 2      |    field three   |
==========+==============+===================
| field N | field N+1    |    field N+2     |
==========+==============+===================


但是,创建Word文档要容易一些,因为您需要使用一些库,该库将完成将数据格式化为Microsoft Office所需的结构的所有艰苦工作.


However, creating a Word document is less easy as you need to use some library which will do all the hard work of formatting your data into the structures required by Microsoft Office; here[^] are some possible options.


这篇关于以表格形式将数据存储在文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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