Setting Data of Document

How do I read and set the data of a document without saving it (to store the data before it is saved)