You can wrap the text in Pane
with an UpTo
style width specification to get the wrapping, and use HeaderAlignment
for the centering:
automatic = Automatic;
Dataset[{<|"small column" -> 123,
"very large column heading" -> 123|>, <|"small column" -> 45678910,
"very large column heading" -> 456|>, <|"small column" -> 789,
"very large column heading" -> 78910|>},
HeaderDisplayFunction -> (Style[Pane[#, {UpTo@75, Automatic}],
TextAlignment -> Center, LineBreakWithin -> automatic] &),
HeaderAlignment -> {Center, Center}]

Note the use of LineBreakWithin
to allow the header lines to actually wrap (thanks @lericr for pointing out that it doesn't work on desktop otherwise!). The last thing needed to make this work is using automatic
as value for LineBreakWithin
- this is due to a bug in HeaderDisplayFunction
, which replaces any literal Automatic
with Nothing
(which would break the option). To work around this, I simply hide Automatic
by using a variable.