Posts

Showing posts with the label Word

How to Set Page Margins for Word Documents via Java

Image
The margin is the distance between the edge of the page and the text. In the printable area, you can usually insert text and graphics, and you can also insert certain items in the margin area (such as headers, footers, page numbers, etc.). There will be a unified standard format for page margins in the Word document we use. For page margins, the standard is 2.54CM on top and bottom, and 2.8CM on the left and right. The margins can also be changed according to your own needs. The purpose of today's article is to show you how to programmatically set page margins for Word Documents. For your reference, I have attached Java code with the ideas and methods I have sorted out. First, you’re required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. Method 1: Introduced manually. Download Free Spire.Doc for Java locally, unzip it, and find the Spire.Doc.jar file in the lib folder. Open the following interface in IDEA, a...

C#/VB.NET: How to Add Header and Footer in Word Documents

Image
  Often, the header displays additional information about the document at the top of each page. Inserting time, graphics, company microlabels, document titles, file names, or author names is possible. Footer is the area at the bottom of each page in the document. It is often used to display additional information about the document. You can insert text or graphics into the footer. The purpose of today's article is to show you how to add headers and footers to Word documents programmatically. For your reference, I have attached C#/VB.NET code with the ideas and methods I have sorted out. Programming Environment In this test, Free Spire.Doc for .NET is introduced into the program. The Spire.Doc.dll file can be referenced by: Method 1: Download Free Spire.Doc for .NET locally, unzip it, and install it. After the installation is complete, find Spire.Doc.dll in the BIN folder under the installation path. Then open the "Solution Explorer" in Visual Studio, right-click ...

How to Change Font Color in Word via Java

Image
To make it easier for readers to grasp the main points of an article, we sometimes need to modify the color of the font to highlight the key points. This article will explain how to change the font color in Word programmatically. To explain how to do this, this article will be divided into two parts.I have attached the C#/VB.NET code for your reference, along with the steps I took to sort things out.     Change Font Color of a Paragraph     Change Font Color of a Specific Text Programming Environment First, you’re required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. Method 1: Introduced manually. Download Free Spire.Doc for Java locally, unzip it, and find the Spire.Doc.jar file in the lib folder. Open the following interface in IDEA, and import the jar file in the local path into the Java program: Method 2: If you use Maven , you can easily import the JAR file in your ap...

Java: How to Add Document Properties to Word Documents

Image
  Word document properties include general, summary, statistics, content, custom. The summary includes items such as title, subject, author, manager, unit, category, keywords, remarks, etc. Attributes are equivalent to the business card of the document, and you can add comments, instructions, etc. you want. You can also mark the copyright. Today I will introduce to you how to add document properties to Word documents through Java code. Please read below for details. Add Built-in Document Properties to a Word Document Add Custom Document Properties to a Word Document Programming Environment First, you’re required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. Method 1: Introduced manually. Download Free Spire.Doc for Java locally, unzip it, and find the Spire.Doc.jar file in the lib folder. Open the following interface in IDEA, and import the jar file in the local path into the Java program: If you use M...