Closed npherson closed 2 hours ago
This other issue seemed to be about exactly what I'm trying to do, but then turned into a 'wraptext' issue which is not what I'm looking to accomplish... I want to replicate the "Alt+Enter" behavior.
OMG. I just looked at the cell propertied before and after clicking into the formula bar and hitting enter. Excel is 'fixing' it by turning on wrap text! So it is exactly like that other thread!
After setting the value of each cell, I added this to change the format to include wrap text: $ws.Cells["B17"].Style.WrapText = $true
And, yes, that seems to be the ticket!
Excel allows you to start newline within a cell using "Alt+Enter": https://support.microsoft.com/en-us/office/start-a-new-line-of-text-inside-a-cell-in-excel-33e41eab-8b5e-4193-93d6-9a06ecf812b3
However, I can't find any way to do that from Export-Excel while editing a cell value. I tried to get creative, but the best I could manage was the newline showing up in the Formula bar but not in the sheet itself. If you click into the formula bar and hit enter, excel fixes whatever is wrong and changes it to a multi-line cell.
Here's what I've tried: