Document formatting and editing