topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 2:58 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: an ole component for calculation?  (Read 5572 times)

oyster

  • Participant
  • Joined in 2005
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
an ole component for calculation?
« on: September 07, 2008, 12:08 AM »
During my work, I often write documnets in ms-word. But the doc has many numbers in it, which need to be calculated via a some complex function and to be modified frequently.

Is there a method to write an ole control, so that
1. when I choose menu 'insert->object' in ms-word, a window is popped up, then I can type in the calculation steps in some program language
[attach=#1][/attach]

2.when I close the 'fake ms-word add-in for calculation' window, the result (here, it is 8) is shown in the doc
[attach=#2][/attach]

3.when I double-click the result 8, I can view/edit the code again like what I do in step 1

4.the prg is stored in DOC file too


mathtype equation ( http://www.dessci.com/mathtype ) is such kind of thing, but only for displaying nice equation

I don't think vba is a good answer, the main reason is: the vba code has an incompact link with its result in the documnet. If there are many calculation, I have to remember which function yields which result, when I have to modify, I must browse all VBA function name

for the calculation part, I prefer to python(www.python.org) interpreted langauge for the following reasons:
1.the pythonxx.dll supplies many math operations and functions(+-*/, sin/cos/..., log, pi, pow etc), which is only about 1.7M
2.if more math function is need, scipy+numpy can be used, however ~23M space will be used; or we can use http://code.google.com/p/sympy/  which is smaller but with limited function

I can write program in FB, python and a little C. Can any one tell me
1.is this kind of software possible
2.which technology is used? if there are some simple code demo, it will be better.

thanx

tide

  • Supporting Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 84
    • View Profile
    • Donate to Member
Re: an ole component for calculation?
« Reply #1 on: September 07, 2008, 04:09 PM »
Something like AutoIt or AutoHotKey should be able to handle that. They have eval() and execute() functions that can perform the calculations and good clipboard functionality that will let you retrieve the expression to be calculated and paste the result back into the application (MS Word, e.g.).

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: an ole component for calculation?
« Reply #2 on: September 07, 2008, 06:38 PM »
I'm not saying autohotkey is a good solution, I'd just like to point out that AHK doesn't have a "pure" eval funcion, if autoit does, then it probably is a better option.

Target

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,832
    • View Profile
    • Donate to Member
Re: an ole component for calculation?
« Reply #3 on: September 07, 2008, 06:59 PM »
why not just insert a spreadsheet??

you only need to show a few cells, and you have the power of excel at you're disposal