Compare commits

..

2 Commits

Author SHA1 Message Date
hyc
217ed13f43 Merge pull request '【修改】文字段落考点' (#5) from hyc into master
Reviewed-on: #5
2025-09-11 14:49:41 +08:00
huababa1
09c541680d 【修改】文字段落考点 2025-09-11 14:49:26 +08:00
2 changed files with 14 additions and 10 deletions

View File

@@ -149,7 +149,8 @@ public class Paragraphs {
PPr pPr = paragraph.getPPr();
if (pPr != null && pPr.getSpacing() != null) {
if (pPr.getSpacing().getBeforeLines()!=null){
return pPr.getSpacing().getBeforeLines().toString();
double lines = pPr.getSpacing().getBeforeLines().intValue() / 100.0;
return String.format("%.1f行", lines);
}
}
if (pPr != null && pPr.getPStyle() != null && stylePart != null) {
@@ -157,7 +158,8 @@ public class Paragraphs {
Style style = stylePart.getStyleById(styleId);
if (style != null && style.getPPr() != null && style.getPPr().getSpacing() != null) {
PPrBase.Spacing spacing = style.getPPr().getSpacing();
return spacing.getBeforeLines().toString();
double lines = spacing.getBeforeLines().intValue() / 100.0;
return String.format("%.1f行", lines);
}
}
return "";
@@ -167,7 +169,7 @@ public class Paragraphs {
PPr pPr = paragraph.getPPr();
if (pPr != null && pPr.getSpacing() != null) {
if(pPr.getSpacing().getBefore()!=null){
return pPr.getSpacing().getBefore().toString();
return String.valueOf(pPr.getSpacing().getBefore().intValue() / 20)+"";
}
}
if (pPr != null && pPr.getPStyle() != null && stylePart != null) {
@@ -175,7 +177,7 @@ public class Paragraphs {
Style style = stylePart.getStyleById(styleId);
if (style != null && style.getPPr() != null && style.getPPr().getSpacing() != null) {
PPrBase.Spacing spacing = style.getPPr().getSpacing();
return spacing.getBefore().toString();
return String.valueOf(style.getPPr().getSpacing().getBefore().intValue() / 20)+"";
}
}
return "";
@@ -185,7 +187,7 @@ public class Paragraphs {
PPr pPr = paragraph.getPPr();
if (pPr != null && pPr.getSpacing() != null) {
if(pPr.getSpacing().getAfter()!=null){
return pPr.getSpacing().getAfter().toString();
return String.valueOf(pPr.getSpacing().getAfter().intValue() / 20)+"";
}
}
if (pPr != null && pPr.getPStyle() != null && stylePart != null) {
@@ -193,7 +195,7 @@ public class Paragraphs {
Style style = stylePart.getStyleById(styleId);
if (style != null && style.getPPr() != null && style.getPPr().getSpacing() != null) {
PPrBase.Spacing spacing = style.getPPr().getSpacing();
return spacing.getAfter().toString();
return String.valueOf(style.getPPr().getSpacing().getAfter().intValue() / 20)+"";
}
}
return "";
@@ -203,8 +205,9 @@ public class Paragraphs {
public static String getParagraphSpacingAfterLines(P paragraph, StyleDefinitionsPart stylePart, WordprocessingMLPackage wordMLPackage, NumberingDefinitionsPart ndp) {
PPr pPr = paragraph.getPPr();
if (pPr != null && pPr.getSpacing() != null) {
if (pPr.getSpacing().getAfterLines()!=null){
return pPr.getSpacing().getAfterLines().toString();
if (pPr.getSpacing().getAfterLines() != null) {
double lines = pPr.getSpacing().getAfterLines().intValue() / 100.0;
return String.format("%.1f行", lines);
}
}
if (pPr != null && pPr.getPStyle() != null && stylePart != null) {
@@ -212,7 +215,8 @@ public class Paragraphs {
Style style = stylePart.getStyleById(styleId);
if (style != null && style.getPPr() != null && style.getPPr().getSpacing() != null) {
PPrBase.Spacing spacing = style.getPPr().getSpacing();
return spacing.getAfterLines().toString();
double lines = spacing.getAfterLines().intValue() / 100.0;
return String.format("%.1f行", lines);
}
}
return "";

View File

@@ -1360,7 +1360,7 @@ public class SectionPage {
Pattern pattern = Pattern.compile("fillcolor=\"#([0-9a-fA-F]{6})\"");
Matcher matcher = pattern.matcher(vmlXml);
if (matcher.find()) {
return "#" + matcher.group(1).toUpperCase();
return ColorUtils.getChineseColorName(matcher.group(1).toUpperCase()) ;
}
return null;
}