为有中文需求的客户提供多渠道中文技术支持.

Sat Mar 16, 2024 3:43 am

现在需要读取PPT内的艺术字,并且获取PPT艺术字的格式,希望能够帮忙解决下

liyafei291
 
Posts: 1
Joined: Sat Mar 16, 2024 3:39 am

Mon Mar 18, 2024 2:44 am

您好,

感谢您的咨询。
获取PPT中的艺术字以及字体的格式您可以参考下面的代码代码片段进行测试,如果您有任何疑问,请随时来信。
Code: Select all
Presentation presentation = new Presentation();
presentation.LoadFromFile("test.pptx");
ISlide slide = presentation.Slides[0];
IAutoShape shape = (IAutoShape)slide.Shapes[0];
ITextFrameProperties textFrame = shape.TextFrame;
// 艺术字文本
string text = textFrame.TextRange.Text;
// 字号
float fontHeight = textFrame.TextRange.FontHeight;
// 填充类型
Spire.Presentation.Drawing.FillFormatType fillType = textFrame.TextRange.Fill.FillType;
// 填充颜色
System.Drawing.Color color = textFrame.TextRange.DisplayFill.SolidColor.Color;
// 是否加粗
TriState isBold = textFrame.TextRange.IsBold;
// 是否倾斜
TriState isItalic = textFrame.TextRange.IsItalic;

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 419
Joined: Mon Dec 27, 2021 2:23 am

Return to 中文技术支持