Write document