Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert Word file to OFD file by Java

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "how Java converts Word files into OFD files". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how Java converts Word files into OFD files".

Preface

Microsoft Word, which is commonly used in work, is a foreign document content editing software, and its compilation techniques are all foreign. OFD is a kind of independent document format in China, and it is a more secure choice in the document storage technology of some specific industries or enterprises. The following shows how to convert an Word document to OFD format with an Java code example.

Java code environment

Intelli IDEA

Spire.Doc for Java 4.12.1

Word document

There are two ways to import jar files in Java programs.

1. Download and import Maven warehouse.

The configuration in pom.xml is as follows:

Com.e-iceblue https://repo.e-iceblue.cn/repository/maven-public/ e-iceblue spire.doc 4.12.1 2. Import manually.

You need to download the jar package locally, decompress it, and find the jar file under the lib path. Then open the Project Structure window in the Java program, and then perform the following steps to import:

Convert Word to OFD

Document conversion can be achieved in only three lines of code, as follows:

1. Instantiate an object of the Document class.

two。 Call the Document.loadFromFile () method to load the Word document that needs to be converted.

3. Finally, call Document. The saveToFile (String fileName, FileFormat fileFormat) method is saved as an OFD file under the specified path.

Java

Import com.spire.doc.*;public class WordToOFD {public static void main (String [] args) {/ / instantiate the object of the Document class Document document = new Document (); / / load the Word document document.loadFromFile ("Guide.docx"); / / Save to OFD format document.sasaveToFile ("ToOFD.ofd", FileFormat.OFD);}}

Conversion result:

At this point, I believe you have a deeper understanding of "how Java converts Word files into OFD files". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report