Automation of work with documents