What Is poi-5.2.3.jar?

What Is poi-5.2.3.jar?

✍: FYIcenter.com

poi-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-5.2.3.jar supports Apache POI components that read and write Microsoft's OLE 2 Compound document format, which is used in early versions of Microsoft Office tools like Word 97, Excel 97, PowerPoint 97, etc.

poi-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-5.2.3.jar
Target JDK version: 9

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

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

org/apache/poi/ss/util/WorkbookUtil.java

/* ====================================================================
   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

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
==================================================================== */

package org.apache.poi.ss.util;

/**
 * Helper methods for when working with Usermodel Workbooks
 */
public class WorkbookUtil {

    /**
     * Creates a valid sheet name, which is conform to the rules.
     * In any case, the result safely can be used for
     * {@link org.apache.poi.ss.usermodel.Workbook#setSheetName(int, String)}.
     * <br>
     * Rules:
     * <ul>
     * <li>never null</li>
     * <li>minimum length is 1</li>
     * <li>maximum length is 31</li>
     * <li>doesn't contain special chars: : 0x0000, 0x0003, / \ ? * ] [ </li>
     * <li>Sheet names must not begin or end with ' (apostrophe)</li>
     * </ul>
     * Invalid characters are replaced by one space character ' '.
     *
     * @param nameProposal can be any string, will be truncated if necessary,
     *        allowed to be null
     * @return a valid string, "empty" if to short, "null" if null
     */
    public static String createSafeSheetName(final String nameProposal) {
        return createSafeSheetName(nameProposal, ' ');
    }

    /**
     * Creates a valid sheet name, which is conform to the rules.
     * In any case, the result safely can be used for
     * {@link org.apache.poi.ss.usermodel.Workbook#setSheetName(int, String)}.
     * <br>
     * Rules:
     * <ul>
     * <li>never null</li>
     * <li>minimum length is 1</li>
     * <li>maximum length is 31</li>
     * <li>doesn't contain special chars: : 0x0000, 0x0003, / \ ? * ] [ </li>
     * <li>Sheet names must not begin or end with ' (apostrophe)</li>
     * </ul>
     *
     * @param nameProposal can be any string, will be truncated if necessary,
     *        allowed to be null
     * @param replaceChar the char to replace invalid characters.
     * @return a valid string, "empty" if to short, "null" if null
     */
    public static String createSafeSheetName(final String nameProposal, char replaceChar) {
        if (nameProposal == null) {
            return "null";
        }
        if (nameProposal.length() < 1) {
            return "empty";
        }
        final int length = Math.min(31, nameProposal.length());
        final String shortenname = nameProposal.substring(0, length);
        final StringBuilder result = new StringBuilder(shortenname);
        for (int i=0; i<length; i++) {
            char ch = result.charAt(i);
            switch (ch) {
                case '\u0000':
                case '\u0003':
                case ':':
                case '/':
                case '\\':
                case '?':
                case '*':
                case ']':
                case '[':
                    result.setCharAt(i, replaceChar);
                    break;
                case '\'':
                    if (i==0 || i==length-1) {
                        result.setCharAt(i, replaceChar);
                    }
                    break;
                default:
                    // all other chars OK
            }
        }
        return result.toString();
    }

    /**
     * Validates sheet name.
     *
     * <p>
     * The character count {@code MUST} be greater than or equal to 1 and less than or equal to 31.
     * The string MUST NOT contain the any of the following characters:
     * <ul>
     * <li> 0x0000 </li>
     * <li> 0x0003 </li>
     * <li> colon (:) </li>
     * <li> backslash (\) </li>
     * <li> asterisk (*) </li>
     * <li> question mark (?) </li>
     * <li> forward slash (/) </li>
     * <li> opening square bracket ([) </li>
     * <li> closing square bracket (]) </li>
     * </ul>
     * The string MUST NOT begin or end with the single quote (') character.
     *
     * @param sheetName the name to validate
     * @throws IllegalArgumentException if validation fails
     */
    public static void validateSheetName(String sheetName) {
        if (sheetName == null) {
            throw new IllegalArgumentException("sheetName must not be null");
        }
        int len = sheetName.length();
        if (len < 1 || len > 31) {
            throw new IllegalArgumentException("sheetName '" + sheetName
                    + "' is invalid - character count MUST be greater than or equal to 1 and less than or equal to 31");
        }

        for (int i=0; i<len; i++) {
            char ch = sheetName.charAt(i);
            switch (ch) {
                case '/':
                case '\\':
                case '?':
                case '*':
                case ']':
                case '[':
                case ':':
                    break;
                default:
                    // all other chars OK
                    continue;
            }
            throw new IllegalArgumentException("Invalid char (" + ch
                    + ") found at index (" + i + ") in sheet name '" + sheetName + "'");
        }
        if (sheetName.charAt(0) == '\'' || sheetName.charAt(len-1) == '\'') {
            throw new IllegalArgumentException("Invalid sheet name '" + sheetName
                    + "'. Sheet names must not begin or end with (').");
        }
    }

}

org/apache/poi/ss/util/WorkbookUtil.java

Or download all of them as a single archive file:

File name: poi-5.2.3-src.zip
File size: 2479830 bytes
Release date: 2022-09-09
Download 

 

What Is poi-ooxml-5.2.3.jar?

What Is poi-bin-5.2.3-20220909.zip?

Downloading and Installing Apache POI Java Library

⇑⇑ FAQ for Apache POI (Poor Obfuscation Implementation)

2017-04-04, 56930👍, 0💬