Search code examples
iosms-officedocxdocquicklook

office documents won't open with quicklook


I've created 2 test applications:

In the one the documents are included into the bundle and can be opened by using the quick look controller. In the other app, the documents are downloaded. When I try to open the files the quick-look controller simply shows a message saying an error occurred. Strangely it will open downloaded PDF documents without any problems.

I suspect it has something to do with headers and mime-types, but I'm not sure on this. Would anyone know what the reason could be that downloaded .doc or .docx documents won't open and local documents will?


Solution

  • It turned out to be a problem with saving the downloaded files. At first I was writing the data to a filepath URL. This saved the data to the right location, but the type of file wasn't recognized anymore.

    The solution was to use the default FileManager to save the file.

    [[NSFileManager defaultManager] createFileAtPath:filePath contents:data attributes:nil];