How to read Math Equations from Powerpoint and write it to Word document in C#

随声附和 提交于 2019-12-12 00:08:43

问题


I am developing a PowerPoint extraction tool since march 2014 which extracts the words or paragraphs from PowerPoint and write it to word document. It has been developed. During the testing. we found that Math Equation has not being fetched from PowerPoint slide. I am using Microsoft.Office.Interop.Powerpoint.dll library. i am reading file such as given below.

  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;

Here is screenshot of input of PPT.

but i want to read math equation which have in the PowerPoint slide. i tried to use these MathZones and get_MathZones but i didn't get much about it that how to use MathZones proerety. On other hand, get_MathZones method gives the same garbled text. i used the get_MathZones method such as given below.

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

Here is screenshot of output of ppt as garbled text.

I just want to read Math Equation from PowerPoint then want to write it in word document programatically. Here firstly i am not able to read Math Equation. Suggest me any solutions.


回答1:


Here i got the solution and that is the concept of Copy and Paste.



来源:https://stackoverflow.com/questions/28343914/how-to-read-math-equations-from-powerpoint-and-write-it-to-word-document-in-c-sh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!