|
@@ -422,16 +422,23 @@ public class WordStructuredExtractionService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 上下标
|
|
// 上下标
|
|
|
- VerticalAlign vertAlign = xwpfRun.getSubscript();
|
|
|
|
|
- if (vertAlign != null && vertAlign != VerticalAlign.BASELINE) {
|
|
|
|
|
- run.setVerticalAlign(vertAlign.name().toLowerCase());
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ VerticalAlign vertAlign = xwpfRun.getVerticalAlignment();
|
|
|
|
|
+ if (vertAlign != null && vertAlign != VerticalAlign.BASELINE) {
|
|
|
|
|
+ run.setVerticalAlign(vertAlign.name().toLowerCase());
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ // 某些版本可能不支持
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 高亮颜色
|
|
// 高亮颜色
|
|
|
if (xwpfRun.isHighlighted()) {
|
|
if (xwpfRun.isHighlighted()) {
|
|
|
try {
|
|
try {
|
|
|
- String highlightColor = xwpfRun.getTextHighlightColor().name().toLowerCase();
|
|
|
|
|
- run.setHighlightColor(highlightColor);
|
|
|
|
|
|
|
+ // getTextHighlightColor() 返回 STHighlightColor.Enum,使用 toString()
|
|
|
|
|
+ Object highlightColorEnum = xwpfRun.getTextHighlightColor();
|
|
|
|
|
+ if (highlightColorEnum != null) {
|
|
|
|
|
+ run.setHighlightColor(highlightColorEnum.toString().toLowerCase());
|
|
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
run.setHighlightColor("yellow");
|
|
run.setHighlightColor("yellow");
|
|
|
}
|
|
}
|