What Is poi-examples-5.2.3.jar?

What Is poi-examples-5.2.3.jar?

✍: FYIcenter.com

poi-examples-5.2.3.jar is one of the JAR files for Apache POI 5.2.3, which provides an API for Microsoft document files of Word, Excel, PowerPoint, and Visio.

poi-examples-5.2.3.jar provides examples for both poi.jar and poi-ooxml.jar components.

poi-examples-5.2.3.jar is distributed as part of the poi-bin-5.2.3-20220909.zip download file.

JAR File Size and Download Location:

JAR name: poi-examples-5.2.3.jar
Target JDK version: 1.6

File name: poi-examples-5.2.3.jar
File size: 388829 bytes
Release date: 09-09-2022
Download: Apache POI Website

Here are Java Source Code files for poi-examples-5.2.3.jar:


/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at


   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   See the License for the specific language governing permissions and
   limitations under the License.
==================================================================== */
package org.apache.poi.examples.xwpf.usermodel;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigInteger;

import org.apache.poi.wp.usermodel.HeaderFooterType;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFFooter;
import org.apache.poi.xwpf.usermodel.XWPFHeader;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblGrid;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblGridCol;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblLayoutType;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblLayoutType;

public class HeaderFooterTable {

    public static void main(String[] args) throws IOException {
        try (XWPFDocument doc = new XWPFDocument()) {

            // Create a header with a 1 row, 3 column table
            // changes made for issue 57366 allow a new header or footer
            // to be created empty. This is a change. You will have to add
            // either a paragraph or a table to the header or footer for
            // the document to be considered valid.
            XWPFHeader hdr = doc.createHeader(HeaderFooterType.DEFAULT);
            XWPFTable tbl = hdr.createTable(1, 3);

            // Set the padding around text in the cells to 1/10th of an inch
            int pad = (int) (.1 * 1440);
            tbl.setCellMargins(pad, pad, pad, pad);

            // Set table width to 6.5 inches in 1440ths of a point
            tbl.setWidth((int) (6.5 * 1440));
            // Can not yet set table or cell width properly, tables default to
            // autofit layout, and this requires fixed layout
            CTTbl ctTbl = tbl.getCTTbl();
            CTTblPr ctTblPr = ctTbl.addNewTblPr();
            CTTblLayoutType layoutType = ctTblPr.addNewTblLayout();

            // Now set up a grid for the table, cells will fit into the grid
            // Each cell width is 3120 in 1440ths of an inch, or 1/3rd of 6.5"
            BigInteger w = new BigInteger("3120");
            CTTblGrid grid = ctTbl.addNewTblGrid();
            for (int i = 0; i < 3; i++) {
                CTTblGridCol gridCol = grid.addNewGridCol();

            // Add paragraphs to the cells
            XWPFTableRow row = tbl.getRow(0);
            XWPFTableCell cell = row.getCell(0);
            XWPFParagraph p = cell.getParagraphArray(0);
            XWPFRun r = p.createRun();
            r.setText("header left cell");

            cell = row.getCell(1);
            p = cell.getParagraphArray(0);
            r = p.createRun();
            r.setText("header center cell");

            cell = row.getCell(2);
            p = cell.getParagraphArray(0);
            r = p.createRun();
            r.setText("header right cell");

            // Create a footer with a Paragraph
            XWPFFooter ftr = doc.createFooter(HeaderFooterType.DEFAULT);
            p = ftr.createParagraph();

            r = p.createRun();
            r.setText("footer text");

            try (OutputStream os = new FileOutputStream(new File("headertable.docx"))) {


Or download all of them as a single archive file:

File name: poi-examples-5.2.3-src.zip
File size: 396538 bytes
Release date: 2022-09-09


Download and Install poi-bin-3.15-20160924.zip

What Is poi-scratchpad-5.2.3.jar?

Downloading and Installing Apache POI Java Library

⇑⇑ FAQ for Apache POI (Poor Obfuscation Implementation)

2017-03-22, 4361👍, 0💬