Is possible to set the PageWidth of an output cell without having to manually use the Format->Word Wrapping menu? For example, how could one add to the following Input expression to cause the output to have PageWidth->Infinity?
CellPrint seems too low-level since it ignores the settings of other options, such as cell margins. SetOptions works fine if I want the wrapping to be the same for all Output cells (which I don’t). I tried working with CurrentValue, but did not have any success.
You can do that by selecting the cell and setting the option. The first line just selects the previous output cell. The second line sets the width for that line. (you also have multiple other options for the width).
SelectionMove[PreviousCell[], All, Cell];
SetOptions[NotebookSelection[], PageWidth -> "Infinity"]
Is this what you were looking for (a way to take an already generated cell and change its width)?
I am curious why the SetOptions code is not working, especially when I can manually set that cell (Format->Word Wrapping) to not word wrap and it behaves as I would expect.