Python论坛  - 讨论区

标题:[python-chinese] 如何通过win32com获得word里面的文本框

2008年01月01日 星期二 11:27

FireBird ygonic在gmail.com
星期二 一月 1 11:27:11 HKT 2008

¿´¿´Äܲ»ÄÜÓÃÂ¼ÖÆºêµÄ°ì·¨¸ú×Ùһϡ£

ÔÚ07-12-29£¬ywllyht <ywllyht在sina.com> дµÀ£º
>
>  ÎÒÏÖÔÚÏëͨ¹ýwin32comÐÞ¸ÄÒ»¸öwordÀïÃæµÄÒ»¸ö±í¸ñÄÚÈÝ¡£
>
> µ«ÊÇÕâ¸ö±í¸ñÊÇÔÚÒ»¸öÎı¾¿òÀïÃæµÄ,ËùÒÔÖ±½Óͨ¹ýdoc.Tables»ñÈ¡²»ÁË¡£
>
> import win32com
> from win32com.client import Dispatch, constants
>
> msword = Dispatch('Word.Application')
> doc  = msword.Documents.Open(FileName="E:/test1.doc")
> print "number of tables =",len(doc.Tables)
>
> >>number of tables = 0
>
>
> ÎҲ²âÊDZØÐëÏÈ»ñÈ¡µ½Õâ¸öÎı¾¿ò£¬È»ºó½øÒ»²½²ÅÄÜ»ñÈ¡µ½Õâ¸ö±í¸ñ¡£µ«ÊDz»ÖªµÀÈçºÎ»ñÈ¡.
>
> лл!
>
>
>
>
>
>
>
>
>
>
>  ------------------------------
>  ywllyht
> 2007-12-29
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080101/a6d925a9/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月01日 星期二 21:30

刀巴虫子 acestrong在gmail.com
星期二 一月 1 21:30:31 HKT 2008

这是个好办法~

在08-1-1,FireBird <ygonic在gmail.com> 写道:
>
> 看看能不能用录制宏的办法跟踪一下。
>
> 在07-12-29,ywllyht <ywllyht在sina.com> 写道:
> >
> >  我现在想通过win32com修改一个word里面的一个表格内容。
> >
> > 但是这个表格是在一个文本框里面的,所以直接通过doc.Tables获取不了。
> >
> > import win32com
> > from win32com.client import Dispatch, constants
> >
> > msword = Dispatch('Word.Application')
> > doc  = msword.Documents.Open(FileName="E:/test1.doc")
> > print "number of tables =",len(doc.Tables)
> >
> > >>number of tables = 0
> >
> >
> > 我猜测是必须先获取到这个文本框,然后进一步才能获取到这个表格。但是不知道如何获取.
> >
> > 谢谢!
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >  ------------------------------
> >  ywllyht
> > 2007-12-29
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
Best Regards!

Ace Strong

==================================================
Nanjing University of Aeronautics and Astronautics.
College of Civil Aviation
Tao Cheng
E-mail: acestrong在gmail.com ;acestrong在nuaa.edu.cn
Tel: 86-025-84892273
==================================================
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20080101/bd9548c3/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号