龙城飞将36 发表于 2014-12-4 11:03 - (defun c:tt1()
- (xd::Begin)
- (setq ss (ssget '((0 . "LWPOLYLINE")))
- ss1 (mapcar '(lambda (X) (append (xdrx_Pickset->ents (ssget "_CP" (xdrx_entity_getstretchpoint X) '((0 . "Text")))) (list X) )) (xdrx_Pickset->ents ss))
- ss1 (vl-sort ss1 (function(lambda (s1 s2) (> (cadr(xdrx_GetPropertyValue (car s1) "position")) (cadr(xdrx_GetPropertyValue (car s2) "position"))))))
- ss2 (mapcar '(lambda (X) (list (xdrx_GetPropertyValue (cadr x) "Textstring")
- (xdrx_GetPropertyValue (car x) "Textstring")
- (xdrx_GetPropertyValue (caddr x) "area"))
- )
- ss1)
- )
- (if (setq pt (getpoint "\n表格插入点: "))
- (progn
- (setq lst (cons '("人名" "数量" "面积") ss2)
- tb (xdrx_table_make
- pt
- (+ 2 (length lst))
- 8
- 4
- 6
- )
- ; _制造表格
- colwidth (mapcar '(lambda (x) x)
- '(30 30 40)
- )
- ; _列宽
- )
- (XD::Table:begin tb)
- (mapcar
- '(lambda (x)
- (xdrx_table_settextheight tb x 4)
- )
- '(1 2 4)
- ) ; _设置所有 Cell 文字高度
- (xdrx_table_setalignment tb 1 5) ; _数据区文字对齐方式
- (xdrx_table_setgridvisibility tb 2 59 nil) ; _隐藏 Title 边
- (mapcar
- '(lambda (x y)
- (xdrx_table_setcolumnwidth tb x y)
- )
- '(0 1 2)
- colwidth
- )
- (setq i 0)
- (mapcar
- '(lambda (x / j)
- (setq j -1
- i (1+ i)
- )
- (mapcar '(lambda (a)
- (xdrx_table_settextstring
- tb
- i
- (setq j (1+ j))
- (if (eq (type a) 'STR)
- a
- (vl-princ-to-string a)
- )
- )
- )
- x
- )
- )
- lst
- ) ; 构造Cell文字
- (xdrx_table_settextstring tb 0 0 "统计表")
- (XD::Table:end tb)
- )
- )
- (XD::End)
- (princ)
- )
|