excel转换html类(Excel2HtmlUtil的JAVA类)


这款EXCEL转换HTML利用PIO万能转换,来源与CSDN网上资源,我只是吧所有JAR包和程序源码放在一起便于快速开发测试使用。本人测试整理好用。
资源截图
代码片段和文件信息
package com.hygx.ldw.text;

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

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.examples.html.HSSFHtmlHelper;
import org.apache.poi.ss.examples.html.HtmlHelper;
import org.apache.poi.ss.examples.html.XSSFHtmlHelper;
import org.apache.poi.ss.format.CellFormat;
import org.apache.poi.ss.format.CellFormatResult;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Formatter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

import static org.apache.poi.ss.usermodel.Cellstyle.*;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;

/**
 * This example shows how to display a spreadsheet in HTML using the classes for
 * spreadsheet display.
 * 
 * @author Ken Arnold Industrious Media LLC
 */
public class Excel2HtmlUtil
{
    private final Workbook wb;
    private final Appendable output;
    private boolean completeHTML;
    private Formatter out;
    private boolean gotBounds;
    private int firstColumn;
    private int endColumn;
    private HtmlHelper helper;

    private static final String DEFAULTS_CLASS = “excelDefaults“;
    private static final String COL_HEAD_CLASS = “colHeader“;
    private static final String ROW_HEAD_CLASS = “rowHeader“;

    private static final Map ALIGN = mapFor(ALIGN_LEFT “left“
            ALIGN_CENTER “center“ ALIGN_RIGHT “right“ ALIGN_FILL “left“
            ALIGN_JUSTIFY “left“ ALIGN_CENTER_SELECTION “center“);

    private static final Map VERTICAL_ALIGN = mapFor(
            VERTICAL_BOTTOM “bot

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2320  2013-12-20 22:35  excelstyle.css

     文件       1194  2016-09-24 20:13  maven配置.txt

     文件     232019  2013-10-02 07:14  libcommons-beanutils-1.8.3.jar

     文件     232771  2013-10-02 07:14  libcommons-codec-1.6.jar

     文件     559366  2013-10-02 07:14  libcommons-collections-3.1.jar

     文件     173587  2013-10-02 07:14  libcommons-io-2.2.jar

     文件     279193  2013-10-02 07:14  libcommons-lang-2.5.jar

     文件      60686  2013-10-02 07:14  libcommons-logging-1.1.1.jar

     文件     313898  2013-10-02 07:14  libdom4j-1.6.1.jar

     文件      86487  2013-10-02 07:14  libezmorph-1.0.6.jar

     文件     159123  2013-10-02 07:14  libjson-lib-2.4-jdk15.jar

     文件      16905  2013-10-02 07:14  libjstl.jar

     文件     358180  2013-10-02 07:14  liblog4j-1.2.13.jar

     文件    1820323  2016-04-08 08:26  libpoi-3.8-20120326.jar

     文件     300235  2016-04-08 08:30  libpoi-examples-3.8-20120326.jar

     文件      30446  2016-04-08 08:28  libpoi-excelant-3.8-20120326.jar

     文件     933010  2016-04-08 08:31  libpoi-ooxml-3.8-20120326.jar

     文件    4706775  2016-04-08 08:28  libpoi-ooxml-schemas-3.8-20120326.jar

     文件    1186887  2016-04-08 08:32  libpoi-scratchpad-3.8-20120326.jar

     文件     293750  2013-10-02 07:14  libstandard.jar

     文件      26514  2013-10-02 07:14  libstax-api-1.0.1.jar

     文件    2666695  2013-10-02 07:14  libxmlbeans-2.3.0.jar

     文件      16886  2019-01-14 14:31  Excel2HtmlUtil.java

     目录          0  2019-01-14 14:57  lib

----------- ---------  ---------- -----  ----

             14457250                    24


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)