Browse Source
Merge in CORE/base-third from ~HUGH.C/base-third:feature/10.0 to feature/10.0 * commit '6990e331db3f404af8ae381e675c9eec12dfb922': (50 commits) 无jira任务,persist合final REPORT-34320 块标签前的块标签含文本且文本尾部不是空格时会多出空白行 REPORT-33863 html图片变成了图片后文字的背景图;html图片宽度大于实际盒子宽度时,图片后的文字丢失 REPORT-32796 h1-h6标签,默认字体加粗不生效,默认margin值不生效 REPORT-32986 html大写标签不生效 REPORT-33908 HTML高度计算异常(br标签中的line-height属性应该生效) REPORT-33908 HTML高度计算异常(br、hr 标签中的line-height属性不应该生效) REPORT-33819? a标签设置text-decoration,前台没有下划线但是导出有 REPORT-33780 font-weight等属性与<b>等标签之间的优先级存在问题 REPORT-33691 tr\td\th设置单元格对齐方式,预览生效,导出不生效 REPORT-33029 无插件PDF导出-HTML解析:块元素(如:div、p)支持align、text-align属性 无jira任务,编译失败 REPORT-33491 无插件PDF导出-HTML解析:支持<th>标签加粗样式 KERNEL-4410 集群定时任务,支持切换执行节点 无 jira 任务, bugfix -> release 解决冲突, 更新目录结构。 REPORT-33025 加点注解 REPORT-33025 无插件PDF导出-HTML解析:支持<a>标签超链 REPORT-32592 html 以<a>、<br> or <hr> 标签开头时,丢失line-height属性 REPORT-33028 review 改进 REPORT-33028 无插件PDF导出-HTML解析:块元素支持margin、padding 属性 ...research/11.0
Hugh.C
4 years ago
36 changed files with 661 additions and 86 deletions
@ -0,0 +1,90 @@
|
||||
package com.fr.third.v2.lowagie.text.html.utils; |
||||
|
||||
import com.fr.third.v2.lowagie.text.html.HtmlTags; |
||||
import com.fr.third.v2.lowagie.text.html.Markup; |
||||
import java.util.HashMap; |
||||
import java.util.Properties; |
||||
|
||||
/** |
||||
* 处理标签默认属性值 |
||||
* |
||||
* @author Hugh.C |
||||
* @version 1.0 |
||||
* Created by Hugh.C on 2020/7/3 |
||||
*/ |
||||
public class DefaultPropertiesHandleUtils { |
||||
|
||||
//h1-h6 标签默认字体大小
|
||||
private static final HashMap<String, String> H_TAG_DEFAULT_FONT_SIZE = new HashMap<String, String>(6); |
||||
|
||||
//h1-h6 标签默认margin-top and bottom大小
|
||||
private static final HashMap<String, String> H_TAG_DEFAULT_MARGIN = new HashMap<String, String>(6); |
||||
|
||||
|
||||
static { |
||||
H_TAG_DEFAULT_FONT_SIZE.put("h1", "2em"); |
||||
H_TAG_DEFAULT_FONT_SIZE.put("h2", "1.5em"); |
||||
H_TAG_DEFAULT_FONT_SIZE.put("h3", "1.17em"); |
||||
H_TAG_DEFAULT_FONT_SIZE.put("h4", "1em"); |
||||
H_TAG_DEFAULT_FONT_SIZE.put("h5", "0.83em"); |
||||
H_TAG_DEFAULT_FONT_SIZE.put("h6", "0.67em"); |
||||
|
||||
H_TAG_DEFAULT_MARGIN.put("h1", "0.67em"); |
||||
H_TAG_DEFAULT_MARGIN.put("h2", "0.83em"); |
||||
H_TAG_DEFAULT_MARGIN.put("h3", "1em"); |
||||
H_TAG_DEFAULT_MARGIN.put("h4", "1.33em"); |
||||
H_TAG_DEFAULT_MARGIN.put("h5", "1.67em"); |
||||
H_TAG_DEFAULT_MARGIN.put("h6", "2.33em"); |
||||
} |
||||
|
||||
/** |
||||
* 填充默认属性值 |
||||
* |
||||
* @param tag |
||||
* @param h |
||||
*/ |
||||
public static void fillDefaultProperties(String tag, HashMap h) { |
||||
if (null == tag || null == h) { |
||||
return; |
||||
} |
||||
if (HtmlTags.HEADERCELL.endsWith(tag)) { |
||||
h.put("b", null); |
||||
return; |
||||
} |
||||
if (HtmlTags.ANCHOR.equals(tag)) { |
||||
h.put("u", null); |
||||
h.put("color", "blue"); |
||||
return; |
||||
} |
||||
|
||||
String style = (String) h.get("style"); |
||||
if (HtmlTags.PARAGRAPH.equals(tag)) { |
||||
Properties props = Markup.parseAttributes(style); |
||||
if (!props.containsKey(Markup.CSS_KEY_MARGINTOP)) { |
||||
h.put(Markup.CSS_KEY_MARGINTOP, "1em"); |
||||
} |
||||
if (!props.containsKey(Markup.CSS_KEY_MARGINBOTTOM)) { |
||||
h.put(Markup.CSS_KEY_MARGINBOTTOM, "1em"); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
if (H_TAG_DEFAULT_FONT_SIZE.containsKey(tag)) { |
||||
h.put("b", null); |
||||
Properties props = Markup.parseAttributes(style); |
||||
if (!props.containsKey(Markup.CSS_KEY_MARGINTOP)) { |
||||
h.put(Markup.CSS_KEY_MARGINTOP, H_TAG_DEFAULT_MARGIN.get(tag)); |
||||
} |
||||
if (!props.containsKey(Markup.CSS_KEY_MARGINBOTTOM)) { |
||||
h.put(Markup.CSS_KEY_MARGINBOTTOM, H_TAG_DEFAULT_MARGIN.get(tag)); |
||||
} |
||||
if (!props.containsKey(Markup.CSS_KEY_FONTSIZE)) { |
||||
h.put("style", new StringBuilder(null == style ? "" : style).append(";") |
||||
.append(Markup.CSS_KEY_FONTSIZE).append(":").append(H_TAG_DEFAULT_FONT_SIZE.get(tag)).append(";").toString()); |
||||
} |
||||
return; |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<modules> |
||||
<module>fine-hibernate</module> |
||||
<module>fine-druid</module> |
||||
</modules>> |
||||
|
||||
<parent> |
||||
<groupId>com.fr.maven</groupId> |
||||
<artifactId>finereport-maven</artifactId> |
||||
<version>10.0</version> |
||||
<relativePath>../finereport-maven</relativePath> |
||||
</parent> |
||||
|
||||
<groupId>com.fr.third</groupId> |
||||
<artifactId>base-third-code</artifactId> |
||||
<version>${branch}</version> |
||||
<packaging>pom</packaging> |
||||
|
||||
</project> |
Loading…
Reference in new issue