【新增】 PPT考点完善

This commit is contained in:
dlaren
2025-09-10 15:18:20 +08:00
parent 0c7765b8aa
commit ee443494fc
5 changed files with 75 additions and 13 deletions

View File

@@ -1041,7 +1041,7 @@ public class ShapePage {
for (CTTextParagraph paragraph : textBody.getP()) {
if (paragraph.getPPr().getIndent() != null) {
// 结果保留1位小数点
String formattedNumber = String.format("%.1f", (double) paragraph.getPPr().getIndent() / 360000);
String formattedNumber = String.format("%.2f", (double) paragraph.getPPr().getIndent() / 360000);
return formattedNumber + "厘米"; // EMU 转 pt
}
}
@@ -1069,7 +1069,7 @@ public class ShapePage {
CTTextBody textBody = sp.getTxBody();
// 遍历所有段落
for (CTTextParagraph paragraph : textBody.getP()) {
if (paragraph.getPPr().getSpcBef() != null) {
if (paragraph.getPPr().getSpcAft() != null) {
return paragraph.getPPr().getSpcAft().getSpcPts().getVal() / 100 + ""; // EMU 转 pt
}
}

View File

@@ -1,6 +1,5 @@
package pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j;
import jakarta.xml.bind.JAXBElement;
import org.docx4j.dml.*;
import org.pptx4j.pml.*;
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.utils.PtToCmConverter;
@@ -16,6 +15,54 @@ public class ShapePic {
return "";
}
// 媒体 放映时隐藏
public static String getMediaHide(Pic sp, CTSlideTiming timing) {
// 获取ID
long id = sp.getNvPicPr().getCNvPr().getId();
CTTimeNodeList ctTimeNodeList = timing.getTnLst();
List<Object> parOrSeqOrExcl = ctTimeNodeList.getParOrSeqOrExcl();
for (Object o : parOrSeqOrExcl) {
if (o instanceof CTTLTimeNodeParallel) {
CTTimeNodeList ctTimeNodes = ((CTTLTimeNodeParallel) o).getCTn().getChildTnLst();
for (Object o1 : ctTimeNodes.getParOrSeqOrExcl()) {
if (o1 instanceof CTTLMediaNodeVideo) {
// 获取spId
String spId = ((CTTLMediaNodeVideo) o1).getCMediaNode().getTgtEl().getSpTgt().getSpid();
if (String.valueOf(id).equals(spId)) {
return ((CTTLMediaNodeVideo) o1).getCMediaNode().isShowWhenStopped() ? "" : "";
}
}
}
}
}
return "";
}
// 媒体 播放完返回开头
public static String getMediaLoop(Pic sp, CTSlideTiming timing) {
// 获取ID
long id = sp.getNvPicPr().getCNvPr().getId();
CTTimeNodeList ctTimeNodeList = timing.getTnLst();
List<Object> parOrSeqOrExcl = ctTimeNodeList.getParOrSeqOrExcl();
for (Object o : parOrSeqOrExcl) {
if (o instanceof CTTLTimeNodeParallel) {
CTTimeNodeList ctTimeNodes = ((CTTLTimeNodeParallel) o).getCTn().getChildTnLst();
for (Object o1 : ctTimeNodes.getParOrSeqOrExcl()) {
if (o1 instanceof CTTLMediaNodeVideo) {
// 获取spId
String spId = ((CTTLMediaNodeVideo) o1).getCMediaNode().getTgtEl().getSpTgt().getSpid();
if (String.valueOf(id).equals(spId)) {
STTLTimeNodeFillType sttlTimeNodeFillType = ((CTTLMediaNodeVideo) o1).getCMediaNode().getCTn().getFill();
String value = sttlTimeNodeFillType.value();
return value.equals("remove") ? "" : "";
}
}
}
}
}
return "";
}
// 自选图形 - 类型
public static String getShapeType(Pic sp, CTSlideTiming timing) {
CTShapeProperties ctShapeProperties = sp.getSpPr();

View File

@@ -102,7 +102,30 @@ public class SlideSetting {
}
return "";
}
// 幻灯片切换 单机鼠标换片
public static String getSlideTransitionMouse(SlidePart slidePart, PresentationMLPackage presentation, SlideMasterPart slideMasterPart) throws Docx4JException {
Sld slide = (Sld) slidePart.getContents();
CTSlideTransition ctSlideTransition = slide.getTransition();
if (ctSlideTransition != null) {
return ctSlideTransition.isAdvClick() ? "" : "";
}
return "";
}
// 幻灯片切换 效果
public static String getSlideTransitionEffect(SlidePart slidePart, PresentationMLPackage presentation, SlideMasterPart slideMasterPart) throws Docx4JException {
Sld slide = (Sld) slidePart.getContents();
CTSlideTransition ctSlideTransition = slide.getTransition();
if (ctSlideTransition != null) {
String value = ctSlideTransition.getBlinds().getDir().value();
if (value.equals("vert")) {
return "百叶窗->垂直";
}
if (value.equals("horz")) {
return "百叶窗->水平";
}
}
return "";
}
// 幻灯片切换 切换速度
public static String getSlideTransitionSpeed(SlidePart slidePart, PresentationMLPackage presentation, SlideMasterPart slideMasterPart) throws Docx4JException {
Sld slide = (Sld) slidePart.getContents();

View File

@@ -106,7 +106,7 @@ public class HexColorUtils {
// 查找颜色名
String name = COLOR_NAME_MAP.getOrDefault(hexKey, "未知颜色");
name = name.equals("未知颜色") ? "" : name;
return String.format("%s RGB(%d,%d,%d)", name, r, g, b);
}