At the time of converting from word file to html my equations which are in the word document file was convert into image.
Expand|Select|Wrap|Line Numbers
- Globals.ThisAddIn.Application.ActiveDocument.Select();
- Microsoft.Office.Interop.Word.Document doc = Globals.ThisAddIn.Application.ActiveDocument;
- string result = Path.GetTempPath();
- string tmpFileName = Globals.ThisAddIn.Application.ActiveDocument.FullName;
- doc.SaveEncoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUSASCII;
- if (File.Exists(result + "temp.html"))
- {
- File.Delete(result + "temp.html");
- }
- doc.SaveAs(result + "temp.html", WdSaveFormat.wdFormatFilteredHTML);
- doc.Close(Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges);
- HtmlAgilityPack.HtmlDocument mangledHTML = new HtmlAgilityPack.HtmlDocument();
- mangledHTML.Load(result + "temp.html");
- if (File.Exists(result + "newtemp.html"))
- {
- File.Delete(result + "newtemp.html");
- }
- mangledHTML.Save(result + "newtemp.html");
- // Remove standalone CRLF
- string badHTML = File.ReadAllText(result + "newtemp.html");
- badHTML = badHTML.Replace("\r\n\r\n", "ackThbbtt ");
- badHTML = badHTML.Replace("\r\n", " ");
- badHTML = badHTML.Replace("ackThbbtt ", "\r\n");
- badHTML = badHTML.Replace('�', ' ');
- if (File.Exists(result + "finaltemp.html"))
- {
- File.Delete(result + "finaltemp.html");
- }
- File.WriteAllText(result + "finaltemp.html", badHTML);
- // Clean up temp files, show the finished result in Notepad
- File.Delete(result + "temp.html");
- File.Delete(result + "newtemp.html");
- Microsoft.Office.Interop.Word.Document orignalDoc = new Document();
- orignalDoc = Globals.ThisAddIn.Application.Documents.Open(tmpFileName);
To represent it as it is I need to convert it html format and the by sepreting all paragraphs I can store it in database. But when in my word document has paragraph which have equations then
Expand|Select|Wrap|Line Numbers
- Globals.ThisAddIn.Application.ActiveDocument.Select();
- Microsoft.Office.Interop.Word.Document doc = Globals.ThisAddIn.Application.ActiveDocument;
- string result = Path.GetTempPath();
- string tmpFileName = Globals.ThisAddIn.Application.ActiveDocument.FullName;
- doc.SaveEncoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUSASCII;
So I tried to convert this equations in MATHML form but I couldn’t solve this.