- UID
- 5280
- 积分
- 9466
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ; Get* - (tableobj method) gets the property for the specified row
- ; Get*2 - (tableobj method) gets the property for the specified cell
-
- ; GetTextHeight Method (ActiveX) - Returns the text height for the specified row type.
- ; RetVal = object.GetTextHeight(rowType)
-
- ; GetTextHeight2 Method (ActiveX) - Gets the text height for a cell.
- ; RetVal = object.GetTextHeight2(nRow, nCol, nContent) ; VBA: RetVal = object.GetTextHeight2(strCellStyle)
-
- ; Extracting the properties from a picked table cell into assoc list.
- ; For easier understanding and table manipulation
- ; Usage: VLIDE's console -> (TableCell_ExtractProps) -> Inspect -> Pretty Print & Dig into the inspect window
- (defun TableCell_ExtractProps ( / _hit-test GetAcadTableObjects )
-
- (defun _hit-test ( pt lst ) ; Lee Mac
- (if (and (vl-consp pt) (vl-every 'numberp pt))
- (vl-some
- (function
- (lambda ( o / r c )
- (if (eq :vlax-true (vla-HitTest o (vlax-3D-point (trans pt 1 0)) (vlax-3D-point (trans (getvar 'VIEWDIR) 1 0)) 'r 'c)) (list o r c) )
- )
- )
- lst
- )
- )
- ); defun _hit-test
-
- (defun GetAcadTableObjects ( / SS i o L )
- (if (setq SS (ssget "X" '((0 . "ACAD_TABLE")))) (repeat (setq i (sslength SS)) (setq L (cons (setq o (vlax-ename->vla-object (ssname SS (setq i (1- i))))) L)) ))
- )
-
- (
- (lambda ( / RowEnums GridEnums CEMenums MARenums cell tblobj crow ccol r )
-
- ; I'll check on the "GetDataType" and "GetCellDataType" later
-
- ; NOTE: Excluded the methods that require this argument (Because I have no idea what is this)
- ; But I guess that its the CellTextStyle's name [STR] argument, reading from the "GetTextHeight2 Method (ActiveX)" documentation
- ; nContent
- ; Access: Input-only
- ; Type: Long
- ; The content index in the table cell.
-
-
- (setq RowEnums '(acDataRow acHeaderRow acTitleRow acUnknownRow)) ; AcRowType enum
- (setq GridEnums
- '(
- acHorzBottom ; Top or bottom horizontal grid line, based on the flow direction.
- acHorzInside ; All horizontal grid lines, excluding the top and bottom lines.
- acHorzTop ; Top or bottom horizontal grid line, based on the flow direction.
- acInvalidGridLine ; An invalid grid line.
- acVertInside ; All the vertical grid lines, excluding the farthest left and farthest right grid lines.
- acVertLeft ; Farthest left grid line.
- acVertRight ; Farthest right grid line.
- )
- ); setq GridEnums
-
- (setq CEMenums ; Type: AcCellEdgeMask enum
- '(
- acBottomMask ; Bottom edge index of the cell.
- acLeftMask ; Left edge index of the cell.
- acRightMask ; Right edge index of the cell.
- acTopMask ; Top edge index of the cell.
- )
- ); setq CEMenums
-
- (setq MARenums ; AcCellMargin enum
- '(
- acCellMarginBottom
- acCellMarginHorzSpacing
- acCellMarginLeft
- acCellMarginRight
- acCellMarginTop
- acCellMarginVertSpacing
- )
- ); setq MARenums
-
- (and
- (setq cell (_hit-test (getpoint "\nPick table cell: ") (GetAcadTableObjects))) ; returns smth like: (#<VLA-OBJECT IAcadTable 000000a23c0b7e48> 2 0)
- (mapcar 'set '(tblobj crow ccol) cell)
- (setq r
- (append
-
-
- ; GetAlignment (1)
- ; GetBackgroundColor (1)
- ; GetBackgroundColorNone (1)
- ; GetBreakHeight (1)
- ; GetColumnName (1)
- ; GetColumnWidth (1)
- ; GetContentColor (1)
- ; GetFormat (1)
- ; GetMinimumColumnWidth (1)
- ; GetMinimumRowHeight (1)
- ; GetRowHeight (1)
- ; GetRowType (1)
- ; GetTextHeight (1)
- ; GetTextStyle (1)
- (mapcar
- (function
- (lambda (mtd)
- (cons mtd
- (mapcar
- (function
- (lambda (enum / tmp)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (list tblobj mtd (eval enum))))))
- (cons enum tmp)
- (cons enum (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda (enum)
- ); function
- RowEnums
- ); mapcar
- ); list
- ); lambda (mtd)
- ); function
- '(GetAlignment
- GetBackgroundColor
- GetBackgroundColorNone
- GetContentColor
- GetFormat
- GetTextHeight
- GetTextStyle
- ); list
- ); mapcar
- (mapcar
- (function
- (lambda (mtd / tmp)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (list tblobj mtd ccol)))))
- (cons mtd tmp)
- (cons mtd (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda
- ); function
- '(GetColumnName
- GetColumnWidth
- GetMinimumColumnWidth
- ); list
- ); mapcar
- (mapcar
- (function
- (lambda (mtd / tmp)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (list tblobj mtd crow)))))
- (cons mtd tmp)
- (cons mtd (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda
- ); function
- '(GetRowType
- GetRowHeight
- GetMinimumRowHeight
- ); list
- ); mapcar
-
-
- ; GetAttachmentPoint (2)
- ; GetAutoScale (2)
- ; GetBlockRotation (2)
- ; GetBlockScale (2)
- ; GetBlockTableRecordId (2)
- ; GetCellAlignment (2)
- ; GetCellBackgroundColor (2)
- ; GetCellBackgroundColorNone (2)
- ; GetCellContentColor (2)
- ; GetCellFormat (2)
- ; GetCellState (2)
- ; GetCellStyle (2)
- ; GetCellStyleOverrides (2)
- ; GetCellTextHeight (2)
- ; GetCellTextStyle (2)
- ; GetCellType (2)
- ; GetCellValue (2)
- ; GetContentLayout (2)
- ; GetContentType (2)
- ; GetFieldId (2)
- ; GetGridColor (2)
- ; GetGridLineWeight (2)
- ; GetGridVisibility (2)
- ; GetText (2)
- ; GetTextRotation (2)
- ; IsContentEditable (2)
- ; IsEmpty (2)
- ; IsFormatEditable (2)
- ; IsMergeAllEnabled (2)
- (mapcar
- (function
- (lambda (mtd / tmp)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (append (list tblobj mtd) (cdr cell))))))
- (cons mtd tmp)
- (cons mtd (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda
- ); function
- '(GetAttachmentPoint
- GetAutoScale
- GetBlockRotation
- GetBlockScale
- GetBlockTableRecordId
- GetCellAlignment
- GetCellBackgroundColor
- GetCellBackgroundColorNone
- GetCellContentColor
- GetCellFormat
- GetCellState
- GetCellStyle
- GetCellStyleOverrides
- GetCellTextHeight
- GetCellTextStyle
- GetCellType
- GetCellValue
- GetContentLayout
- GetContentType
- GetFieldId
- GetText
- GetTextRotation
- IsContentEditable
- IsEmpty
- IsFormatEditable
- IsMergeAllEnabled
- ); list
- ); mapcar
-
- (mapcar
- (function
- (lambda (mtd)
- (cons mtd
- (mapcar
- (function
- (lambda (enum)
- (cons enum
- (mapcar
- (function
- (lambda ( genum / tmp ) ; object.Method(gridLineType, rowType)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (list tblobj mtd (eval genum) (eval enum))))))
- (list genum tmp)
- (list genum (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda ( genum )
- ); function
- GridEnums
- ); mapcar
- ); cons
- ); lambda (enum)
- ); function
- RowEnums ; GridEnums
- ); mapcar
- ); list
- ); lambda (mtd)
- ); function
- '(GetGridColor
- GetGridLineWeight
- GetGridVisibility
- ); list
- ); mapcar
-
-
- ; GetAutoScale2 (3)
- ; GetBlockAttributeValue (3) ; RetVal = object.GetBlockAttributeValue(row, col, attdefId) ; - I do this, but not in this code, hehe
- ; GetBlockTableRecordId2 (3)
- ; GetCellExtents (3)
- ; GetCellGridColor (3)
- ; GetCellGridLineWeight (3)
- ; GetCellGridVisibility (3)
- ; GetContentColor2 (3)
- ; GetDataFormat (3)
- ; GetDataType (3) ; EXCLUDED!!!
- ; GetFieldId2 (3)
- ; GetFormula (3)
- ; GetGridColor2 (3)
- ; GetGridDoubleLineSpacing (3)
- ; GetGridLineStyle (3)
- ; GetGridLinetype (3)
- ; GetGridLineWeight2 (3)
- ; GetGridVisibility2 (3)
- ; GetHasFormula (3)
- ; GetMargin (3)
- ; GetOverride (3)
- ; GetRotation (3)
- ; GetScale (3)
- ; GetTextHeight2 (3)
- ; GetTextString (3)
- ; GetTextStyle2 (3)
- ; GetValue (3)
- (list
- (cons 'GetCellExtents
- (mapcar
- (function
- (lambda (b / tmp)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (append (list tblobj 'GetCellExtents) (cdr cell) (list b))))))
- (cons b tmp)
- (cons b (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda
- ); function
- '(:vlax-true :vlax-false) ; bOuterCell
- ); mapcar
- ); cons
- ); list
-
- (mapcar
- (function
- (lambda (mtd)
- (cons mtd
- (mapcar
- (function
- (lambda (enum / tmp ) ; object.Method(row, col, edge)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (append (list tblobj mtd) (cdr cell) (list (eval enum)))))))
- (cons enum tmp)
- (cons enum (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda (enum)
- ); function
- CEMenums
- ); mapcar
- ); list
- ); lambda (mtd)
- ); function
- '(GetCellGridColor
- GetCellGridLineWeight
- GetCellGridVisibility
- ); list
- ); mapcar
-
- (mapcar
- (function
- (lambda (mtd)
- (cons mtd
- (mapcar
- (function
- (lambda (enum / tmp ) ; object.Method(nRow, nCol, nGridLineType)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (append (list tblobj mtd) (cdr cell) (list (eval enum)))))))
- (cons enum tmp)
- (cons enum (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda (enum)
- ); function
- GridEnums
- ); mapcar
- ); list
- ); lambda (mtd)
- ); function
- '(GetGridColor2
- GetGridDoubleLineSpacing
- GetGridLineStyle
- GetGridLinetype
- GetGridLineWeight2
- GetGridVisibility2
- ); list
- ); mapcar
-
- (list
- (cons 'GetMargin
- (mapcar
- (function
- (lambda (enum / tmp ) ; object.GetMargin(nRow, nCol, nMargin)
- (if (not (vl-catch-all-error-p (setq tmp (vl-catch-all-apply 'vlax-invoke-method (append (list tblobj 'GetMargin) (cdr cell) (list (eval enum)))))))
- (cons enum tmp)
- (cons enum (strcat "Error: " (vl-catch-all-error-message tmp)))
- ); if
- ); lambda (enum)
- ); function
- MARenums
- ); mapcar
- ); cons
- ); list
-
- ; GetBlockAttributeValue2 (4) ; RetVal = object.GetBlockAttributeValue2(nRow, nCol, nContent, blkId) ; - I do this, but not in this code, hehe
- ; GetCellDataType (4)
- ; GetCustomData (4)
- ; GetSubSelection (4)
- ; HitTest (4)
- ; MergeCells (4)
- ; MoveContent (4)
- ; SetAutoScale2 (4)
- ; SetBlockAttributeValue (4)
- ; SetBlockTableRecordId (4)
- ; SetCellDataType (4)
- ; SetCellGridColor (4)
- ; SetCellGridLineWeight (4)
- ; SetCellGridVisibility (4)
- ; SetCellValueFromText (4)
- ; SetContentColor2 (4)
- ; SetCustomData (4)
- ; SetDataFormat (4)
- ; SetFormula (4)
- ; SetGridColor2 (4)
- ; SetGridDoubleLineSpacing (4)
- ; SetGridLineStyle (4)
- ; SetGridLinetype (4)
- ; SetGridLineWeight2 (4)
- ; SetGridVisibility2 (4)
- ; SetMargin (4)
- ; SetOverride (4)
- ; SetRotation (4)
- ; SetScale (4)
- ; SetSubSelection (4)
- ; SetTextHeight2 (4)
- ; SetTextString (4)
- ; SetTextStyle2 (4)
- ; SetValue (4)
- ; UnmergeCells (4)
-
- ; Looks like the 4-argument requiring methods, only apply values (there are few that obtain 'things', but ATM I excluded them)
-
- ); append
- ); setq r
-
- ); and
- r
- ); lambda
- )
-
- ); defun TableCell_ExtractProps
|
|