modify to_doc for html and rtf