Browse Source
* commit '5a5eef56e05c7a86f25e0944b976351ddf0cc79e': REPORT-27284 table解析导出PDF后 单元格背景、边框与预览不一致release/10.0
Hugh.C
5 years ago
5 changed files with 83 additions and 40 deletions
@ -0,0 +1,48 @@ |
|||||||
|
package com.fr.third.v2.lowagie.text.html.Utils; |
||||||
|
|
||||||
|
import com.fr.third.v2.lowagie.text.html.CSSUtils; |
||||||
|
import com.fr.third.v2.lowagie.text.html.simpleparser.ChainedProperties; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Hugh.C |
||||||
|
* @version 1.0 |
||||||
|
* Created by Hugh.C on 2020/2/26 |
||||||
|
*/ |
||||||
|
public class BackgroundUtil { |
||||||
|
|
||||||
|
public static Map<String, String> parse2RulesMap(ChainedProperties props) { |
||||||
|
Map<String, String> backgroundRules = new HashMap<String, String>(); |
||||||
|
String value = props.getProperty("bgcolor"); |
||||||
|
if (value != null) { |
||||||
|
backgroundRules.put("background-color", value); |
||||||
|
} |
||||||
|
value = props.getLastChainProperty("background-size"); |
||||||
|
if (value != null) { |
||||||
|
backgroundRules.put("background-size", value); |
||||||
|
} |
||||||
|
value = props.getLastChainProperty("background"); |
||||||
|
if (value != null) { |
||||||
|
Map<String, String> backgroundStyles = CSSUtils.processBackground(value); |
||||||
|
backgroundRules.putAll(backgroundStyles); |
||||||
|
} |
||||||
|
value = props.getLastChainProperty("background-color"); |
||||||
|
if (value != null) { |
||||||
|
backgroundRules.put("background-color", value); |
||||||
|
} |
||||||
|
value = props.getLastChainProperty("background-position"); |
||||||
|
if (value != null) { |
||||||
|
backgroundRules.put("background-position", value); |
||||||
|
} |
||||||
|
value = props.getLastChainProperty("background-repeat"); |
||||||
|
if (value != null) { |
||||||
|
backgroundRules.put("background-repeat", value); |
||||||
|
} |
||||||
|
value = props.getLastChainProperty("background-image"); |
||||||
|
if (value != null) { |
||||||
|
backgroundRules.put("background-image", value); |
||||||
|
} |
||||||
|
return backgroundRules; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue