Usually, files get corrupted when they are written to the hard disk. This can happen in a variety of ways, but most often the application encounters an error when saving or creating a file. An Office application can fail if it saves a document at the wrong time.