C# 在PPT中添加Latex数学公式

 时间:2026-02-13 20:58:53

1、在VS中添加引用dll文件(需要将库手动下载至本地,然后解压,dll在Bin文件夹下):

C# 在PPT中添加Latex数学公式

C# 在PPT中添加Latex数学公式

C# 在PPT中添加Latex数学公式

C# 在PPT中添加Latex数学公式

2、完成添加引用效果:

C# 在PPT中添加Latex数学公式

1、using Spire.Presentation;

using Spire.Presentation.Drawing;

using System.Drawing;

namespace AddFormular

{

    class Program

    {

        static void Main(string[] args)

        {

            //新建一个PPT幻灯片文档,并获取第一张幻灯片(新建的PPT文档已默认包含一张幻灯片)

            Presentation ppt = new Presentation();

            ISlide slide = ppt.Slides[0];

            //添加形状到幻灯片

            IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(30, 100, 400, 30));

            shape.Fill.FillType = FillFormatType.None;

            shape.ShapeStyle.LineColor.Color = Color.White;

            shape.TextFrame.Paragraphs.Clear();

            //添加公式

            string latexMathCode = @"$ f(x,y) = \sqrt[n]{{x^2}{y^3}} $";

            shape.TextFrame.Paragraphs.AddParagraphFromLatexMathCode(latexMathCode);           

            //保存

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

        }

    }

}

2、执行程序代码,生成PPT文档,按照代码中的文件路径,可在VS程序项目文件夹下查看,如图效果:

C# 在PPT中添加Latex数学公式

  • MATLAB R2015b中注释汉字复制到word上出现乱码
  • Matlab GUI切换按键(togglebutton)控件属性设置
  • 在LabVIEW里面美化图片下拉框的界面
  • 用MATLAB实现仿真图像
  • Altium Designer怎么关闭表格条目
  • 热门搜索
    华东五市旅游报价 崇明岛旅游 旅游英语口语大全 湖南旅游地图 旅游经济学 马德里旅游 崂山旅游攻略 帕劳旅游攻略 旅游意外保险 丹巴旅游