Format document