Log In    |    Knowledge Base    |    4D Home
Tech Tip: 4D View Pro Save Image of Current Sheet
PRODUCT: 4D View Pro | VERSION: 17 | PLATFORM: Mac & Win
Published On: March 20, 2019

With 4D View Pro it is possible to save a snap shot of the sheet as an image.

The following method will allow the view of current sheet with the column and row labels to be saved as an image. It will also include the active cell, row, and column markers.

// Method: VP_SheetToImg
// Description
// Creates an image file of the currently active
// sheet of a 4D View Pro area object
// Parameters
// $1 - Text VP area object name
// $2 - Text pathname of resulting object
// ----------------------------------------------------



If (Count parameters=2)
   $picURL_t:=WA Evaluate JavaScript(*;$vpArea_t;$jsCode_t)
   $picData_t:=Replace string($picURL_t;"data:image/png;base64,";"")
   BASE64 DECODE($picData_t;$picBlob_b)
   BLOB TO DOCUMENT($pathName_t;$picBlob_b)
End if

Example of using the command:
// To save the current sheet of VP Area Object "vpAreaName" as "myVP.png"


Results of the command, Windows Photo Viewer adds a Yellow/Orange Tint, actaul color is correct. Notice that the markers highlighting the active cells, rows, and columns are also captured, so it may be useful to click off to a cell not being displayed.