当前位置:   article > 正文

vb6的frame在html中如何提现,Spire教程:在VB.NET中将HTML字符串附加到PPT中

vb spire

原标题:Spire教程:在VB.NET中将HTML字符串附加到PPT中

Spire.Presentation是一个专业的 PowerPoint控件,用于帮助开发人员高效地创建、读取、编辑、转换和打印任PPT文档,本文介绍了如何在VB.NET中将HTML字符串附加到PPT中。

PPT控件Spire.Presentation 教程:在VB.NET中将HTML字符串附加到PPT中

Spire.Presentation 支持将HTML格式的文本插入到PowerPoint幻灯片中。

代码演示:

Step 1:创建Presentation类的实例。

1

Presentation ppt = new Presentation();

Step 2:在幻灯片中插入一个自动形状(矩形)。

1

IAutoShape shape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 400, 100));

Step 3:清除形状中的默认段落。

1

shape.TextFrame.Paragraphs.Clear();

Step 4:从HTML代码添加段落形状,确保您的HTML片段是在和 标签之间编写的,否则AddFromHtml方法将无法正常工作。

1

2

string htmlText= "< p >First paragraph p >< p >Second paragraph p >";

shape.TextFrame.Paragraphs.AddFromHtml(htmlText);

Step 5:保存至档案。

1

ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);

输出:

5c3e666e585c8b066ff6511cc236c082.png

完整代码:

[C#]

1

2

3

4

5

6

Presentation ppt = new Presentation();

IAutoShape shape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 400, 100));

shape.TextFrame.Paragraphs.Clear();

string htmlText= "

First paragraph

Second paragraph

" ;

shape.TextFrame.Paragraphs.AddFromHtml(htmlText);

ppt.SaveToFile( "output.pptx" , FileFormat.Pptx2013);

[VB.NET]

1

2

3

4

5

6

Presentation ppt = new Presentation();

IAutoShape shape = ppt.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 400, 100));

shape.TextFrame.Paragraphs.Clear();

string htmlText= "

First paragraph

Second paragraph

" ;

shape.TextFrame.Paragraphs.AddFromHtml(htmlText);

ppt.SaveToFile( "output.pptx" , FileFormat.Pptx2013);

阅读原文:https://www.evget.com/article/2017/7/28/26660.html返回搜狐,查看更多

责任编辑:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/728388
推荐阅读
相关标签
  

闽ICP备14008679号