I'm using an UIWebView
for viewing .pdf, .txt, .xls, .ppt files. I used webView loadRequest
method for viewing these files and its working fine. I need to view files such as .odp, .odt, .ods etc, but its showing only blank page in UIWebView. Is there any effective method for viewing these files using UIWebView or any direct method for doing the same?
Asked
Active
Viewed 1,003 times
3

Cœur
- 37,241
- 25
- 195
- 267

Vishnu Kumar. S
- 1,797
- 1
- 15
- 35
-
Have you found the solution for this? – IamAnil Mar 27 '18 at 11:57
2 Answers
0
Have you tried using the UIWebView method load, specifying the MIME type? For example for an .odt file:
webView.load(loadedData as Data, mimeType: "application/vnd.oasis.opendocument.text", textEncodingName: "utf-8", baseURL: NSURL() as URL)
If that does not work, then I'm afraid you'll have to write your own open office document loader...

Don Miguel
- 882
- 9
- 19
-
I didn't tried this mimeType, will check it and will let you know the result. Always thanks for the answer. – Vishnu Kumar. S Feb 02 '18 at 14:22
0
WebODF libs integration with UIWebView: Integrated WebODF libs with UIWebView and it's working fine. Please find the below steps
1) Load index.html file from WebODF libs on UIWebView
2) Inject .odt file On webViewDidFinishLoad using below code snippet
let jsFunction = "createEditor(\"../default.odt\", \"Test\", 375, 667)" webView.stringByEvaluatingJavaScript(from: jsFunction) 3) Successfully load the odt file.
More information : https://github.com/kogmbh/WebODF/issues/945

IamAnil
- 496
- 5
- 19