Format the document