
! script name: datatable.d/explodetable
! topic: explode a table into text entities.

!A
!A NAME:
!A
!A 	Explode table
!A
!A DESCRIPTION:
!A
!A 	This script will explode a table into text and lines.
!A
!B INSTRUCTIONS:
!B
!B 	PICK TABLE: Pick the table to be exploded.
!B
!# see also - htdocs/help.d/datatables.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: explode table ")

DIM Answer$[256]
DIM A$[256]
DIM Destination$[256]
DEG

ActivateUndo
Start:!
Pick_table:stat= SetInputFormat("n4","")
Element1=PickEntity("PICK TABLE")
IF (ExitScript(Destination$)) THEN Leave
IF NOT  ValidGeometry(Element1) THEN Pick_table

Group= ExplodeTable(Element1)

ActivateUndo
Stat= AdvanceUndoNumber("explode table")
Stat= AddGroupToUndo(WsUBCreateMode,Group,2,WsTrue)

Stat= DeleteEntity(Group)

GOTO Start

Leave:!
stat= SetInputFormat("n4","")
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
