如何从Powerpoint读取数学方程式并将其写入C#中的Word文档

时间:2015-02-05 12:24:45

标签: c# math ms-office powerpoint office-interop

我正在开发自2014年3月以来的PowerPoint提取工具,它从PowerPoint中提取单词或段落并将其写入word文档。它已经开发出来了。在测试期间。我们发现没有从PowerPoint幻灯片中获取数学公式。 我正在使用 Microsoft.Office.Interop.Powerpoint.dll 库。我正在阅读下面给出的文件。

  var powerPoint = new Application {WindowState=PpWindowState.ppWindowMinimized};                
  var oPresSet = powerPoint.Presentations;
  Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(pptName, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
  var str = oPres.Slides[1].NotesPage.Shapes[2].TextFrame.TextRange.Text;

这是PPT输入的屏幕截图。 enter image description here

但我想阅读PowerPoint幻灯片中的数学公式。 我尝试使用这些MathZones和get_MathZones,但我对如何使用MathZones proerety没有太多了解。另一方面,get_MathZones方法给出了相同的乱码文本。我使用了get_MathZones方法,如下所示。

 var strObj = oPres.Slides[1].NotesPage.Shapes[2].TextFrame2.TextRange.MathZones.get_MathZones();
var str = strObj.Text;

以下是ppt输出为乱码文本的屏幕截图。 enter image description here

我只想阅读PowerPoint中的 Math Equation ,然后想以编程方式在word文档中编写它。这里首先我无法阅读数学方程式。建议我任何解决方案。

1 个答案:

答案 0 :(得分:1)

这里我得到了solution,这就是复制和粘贴的概念。

相关问题