mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
avoid creating CTUnderline
This commit is contained in:
parent
73b2874824
commit
f3bf31ac5d
@ -600,16 +600,17 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public String getUnderlineColor() {
|
||||
CTUnderline underline = getCTUnderline(true);
|
||||
assert(underline != null);
|
||||
String colorName = "auto";
|
||||
Object rawValue = underline.getColor();
|
||||
if (rawValue != null) {
|
||||
if (rawValue instanceof String) {
|
||||
colorName = (String)rawValue;
|
||||
} else {
|
||||
byte[] rgbColor = (byte[])rawValue;
|
||||
colorName = HexDump.toHex(rgbColor[0]) + HexDump.toHex(rgbColor[1]) + HexDump.toHex(rgbColor[2]);
|
||||
CTUnderline underline = getCTUnderline(false);
|
||||
if (underline != null) {
|
||||
Object rawValue = underline.getColor();
|
||||
if (rawValue != null) {
|
||||
if (rawValue instanceof String) {
|
||||
colorName = (String) rawValue;
|
||||
} else {
|
||||
byte[] rgbColor = (byte[]) rawValue;
|
||||
colorName = HexDump.toHex(rgbColor[0]) + HexDump.toHex(rgbColor[1]) + HexDump.toHex(rgbColor[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return colorName;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user