Skip to main content
1-Visitor
January 10, 2012
Question

Method to use the IMathCADWorksheet::SetValue

  • January 10, 2012
  • 1 reply
  • 4077 views

Is there any workaround of using the IMathCADWorksheet::SetValue instead of accessing directly the XML file?

1 reply

1-Visitor
January 10, 2012

Karthik,

The SetValue method does not access the Mathcad XML file. SetValue talks to an executing Mathcad process with a worksheet loaded, whether it is visible or not is developers choice. If you want the SetValue changes saved to the XML file you will need to execute the SaveAs method as well before existing.

John

1-Visitor
January 10, 2012

Thank you John.

But the SetValue method of the Worksheet doesnt change anything in the active worksheet when I tried to execute the method from my C++ application. Is there any other method to the change the value in the mathcad worksheet? If there is any sample application it will be helpful for me.

Karthik

19-Tanzanite
January 10, 2012

As John says, SetValue binds the variable before any assignments in the worksheet. That means that any assignment will overwrite what you do with SetValue. This is, in my opinion, a very bad piece of design, but it's the way it works. You can either disable the assignment of the variable you are trying to set, or you could change the XML of the assignment by setting the MathInterface.XML property (the easiest way to find the region is to set a tag, and then search for the tag).