Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
InfoCraft
Creator

Carriage Return Within a Cell in Microsoft Excel

 

Hi community, I would like to share with you a tip, how to create excel files with a carriage return (or line break) in a cell.

you can get around it with a bit of Java String manipulation:

"1st line... "+Code+"2nd line…"

Code = Character.toString ((char) 10) or “\012” or “\n”…

The code I gave you, will provide the carriage return where you want it, but you will need to enable the "Wrap text" in the file using VBA0695b00000SryyiAAB.png0695b00000SrzjFAAR.png0695b00000Srz1IAAR.png0695b00000Srz2BAAR.png0695b00000Srz3sAAB.png0695b00000Srz5FAAR.png0695b00000Srz7BAAR.png0695b00000Srz7VAAR.png************tFixedFlowInput_2************

Dim objXL

SET objXL = CreateObject("Excel.Application")

WITH objXL

  .Workbooks.Open("D:/test/out/Carriage_Return_in_cell.xlsx")

  .Worksheets("Users").Range("A1:A15").WrapText = True

  .activeWorkbook.save

  .activeWorkbook.close  

END WITH

SET objXL = Nothing

 

**************tJava_1*************

Runtime.getRuntime().exec("cmd /c start +((String)globalMap.get("tFileOutputRaw_1_FILENAME_PATH")));

TimeUnit.SECONDS.sleep(1);

File file = new File(((String)globalMap.get("tFileOutputRaw_1_FILENAME_PATH")));

file.deleteOnExit();

 

NB. On Debian/Ubuntu you can install as follows:

$ sudo apt-get install wine

...

$

To run from command line:

$ wine cscript some-script.vbs

or

$ wine

wscript some-script.vbs

 

Happy learning,

Kind regards,

😷19.

Labels (4)
1 Reply
Anonymous
Not applicable

Hello,

Thanks for sharing this tip with us on Community.

Best regards

Sabrina