【新增】 EMU与PT之间的单位转换
This commit is contained in:
@@ -6,6 +6,7 @@ import org.docx4j.dml.*;
|
||||
import org.docx4j.jaxb.XPathBinderAssociationIsPartialException;
|
||||
import org.pptx4j.pml.*;
|
||||
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.utils.PtToCmConverter;
|
||||
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.utils.PtToEmuConverter;
|
||||
import pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.utils.Transition;
|
||||
|
||||
import java.math.BigInteger;
|
||||
@@ -945,8 +946,10 @@ public class ShapePage {
|
||||
CTTextBody textBody = sp.getTxBody();
|
||||
// 遍历所有段落
|
||||
for (CTTextParagraph paragraph : textBody.getP()) {
|
||||
if (paragraph.getPPr().getSpcBef() != null) {
|
||||
return String.valueOf(paragraph.getPPr().getSpcBef().getSpcPts().getVal());
|
||||
if (paragraph.getPPr().getMarL() != null) {
|
||||
// EMU转磅
|
||||
double pt = PtToEmuConverter.emuToPt(paragraph.getPPr().getMarL());
|
||||
return pt + "磅";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,14 @@
|
||||
package pc.exam.pp.module.judgement.utils.wps_pptx.pptx4j.utils;
|
||||
|
||||
public class PtToEmuConverter {
|
||||
// 基础转换常数
|
||||
public static final double EMU = 12700;
|
||||
|
||||
public static double ptToEmu(double pt) {
|
||||
return pt * EMU;
|
||||
}
|
||||
|
||||
public static double emuToPt(double emu) {
|
||||
return emu / EMU;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user