Jump to content

MSWORD, Normal and Bold on the same line


Recommended Posts

Posted

How do normal and bold text on the same line?

 

>>> NORMAL, NEGRITO, NORMAL.

 

(vl-load-com) 
(IF (NOT TBLWORD)
   (PROGN
   (SETQ TBLWORD (STRCAT #DRV "MSWORD.OLB"))
   (vlax-import-type-library 
        :tlb-filename TBLWORD 
        :methods-prefix "VBWORDm-" 
        :properties-prefix "VBWORDp-" 
        :constants-prefix "VBWORDc-" 
   )
   )
)
(SETQ VBWORD (vlax-get-or-create-object "Word.Application")) 
(vla-put-visible VBWORD :vlax-true)
(SETQ DOCS (vla-get-documents VBWORD)) 
(setq DOC  (VBWORDm-add DOCS))
(setq range (VBWORDp-get-range (VBWORDp-get-last (VBWORDp-get-paragraphs DOC)))) 

(VBWORDp-put-name (VBWORDp-get-font range ) "COURIER NEW") 
(VBWORDp-put-size (VBWORDp-get-font range ) 18)
;
(VBWORDp-put-bold range 1)
(VBWORDp-put-underline range VBWORDc-wdUnderlineNone) 
(VBWORDm-InsertAfter range "MEMORIAL DESCRITIVO\n")
(VBWORDm-InsertAfter range "\n")
(setq range (VBWORDp-get-range (VBWORDp-get-last (VBWORDp-get-paragraphs DOC)))) ;?????????????
(VBWORDp-put-bold range 0)
(VBWORDm-InsertAfter range "NORMAL, ")
(setq range (VBWORDp-get-range (VBWORDp-get-last (VBWORDp-get-paragraphs DOC)))) ;?????????????
(VBWORDp-put-bold range 1)
(VBWORDm-InsertAfter range "NEGRITO, ")
(setq range (VBWORDp-get-range (VBWORDp-get-last (VBWORDp-get-paragraphs DOC)))) ;?????????????
(VBWORDp-put-bold range 0)
(VBWORDm-InsertAfter range "NORMAL.")

 

Thank you.

Posted

As I had no response to my request I have tried to solve this problem myself I was very necessary and after many many attempts I got the solution and I'm also interested in showing to whom.

 

;;;
(vl-load-com) 
(setq MSWORDAPP (vlax-get-or-create-object "Word.Application")) 
(vla-put-visible MSWORDAPP :vlax-true) 
(setq docs (vla-get-documents MSWORDAPP)) 
(SETQ doc  (vlax-invoke-method docs 'Add))
(setq paragraphs (vlax-get-property doc 'Paragraphs)) 
(setq pg (vlax-get-property paragraphs 'last)) 
(setq range (vlax-get-property pg 'range)) 
(vlax-put-property (vlax-get-property range 'font) 'name  "COURIER NEW") 
(vlax-put-property (vlax-get-property range 'font) 'size  15)
;
(setq WDRANGE (vlax-get-property (vlax-get-property (vlax-get-property MSWORDAPP 'ActiveDocument) 'WORDS) 'last)) 
(vlax-invoke-method range 'InsertAfter "TEXTO NEGRITO, ")
(vlax-put-property range 'bold 1)
;
(setq WDRANGE (vlax-get-property (vlax-get-property (vlax-get-property MSWORDAPP 'ActiveDocument) 'WORDS) 'last)) 
(vlax-invoke-method range 'InsertAfter "TEXTO NORMAL, ") 
(vlax-put-property WDrange 'bold 0)
;
(setq WDRANGE (vlax-get-property (vlax-get-property (vlax-get-property MSWORDAPP 'ActiveDocument) 'WORDS) 'last)) 
(vlax-invoke-method range 'InsertAfter "TEXTO NEGRITO.\n")
(vlax-put-property WDrange 'bold 1)
;;;

 

Thank you.

 

OK.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...