ParthMDave opened a new issue #188: probelm in downloading .xlsx file from 
Angular + Cordova android app
URL: https://github.com/apache/cordova/issues/188
 
 
   <!------------^ Click "Preview" for a nicer view! -->
   
   Apache Cordova uses GitHub Issues as a feature request and bug tracker 
_only_.
   For usage and support questions, please check out the resources below. 
Thanks!
   
   ---
   
   You can get answers to your usage and support questions about **Apache 
Cordova** on:
   
   * Slack Community Chat: https://cordova.slack.com (you can sign-up at 
http://slack.cordova.io/)
   * StackOverflow: https://stackoverflow.com/questions/tagged/cordova using 
the tag `cordova`
   
   ---
   
   I am working in angular 8 project. I have one component which process some 
data & export this data to excel using XLSX.WorkSheet method. When i run my 
application in browser then it successfully download EXCEL file(.xlsx).
   
   Now i am converting my angular 8 application to Cordova android, all 
functionality working same as brower view of my angular app but when i tring to 
Export EXCEL then file not downloading.
   
   Here i show some code of angular project for Export Excel data as below
   ```
   import { ExportAsService, ExportAsConfig, SupportedExtensions } from 
'ngx-export-as';
   import * as XLSX from 'xlsx';
   constructor(private exportAsService: ExportAsService) {}
   
   public exportExcel(jsonData: any[], fileName: string): void {
       const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(jsonData);
       const wb: XLSX.WorkBook = { Sheets: { 'data': ws }, SheetNames: ['data'] 
};
       const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 
'array' });
       var out = XLSX.write(wb, { type: 'base64' });
       var xlsContent = 
'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,'
 + out;
       this.exportAsService.downloadFromDataURL(fileName, xlsContent);    
   }
   
   
   ```
   
   
   
   I am working in angular 8 project. I have one component which process some 
data & export this data to excel using XLSX.WorkSheet method. When i run my 
application in browser then it successfully download EXCEL file(.xlsx).
   
   Now i am converting my angular 8 application to Cordova android, all 
functionality working same as brower view of my angular app but when i try to 
Export EXCEL then file not downloading.
   
   Here i show some code of angular project for Export Excel data as below.
   
   import { ExportAsService, ExportAsConfig, SupportedExtensions } from 
'ngx-export-as';
   import * as XLSX from 'xlsx';
   constructor(private exportAsService: ExportAsService) {}
   
   public exportExcel(jsonData: any[], fileName: string): void {
       const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(jsonData);
       const wb: XLSX.WorkBook = { Sheets: { 'data': ws }, SheetNames: ['data'] 
};
       const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 
'array' });
       var out = XLSX.write(wb, { type: 'base64' });
       var xlsContent = 
'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,'
 + out;
       this.exportAsService.downloadFromDataURL(fileName, xlsContent);    
   }
   Using above code i am able to download excel file when click on Excel button 
in Angular 8 Application in browser. i want same behavior in Android 
.APK(Cordova). i am not aware more about cordova, is any effort require to 
download file in Cordova app?
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to