I'm looking for a c# library that will provide me with equation editor functionality. I'm not looking for a mathematics library to evaluate mathematical expressions.
Any suggestions?
I'm looking for a c# library that will provide me with equation editor functionality. I'm not looking for a mathematics library to evaluate mathematical expressions.
Any suggestions?
I'd recommend to use my fork of WPF-Math. I've contacted the original WPF-Math author and now officially maintaining the library for the modern frameworks. It's in a pretty good shape, actually.
It's an important, but not full solution, because WPF-Math is only a render, but not the full formula editor.
A few options exist:
wpf-math this is an API to render math based TeX to WFP, and there some limited code to take an Expression
and convert it to TeX.
Another option is to use MS Word, which has some quite advanced capabilities to take regular math formulas, as simple strings, and render them in nice formatting. Here's some code to play w/ that feature.
public class FormulaImageConverter: IDisposable
{
private Guid _guid;
private Application _wordApp;
private Document _doc;
private Range _range;
private string _saveName;
private string _extractPath;
public FormulaImageConverter(Application wordApp)
{
_wordApp = wordApp;
_guid = Guid.NewGuid();
string guidToString = _guid.ToString("N");
string saveNameBase = System.IO.Path.Combine(System.IO.Path.GetTempPath(), guidToString);
_saveName = saveNameBase + ".html";
_extractPath = saveNameBase + @"_files\image002.gif";
_wordApp.Visible = false;
_doc = _wordApp.Documents.Add();
_range = _doc.Range();
_range.Text = "5";
_doc.OMaths.Add(_range);
}
public byte[] ConvertFormulaToImage(string eq)
{
_range.Text = eq;
_doc.OMaths.BuildUp();
_doc.SaveAs(_saveName, WdSaveFormat.wdFormatHTML,Type.Missing,Type.Missing,false,Type.Missing,null,false);
return System.IO.File.ReadAllBytes(_extractPath);
}
public void Dispose()
{
_range = null;
_doc = null;
_wordApp.Documents.Close(WdSaveOptions.wdDoNotSaveChanges);
((_Application)_wordApp).Quit(false);
_wordApp = null;
System.IO.File.Delete(_saveName);
for (int i = 0; i < 2; i++)
{
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}
On a different note did you happen to check this http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9caca722-5235-401c-8d3f-9e242b794c3a
Perhaps you can try using this in C# using COM. Personally I haven't tried this but thought I could share my point on this