I need to get access to Equation Editor that's built in Excel 2010. In Word2010 it's quite simple as it provides OMath interface to access it via C# or VBA. There's no such thing in Excel eventhough it's possible to insert equations this way. Has anyone solved this problem ?
I need to extract the equation from the eqution object in a text way (no metter if it's Latex, MATHML or any other language. It just has to be a single string)
Of course I can use MathType to do this (Actually I've alredy done this with MathType) but I don't want to force the User to buy MathType as Excel has built in feature that would do the trick.
Have you tried adding an OLE object first, as mentioned in this link?
http://www.techyv.com/questions/it-possible-equation-editor-vba-excel-2010
I don't have an enormous amount of experience with Excel's equation behaviour but it seems Excel doesn't use the OMath object. As far as I understand:
You can add a new Equation with:
ActiveSheet.OLEObjects.Add(ClassType:="Equation.3", Link:=False, DisplayAsIcon:=False)
And subsequently, you can access these objects using the OLEObjects collection:
ActiveSheet.OLEObjects.Item(1)
Related
I have to create a function in C# allowing to calculate Excel formulas entered in a string:
for example :
ROUND(COUNTIF(['YES', 'NO'],'YES')*(100/4),1)
I absolutely have to use a free library, but I can't find anything to do so in C#.
Has anyone come across this problem before ?
Thanks for your help
Explications of the app context :
This function receives as a parameter a string which has already been generated on another application over which I do not have control.
the need is to find a way evaluate this kind of string containing some Excel functions.
EPPlus v4 is LGPL. It can create Excel files but not execute them AFAIK. But you could automate Excel afterwards.
As #DS_London said: it is a weird use case, are you sure you got it right?
I have an Excel file with many different, but very similar, userforms.
When I click on a cell in my worksheet a specific userform will open according to the cell text.
I wanted to know if there is a way to add a C# form to Excel which will behave as a userform? Since the visual studio interface is much simpler and a lot more generic than VB.
I know you can create C# add-in's for excel, but these are used to add buttons, ribbons, etc.
what I need is a way to add a dll which will be activated when clicking on a cell, this dll must be easy to update, and it should not include installation (like the add-in's).
I got the following answer from a different forum:
You have some possibilities
1) Actually Excel (and practically all Office application) support Add-ins. Thus you could make a legacy excel add-in. There are several tutorials out there, but this is not the simplest one.
2) An other interesting approach exceldna.codeplex.com/[^]
3) You can call managed code from excel vba, but it is not the wisest one, since vba runs in a rather undeterministic way. Start here: richnewman.wordpress.com/2007/04/15/…^]
4) Interop Forms Toolkit[^] might be also an alternative – user2134909 2 mins ago edit
I haven't thoroughly examined them, but they seem promising
I am porting some PowerPoint VBA macros into C# inside a VSTO add-on which automate certain tasks.
The macros were written for PP 2003 and I'm writing the VSTO add-on with PP 2010 as a target. The macros make heavy use of AutoShape-manipulation through the AutoShape.Adjustments object.
In VBA under 2003 i would access the X-Axis position of the "line-target" of a Legend-with-Line autoshape like this:
shape.Adjustments.Item(1) = someFloat
In c#/VSTO this seems to have changed to
shape.Adjustments[6] = someFloat;
There is now .Item collection in c#/VSTO.
Does anyone know where these values are documented, and most importantly, where they are documented for 2010?
Or is this all caused by switching to VSTO? If so, why would they choose to have you use different index numbers?
For now i'm stuck to manually test every Adjustments index in C# one after the other until i find the one that corresponds to the target in VBA.
I've never run across any documentation that explains what the various adjustments do and which shapes they apply to.
As to the difference in indexing/syntax, a wild guess:
In VBA, Shape.Adjustments.Item(x) and Shape.Adjustments(x) are equivalent; the default property for Adjustments (as with most collections) is .Item, so it's not strictly necessary to explicitly use it.
Perhaps in .NET, you index into all of the Adjustments properties, since (as I understand it) there's no longer a default/implicit property. In other words, perhaps what you're seeing is an offset that will be consistent for all shapes.
Is there anyway to get the next sequential number or variable in excel if data is already entered in a certain column of excel. I have tried a couple things, but know I am taking a wrong approach. If anyone knows how to do this I would greatly appreciate it.
MLB028Z-MTRSPR-B-A
MLB028Z-MTRSPR-B-B
MLB028Z-MTRSPR-B-C
MLB028Z-MTRSPR-B-D
So on and So on
You could use Excel OLE automation to fire up an instance of Excel and use that to populate the next value and then read that out.
That said OLE automation is like any good movie, there is many a trap lying in wait for the hero in the story, and I would only ever do this if you had no other choice.
Thankfully you do: Solver Foundation or Baynes Algorithms (+ loops)
Okey here's the situation: I've got a microsoft excel macro in vb that I want to call using C#. I've already tried creating a workbook using Microsoft.Office.Interop.Excel, however I don't want to have to run an excel process to run the macro.
So then I thought why not make a vb class library with my code in it so i can still run it and have a clean dll file. It's not needed to keep any sheet related functions since the macro reads a .lua(UTF-8)text file with some advanced regex functions that I just can't get recreated in C#.
Is it possible for me to make the library use interop as well so i can just call the function in my C#? Any examples would be greatly appreciated.
First I assume you are working with VB6 and not VB Script?
I have never worked with VB 6 or earlier, but I think your best be will be to create a COM object and then you can call the COM object from .NET using C#. Here is a quick link I found through BING that I believe will help you get started if this in an option for you.
Walkthrough: Implementing Inheritance with COM Objects (Visual Basic)
I noticed these two statements:
I don't want to have to run an excel process to run the macro
and
the macro reads a .lua(UTF-8)text file with some advanced regex functions that I just can't get recreated in C#
Those two goals are incompatible. The macro relies on excel functions to run. The only way provided by Microsoft to accomplish this is to completely load the Excel app. There is no way to only run the macro.