为了在不访问表OLB的情况下优化我的程序对MSWORD的访问,需要修改以下代码中的一行:
- ;(IF (NOT TBLMSWORD)
- ; (PROGN
- ; (SETQ TBLMSWORD (STRCAT #DRV "MSWORD.OLB"))
- ; (vlax-import-type-library
- ; :tlb-filename TBLMSWORD
- ; :methods-prefix "MSWORDm-"
- ; :properties-prefix "MSWORDp-"
- ; :constants-prefix "MSWORDc-"
- ; )
- ; )
- ;;;
- (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))
- ;(mswp-put-alignment (mswp-get-ParagraphFormat range) mswc-wdAlignParagraphCenter)
- [b](vlax-put-property (vlax-get-property range 'Alignment) 'ParagraphFormat 'wdAlignParagraphCenter) ;<< Error in this line[/b]
- (vlax-invoke-method range 'InsertAfter "TEXTO NEGRITO, ")
- ;;;
或:
- (vlax-put-property (vlax-get-property range 'Alignment) 'ParagraphFormat 1)
|