William.Zhang wrote:您好,
感谢您的来信。
为了方便我们进一步调查您的问题,请讲您的测试代码和输入文档(如果有)提供给我们,提前感谢。
Sincerely,
William
E-iceblue support team
package com.mofoun.presentation;
import com.spire.presentation.*;
import com.spire.presentation.drawing.FillFormatType;
import java.awt.*;
import java.awt.geom.Rectangle2D;
public class test {
public static void main(String[] args) throws Exception {
Presentation presentation = new Presentation();
presentation.loadFromFile("D:\\Downloads\\input1.pptx");
// 添加shape
Rectangle2D.Double rec_title = new Rectangle2D.Double(50, 240, 160, 50);
IAutoShape shape_title = presentation.getSlides().get(0).getShapes().appendShape(ShapeType.RECTANGLE, rec_title);
shape_title.getLine().setFillType(FillFormatType.NONE);
shape_title.getFill().setFillType(FillFormatType.NONE);
ParagraphEx para_title = new ParagraphEx();
para_title.setText("TEXT");
para_title.setAlignment(TextAlignmentType.CENTER);
para_title.getTextRanges().get(0).setLatinFont(new TextFont("Myriad Pro Light"));
para_title.getTextRanges().get(0).setFontHeight(32);
para_title.getTextRanges().get(0).isBold(TriState.TRUE);
para_title.getTextRanges().get(0).getFill().setFillType(FillFormatType.SOLID);
para_title.getTextRanges().get(0).getFill().getSolidColor().setColor(Color.gray);
shape_title.getTextFrame().getParagraphs().append(para_title);
presentation.saveToFile("D:\\Downloads\\output2.pptx",FileFormat.AUTO);
}
}