乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 4|回复: 2

[编程交流] Generate a word (.doc) with Vl

[复制链接]

44

主题

139

帖子

95

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
221
发表于 2022-7-5 18:06:48 | 显示全部楼层 |阅读模式
Hello guys, I need a little help please..
 
I found this good answer by fixo:
 
 
but it doens't fit at best the use I need.
 
I want do to something as we do with bookmarks (put something inside a sentence of a template document and save a copy).
 
With this code I'm only able to put a sentence in first place of a row..
 
Thanks guys
回复

使用道具 举报

44

主题

139

帖子

95

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
221
发表于 2022-7-5 18:54:32 | 显示全部楼层
Ok, I get the list of bookmarks in this way.. but hot to write inside them?
  1. (setq pippo (vlax-get-property       (vlax-get-property wrdapp 'ActiveDocument)       'bookmarks))
回复

使用道具 举报

20

主题

338

帖子

323

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2022-7-5 19:18:57 | 显示全部楼层
I've noticed that this is an older post, but I looked into it anyways. I am not quite certain as to what you want to do, but I'll try and point you in the right direction.
 
So you get the bookmarks collection with your last code. (I will change the symbol name for sake of clarity)
 
  1. (setq [color="red"]bkmrks[/color] (vlax-get-property (vlax-get-property wrdapp 'ActiveDocument) 'Bookmarks))
 
Now that you have the bookmarks collection, run a dump on it... See what you can do with it.
 
  1. (vlax-dump-object bkmrks T)
 
; Bookmarks: nil
; Property values:
;   Application (RO) = #
;   Count (RO) = 2
;   Creator (RO) = 1297307460
;   DefaultSorting = 0
;   Parent (RO) = #
;   ShowHidden = 0
;   _NewEnum (RO) = #
; Methods supported:
;   Add (2)
;   Exists (1)
;   Item (1)
 
Now you want to get a bookmark. Notice the 'Item' method? The (1) means it requires one argument.
 
  1. (setq bm (vlax-invoke-method bkmrks 'Item 1))
 
Now that you have a bookmark.... Run a dump on it to see what you can do with it.
 
  1. (vlax-dump-object bm T)
 
; Bookmark: nil
; Property values:
;   Application (RO) = #
;   Column (RO) = 0
;   Creator (RO) = 1297307460
;   Empty (RO) = -1
;   End = 0
;   Name (RO) = "Book_Mark_One"
;   Parent (RO) = #
;   Range (RO) = #
;   Start = 0
;   StoryType (RO) = 1
; Methods supported:
;   Copy (1)
;   Delete ()
;   Select ()
 
I hope that this helps you at least a little bit.
 
regards,
 
Hippe013
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-12 19:27 , Processed in 0.555791 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表