Log In    |    Knowledge Base    |    4D Home
Tech Tip: Retrieve a styled body text from a 4D Write area
PRODUCT: 4D Write | VERSION: 2003.2 | PLATFORM: Mac & Win
Published On: January 29, 2004

Versions: 6.8 and 2003

Here is a simple method that will return a styled body text of a document that has been loaded into a 4D Write area. The result of the method execution will be in the form of a blob, which can be inserted into a different document using the command WR INSERT STYLED TEXT.

  ` Project Method: WR_CopyStyledBody
  ` Params:
  ` $1 - Reference to a 4D Write Area
  ` $2 - Position of the first character
  ` $3 - Position of the last character
  ` Return:
  ` $0 - Blob containing styled body



Case of
: (($begsel>=0) & ($endsel>0))
  If ($begsel<$endsel)
    WR SET FRAME($wrarea;wr text frame )
    WR SET SELECTION($wrarea;$begsel;$endsel)
    $StyledTextBlob:=WR Get styled text($wrarea)
  End if
: (($begsel=-1) & ($endsel=-1))  ` Copy all
  WR SET FRAME ($wrarea;wr text frame )
  WR EXECUTE COMMAND ($wrarea;wr cmd select all )
$StyledTextBlob:=WR Get styled text ($wrarea)

End case