embed python in ms-word?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • oyster

    embed python in ms-word?

    In my ms-word documnet, there are some calculation whihc I have to
    change due to different argumnet. is there any way to embed python
    code in word, so that I can write the following as a macro or
    something else, then the result (i.e. 2) is shown in the word
    documnet?

    def f(n):
    if n<2:
    return 1
    else:
    return f(n-1)+f(n-2)
    main()
    return 'fib(3)=%0i' % f(3)

    if that is impossible, does there exist such word-addons can do that? thanx
  • =?ISO-8859-1?Q?Gerhard_H=E4ring?=

    #2
    Re: embed python in ms-word?

    oyster wrote:
    In my ms-word documnet, there are some calculation whihc I have to
    change due to different argumnet. is there any way to embed python
    code in word, so that I can write the following as a macro or
    something else, then the result (i.e. 2) is shown in the word
    documnet?
    >
    def f(n):
    if n<2:
    return 1
    else:
    return f(n-1)+f(n-2)
    main()
    return 'fib(3)=%0i' % f(3)
    >
    if that is impossible, does there exist such word-addons can do that? thanx
    With Python and the win32 extensions you can write COM servers. These
    you can use from Visual Basic for Applications (VBA).

    But it's really only worth the effort if you're doing something less
    trivial than above ;-)

    -- Gerhard

    Comment

    Working...