KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Format String for Pasting into View Pro/Excel
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: October 4, 2021

When pasting a string into a 4DViewPro or Excel spreadsheet, it is possible to format the string in a way to break up the string into different cells. To have a pat of the string break into the next cell on the right, include a tab character in the string. To have a part break onto the beginning of the next row cell, include a new line character in the string.

The code example below formats a string with a tab or new line character in between each letter. Char(9) are tabs and Char(10) are line feeds.

C_TEXT($paste_t)
$paste_t:="a"+Char(9)+"b"+Char(9)+"c"+Char(10)+"d"+Char(9)+"e"+Char(9)+"f"
//Same as $paste_t:="a\tb\tc\nd\te\tf"
SET TEXT TO PASTEBOARD($paste_t)


The image below shows the output when pasting the string into a spreadsheet.