1. An image processing apparatus comprising: one or more processing devices; one or more storage devices storing instructions to be executed by the one or more processing devices, the instructions being for causing at least one of the one or more processing devices to function as a character recognition section for performing a character recognition process for a character included in a document, based on image data obtained by reading the document, an image file generation section for generating an image file in which text data obtained by the character recognition process are associated with the image data, and a layout analysis section for analyzing layout, based on the image data, whether a word or a sentence described in the document is in vertical writing or horizontal writing, the character recognition section (i) performing a word recognition process of the word included in the document, by matching a combination of adjacent characters and word data in dictionary data, based on the character recognition result for each character included in the image data and an analysis result of the layout analysis process and (ii) producing the text data corresponding respectively to a word detected in the recognition process of the word on an assumption of vertical writing and a word detected in the recognition process of the word on an assumption of horizontal writing, in a case where it is indeterminable by the layout analysis section whether the word or the sentence described in the document is in the vertical writing or the horizontal writing, the image file generation section generating the image file in which each of the text data produced by the character recognition section is associated with the image data.