View excel sheet in app or external Application!


#1

Tried using fileopener not working!
Suggest me how to do it, Please,…

ionic info

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.5
Cordova Platforms  : android 6.2.2 ios 4.5.2
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.9.3
npm               : 5.5.1
OS                : Windows 7

#2

What is happening with file opnener ?


#3

this.fileOpener.open(‘assets/documents/directory/excels/somefile.xls’, ‘application/vnd.ms-excel’)
.then(() => console.log(‘File is opened’))
.catch(e => console.log(‘Error openening file’, e));

using this! File is available at that location but shows up as error(File not found)


#4

Have you tried keeping files other than Excel in the same path? If not try adding video or an image there and make sure your path is proper.


#5

Tried replacing and changing path! Still not working.
Is there any other way?


#6

I want to get a clarity from you, is it the issue with Excel sheet opener or File opener plugin issue in General. So I asked you to try opening other media files like video or image. So that we are sure there are no errors in the file opener plugin installation. Later we can debug on Excel sheet.


#7

Just now found that fileopener cannot open files in assets folder, because while opening in external application, it cannot access the assets folder of current application.

Is there any alternative?


#8

Method 1: (I have tried it for other media files, it works)

  1. Keep your excel file on your server and get a path for that.
  2. Download it inside the app using transfer plugin.
  3. The transfer plugin will return the path where it has downloaded.
  4. Use that path as a file path to file opener plugin.

Method 2: (not tried and not sure of working)
Try placing it on directly www folder and check once.