马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 Lispboy 于 2016-7-19 09:03 编辑
- (defun XD::Table:Make (pt rows rowheight cols colwidth / blk cdata cel e el height i j p1 p2 p3 p4 pj pj1 pnt typ width xdir ydir)
- (defun _drawrec (pnt width height)
- (setq xdir (getvar "ucsxdir")
- ydir (getvar "ucsydir")
- p1 pnt
- p2 (mapcar
- '-
- p1
- (xdrx_vector_product ydir rowHeight)
- )
- p3 (mapcar
- '+
- p2
- (xdrx_vector_product xdir colwidth)
- )
- p4 (mapcar
- '+
- p1
- (xdrx_vector_product xdir colwidth)
- )
- )
- (xdrx_polyline_make p1 p2 p3 p4 t)
- )
- (if (not (setq typ (xd::symbol:get '#xd-var-global-table-type)))
- (progn
- (XD::Table:SetType "X")
- (setq typ "X")
- )
- )
- (if (= typ "X")
- (progn
- (setq pj pt)
- (setq el nil)
- (setq i 0)
- (xdrx_setmark)
- (repeat rows
- (setq pj (mapcar
- '-
- pt
- (list 0 (* i rowheight) 0)
- )
- )
- (setq j 0)
- (setq cel nil)
- (repeat cols
- (setq pj1 (mapcar
- '+
- pj
- (list (* j colwidth) 0 0)
- )
- )
- (setq e (_drawrec pj1 colwidth rowHeight))
- (xdrx_object_setXrecord e "no" (list (itoa i) (itoa j)))
- (xdrx_object_setXrecord e "MergeCell" 0)
- (setq el (cons e el))
- (setq j (1+ j))
- (setq cel (cons e cel))
- )
- (setq cdata (list i cel))
- (setq i (1+ i))
- )
- (setq blk (xdrx_block_make (XD::Table:GetUniqueName)
- (xdrx_getss) pt t
- )
- )
- (setq margin (XD::Table:GetVertCellMargin))
- (xdrx_object_setxrecord blk "NumRows" rows)
- (xdrx_object_setxrecord blk "NumColumns" cols)
- (xdrx_object_setxrecord blk "CellMargin" margin)
- (xdrx_xdata_setDirection blk "direction" xdir)
- )
- (progn
- (setq blk (xdrx_table_make pt rows rowheight cols colwidth))
- )
- )
- blk
- )
|