MastroLube 发表于 2022-7-5 18:06:48

Generate a word (.doc) with Vl

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

MastroLube 发表于 2022-7-5 18:54:32

Ok, I get the list of bookmarks in this way.. but hot to write inside them?

(setq pippo (vlax-get-property       (vlax-get-property wrdapp 'ActiveDocument)       'bookmarks))

Hippe013 发表于 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)
 

(setq bkmrks (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.
 

(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.
 

(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.
 

(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
页: [1]
查看完整版本: Generate a word (.doc) with Vl