Creating a text file in Java with bold formatting of headings

别来无恙 提交于 2019-12-14 02:32:37

问题


I am working on a Java application which creates an encrypted report .txt file (on server which uses 3DES algorithm). This file is then opened on another program which is running on PC and can be decrypted to get the final report.

I am having a requirement of highlighting the headings in the report in BOLD. I came across a way to make a word file with formatting using java. If I create a .doc file with the following HTML tags, MS word opens a the file like any browser.

<HTML>
    <BODY>
        <b><center> Report Heading <center></b>
        <p>Sub-Heading</p>
    </BODY>
</HTML>

The file when opened in MS Word, looks like this.

Report Heading

Sub-Heading

I am able to create the document with these tags. But the only thing I am not getting is a 'page break' tag. While writing into a normal .txt file we write '\f' for form feed character which did the needful for me. How can I achieve the same with HTML Tags.? IS there anything equivalent to form feed character in HTML?

来源:https://stackoverflow.com/questions/19381913/creating-a-text-file-in-java-with-bold-formatting-of-headings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!