The OP mentioned the formatting remains intact up until he uploads it to his webserver and reviews it there.
The code formatting preferences in DW - if changed, should reflect in DW itself, isn't it?
Thanks for the suggestion. I looked and my settings are identical to the ones you posted. They must be the default settings.