Applying document formatting to the hierarchy macro documents