移动单元格的索引内容。 支持的平台:仅窗口 签名工 务 局: object.MoveContent nRow, nCol, nFromIndex, nToIndex
返回值(RetVal)无返回值。 言论没有额外的评论。 例子工 务 局: Sub Example_ContentChange() ' This example adds a table in model space ' and manipulates its contents ' Note: One content is created for each cell by default; ' this function need to be called only to create additional contents. Dim MyModelSpace As AcadModelSpace Set MyModelSpace = ThisDrawing.modelSpace Dim pt(2) As Double Dim MyTable As IAcadTable Dim sID As Long Dim newSID As Long Dim row As Long Dim col As Long ' Creates arbitrary cell points to check row = 2 col = 2 ' Creates the table with an arbitrary number of cells Set MyTable = MyModelSpace.AddTable(pt, 5, 5, 10, 30) If MyTable.IsEmpty(row, col) Then If MyTable.IsContentEditable(row, col) Then MsgBox "There is no content in the cell, but it is editable" End If End If ' Create some content in an arbitrary cell sID = MyTable.CreateContent(row, col, 8) MsgBox "The content ID is " & sID ' Move the content to another index MyTable.MoveContent row, col, sID, 4 ' Check that the content has been deleted MyTable.DeleteContent row, col If MyTable.IsEmpty(row, col) Then If MyTable.IsContentEditable(row, col) Then MsgBox "There is no content in the cell, but it is editable" End If End If ZoomExtents End Sub Visual LISP: (vl-load-com) (defun c:Example_ContentChange() ;; This example adds a table in model space ;; and manipulates its contents (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Note: One content is created for each cell by default; ;; this function need to be called only to create additional contents. (setq pt (vlax-3d-point 0 0 0)) ;; Creates arbitrary cell points to check (setq row 2 col 2) ;; Creates the table with an arbitrary number of cells (setq modelSpace (vla-get-ModelSpace doc)) (setq MyTable (vla-AddTable modelSpace pt 5 5 10 30)) (vla-SetTextHeight MyTable (+ acDataRow acHeaderRow acTitleRow) 1) (vla-Regen doc :vlax-true) (vla-ZoomExtents acadObj) (if (= (vla-IsEmpty MyTable row col) :vlax-true) (if (= (vla-IsContentEditable MyTable row col) :vlax-true) (alert "There is no content in the cell, but it is editable") ) ) ;; Create some content in an arbitrary cell (setq sID1 (vla-CreateContent MyTable row col 0)) (setq sID2 (vla-CreateContent MyTable row col 1)) (vla-SetTextString MyTable row col sID1 "Value1") (vla-SetTextString MyTable row col sID2 "Value2") (vla-Regen doc :vlax-true) (alert (strcat "The content IDs are " "\nValue1: " (itoa sID1) "\nValue2: " (itoa sID2))) ;; Move the content to another index (vla-MoveContent MyTable row col sID2 sID1) (vla-Regen doc :vlax-true) (alert "Content order changed") ; Check that the content has been deleted (vla-DeleteContent MyTable row col) (vla-Regen doc :vlax-true) (if (= (vla-IsEmpty MyTable row col) :vlax-true) (if (= (vla-IsContentEditable MyTable row col) :vlax-true) (alert "There is no content in the cell, but it is editable") ) ) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:22
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.