资源简介
java实现docx转html,自定义标签属性,然后根据自定义的标签属性,将html转为word,可支持普通段落,图片、表格、单元格合并、文本字体、字体大小、段落对齐方式、删除线、下划线、粗体、斜体、背景颜色等
代码片段和文件信息
package com.renchunjie.cwh.bean.htmlBean;
private List
import java.util.ArrayList;
import java.util.List;
public class Html {
private String htmlHeader = “\n“ +
“ject> objs = new ArrayList<>();
private float left;
private float right;
private float bottom;
private float top;
private float width;
private float height;
private String htmlFoot = ““;
public String getHtmlHeader() {
return htmlHeader;
}
public void setHtmlHeader(String htmlHeader) {
this.htmlHeader = htmlHeader;
}
public Listject> getObjs() {
return objs;
}
public void setObjs(Listject> objs) {
this.objs = objs;
}
public String getHtmlFoot() {
return htmlFoot;
}
public void setHtmlFoot(String htmlFoot) {
this.htmlFoot = htmlFoot;
}
public float getLeft() {
return left;
}
public void setLeft(float left) {
this.width = this.width-left;
this.left = left;
}
public float getRight() {
return right;
}
public void setRight(float right) {
this.width = this.width - right;
this.right = right;
}
public float getBottom() {
return bottom;
}
public void setBottom(float bottom) {
this.height = this.height - bottom;
this.bottom = bottom;
}
public float getTop() {
return top;
}
public void setTop(float top) {
this.height = this.height - top;
this.top = top;
}
public float getWidth() {
return width;
}
public void setWidth(float width) {
this.width = width;
}
public float getHeight() {
return height;
}
public void setHeight(float height) {
this.height = height;
}
public void addObj(object obj){
if(obj instanceof Table){
((Table) obj).setWidth(((Table) obj).getWidth()/this.width);
}
this.objs.add(obj);
}
public String toString(){
StringBuffer html = new StringBuffer(htmlHeader);
String style= “margin-top:“+top/1440*72/0.75+“px;margin-right:“+right/1440*72/0.75+“px;margin-left:“+left/1440*72/0.75+“px;margin-bottom:“+bottom/1440*72/0.75+“px;width:“+this.width/1440*72/0.75+“px;height:“+this.height/1440*72/0.75+“px;“;
html.append(“ style=\““+st yle+“\“>“);
html.append(“yle‘ hidden=‘hidden‘>“+st“);yle+“
if(objs!=null&&objs.size()>0){
for(object obj:objs){
if(obj instanceof PPR)
html.append(((PPR)obj).toHtml());
if(obj instanceof Table)
html.append(((Table)obj).toHtml());
}
}
html.append(htmlFoot);
return html.toString();
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-11-08 09:50 cwh\
目录 0 2019-11-08 10:29 cwh\.idea\
文件 618 2019-11-08 09:51 cwh\.idea\compiler.xm
目录 0 2019-11-07 09:48 cwh\.idea\inspectionProfiles\
目录 0 2019-11-08 09:45 cwh\.idea\libraries\
文件 462 2019-11-07 10:17 cwh\.idea\libraries\Maven__antlr_antlr_2_7_7.xm
文件 543 2019-11-07 10:17 cwh\.idea\libraries\Maven__commons_codec_commons_codec_1_10.xm
文件 503 2019-11-07 10:17 cwh\.idea\libraries\Maven__commons_io_commons_io_2_4.xm
文件 644 2019-11-07 10:17 cwh\.idea\libraries\Maven__com_fasterxm
文件 595 2019-11-07 10:17 cwh\.idea\libraries\Maven__com_fasterxm
文件 623 2019-11-07 10:17 cwh\.idea\libraries\Maven__com_fasterxm
文件 499 2019-11-07 10:17 cwh\.idea\libraries\Maven__com_google_guava_guava_19_0.xm
文件 486 2019-11-07 10:17 cwh\.idea\libraries\Maven__com_lowagie_itext_2_1_7.xm
文件 480 2019-11-07 10:17 cwh\.idea\libraries\Maven__com_thedeanda_lorem_2_0.xm
文件 462 2019-11-07 10:17 cwh\.idea\libraries\Maven__dom4j_dom4j_1_6_1.xm
文件 469 2019-11-07 10:17 cwh\.idea\libraries\Maven__log4j_log4j_1_2_17.xm
文件 488 2019-11-07 10:17 cwh\.idea\libraries\Maven__net_arnx_wmf2svg_0_9_8.xm
文件 520 2019-11-07 10:17 cwh\.idea\libraries\Maven__net_engio_mbassador_1_2_4_2.xm
文件 534 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_antlr_antlr_runtime_3_5_2.xm
文件 541 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_antlr_stringtemplate_3_2_1.xm
文件 655 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_avalon_fr
文件 662 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_avalon_fr
文件 556 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_commons_commons_lang3_3_4.xm
文件 577 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_httpcomponents_httpclient_4_5_2.xm
文件 563 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_httpcomponents_httpcore_4_4_4.xm
文件 524 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_pdfbox_fontbox_2_0_4.xm
文件 551 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_xm
文件 579 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_xm
文件 565 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_xm
文件 586 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_xm
文件 544 2019-11-07 10:17 cwh\.idea\libraries\Maven__org_apache_xm
............此处省略112个文件信息
- 上一篇:Gson所需jar包
- 下一篇:jsoup-1.7.3.jar
相关资源
-
org.springfr
amework.context-3.2.2.RELEASE.j - 最新的xwork-core-2.3.7.jar
- rovio陆威机器人安卓控制端twobots非原
-
Android应用与fr
amework的socket通信 - the ONE无线网络模拟器Opportunistic Netw
- word转html可设置编码方式
- Java文字转语音_完整版本
- Java2Word.jar215404
- webwork-2.1.7.jar
- java操作word书签
- java读取doc、docx、slx、xlsx等word和exc
- Java邮件客户端
- java2word.jar
- Java实验报告书样本5个实验 word格式
- woodstox-core-asl-4.0.6.jar
- com.opensymphony.xwork2
- word转pdf安装软件
- java操作word,可以随意操作书签
- JAVA用PageOffice动态导出Word文档
- osworkflow中文入门指南,osworkflow+hibe
- java-根据word模板生成word-freemarker-完整
- freemarker根据word模板生成word的完整
- words-1.0-javadoc.jar
- Java导出Word文件
- java2word程序代码及jar包
- java 使用jacob Word转PDF 完美格式
- wordcount.jar
- java给word文档插入水印并设置保护密码
- 离线安装eclipse的aptana插件详细中文
- hello world.jar
评论
共有 条评论