[IronPython] word Automation
Anthony Tarlano
mailinglist.account at gmail.com
Mon May 9 12:52:43 CEST 2005
That should have read "you should not just translate the..."
Anthony
On 5/9/05, Anthony Tarlano <mailinglist.account at gmail.com> wrote:
>
> Hi,
>
> Yes it should work, but I don't have the correct assembly to be able to
> test it.
>
> You should remember that you should just translate the code from VB to
> IronPython. IronPython is a dynamically bound language, so you don't have to
> do things like declaring the local variable oWord (i.e. 'oWord =
> wordApp.ApplicationClass')
>
> In python an variable object is bound to a type upon assignment to an
> Rvalue object
>
> If you tell me how to get the assembly having "
> Microsoft.Office.Interop.Word" I will try it out for you and post back the
> code snippet.
>
> Anthony
>
> On 5/9/05, kbond <kbond at free.fr> wrote:
> >
> > Hello,
> >
> > First congratulation of all, thank you for the tremendous work that you
> > have already done.
> > I am looking forward the day where I will be able to translate all my MS
> > office automation in python scripts.
> >
> > Am I correct I say that iron python will allow it?
> >
> > So today I try to give it a try but unfortunatly withou success till
> > now.
> > I am trying to translate this simple vb.net <http://vb.net> module to
> > iron python, is
> > there someone reading this list that can help me?
> >
> > the VB
> >
> > Imports word = Microsoft.Office.Interop.word
> > Module Module1
> >
> > Sub Main()
> > Dim oWord As Word.ApplicationClass
> >
> > 'Start Word and open the document.
> > oWord = CreateObject("Word.Application")
> > oWord.Visible = True
> > oWord.Documents.Open("C:\tmp\Doc1.doc")
> >
> > 'Run the macros.
> > 'oWord.Run("DoKbTest")
> > 'oWord.Run("DoKbTestWithParameter", "Hello from VB .NET Client")
> >
> > 'Quit Word.
> > oWord.Quit()
> > System.Runtime.InteropServices.Marshal.ReleaseComObject(oWord)
> > oWord = Nothing
> >
> > End Sub
> >
> > End Module
> >
> > Iron Python
> >
> > import sys
> > sys.LoadAssemblyByName("Microsoft.Office.Interop.Word")
> > import Microsoft.Office.Interop.Word as wordApp
> > oWord = wordApp.ApplicationClass
> >
> > oWord = CreateObject("wordApp.Application")
> > oWord.Visible = True
> > oWord.Documents.Open("C:\tmp\Doc1.doc")
> >
> > oWord.Quit()
> > System.Runtime.InteropServices.Marshal.ReleaseComObject (oWord)
> > oWord = Nothing
> >
> > thank you
> >
> > _______________________________________________
> > users-ironpython.com <http://users-ironpython.com> mailing list
> > users-ironpython.com at lists.ironpython.com
> > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20050509/e51429b1/attachment.html>
More information about the Ironpython-users
mailing list