Excel Report cannot be opened
-
Hi JoHn-Beer
Have you tried renaming with the .xlsx extension?
-
@craigweb Try changing the name to .xlsx. It works.
Is there no way to change the name? -
Hi JoHn-Beer,
Is there no way to change the name?
The decision for whether the output file as .xls or .xlsx is done by reading from the uploaded template and determining if it is .xlsx formatted. I would consider,
- Opening the template in Excel, doing Save As and being sure it's .xlsx
- Trying a newer Apache POI jar
-
- upload template .xls or .xlsx cannot open
- If I try to follow the 2, what do I do?
-
upload template .xls or .xlsx cannot open
If your spreadsheet application cannot open the template I'm suspicious of if a newer POI will help. Did you download it from the edit report page, or did you already have the original version of the template?
I just checked and it's not a drop in replacement by the looks of things, so the newer POI isn't going to solve it, as it'll cause some runtime exceptions.
-
@phildunlap I use MangoES v.3.4.4. I'm using this template with other mangoES, I can use it normally.But I used to work with this can not be used normally as I attached the picture.
-
Then my suggestion would be to download the template from the first ES, and upload it to the one that isn't working right. Something is wrong in that file with it detecting that it is xlsx and the only solution is to reupload a template that doesn't have the issue, or hacking around it by automating something to rename them to xlsx for you.
-
@phildunlap I have tested it. Create an new excel template file and upload it back to it's not working. I use Firefox browser to load Excel file and it still does not work.
-
Hmm. Well, we can look at what sort of file it is being detected as by validating this code in a scripting data source window (change file path)
var bufferedStream = null; //Change: var path = "C:\\Path\\To\\Mango\\filestore\\EXCEL_REPORT_TEMPLATES\\your-filename-here.xlsx"; try { file = new java.io.File(path); //Pre-3.4, unix slashes //file = new java.io.File("/path/to/Mango/web/modules/excelReports/web/templates/file.xlsx"); bufferedStream = new java.io.BufferedInputStream(new java.io.FileInputStream(file)); print(org.apache.poi.poifs.filesystem.FileMagic.valueOf(bufferedStream)); } finally { if(bufferedStream !== null) bufferedStream.close(); }
It would print OOXML under the script window if it was detecting it as an .xlsx file.
-
pic1
pic2
I tried this pic1 and the script print OOXML but I can't dowload excel file like pic2. How can I do it?
-
pic2 is not useful. It truncates the filename (and the file extension!) and it is unclear what the icon your computer has for the application that will open it. Is that the icon for no file extension?
I also find it odd that you're using text.xlsx when your original question is about a different set of templates. Are no templates working to download? Can you right click on the download template link, copy the address and share what URL (remove your hostname or IP) it's downloading from?
-
@phildunlap Sorry,I may explain the problem incorrectly.The problem I found really was to download the Excel file.
Excel file cannot be opened because I download excel file without a file extension.1.I want to know the problem is that MangoES v.3.4.4 or My Computer PC ?
2.How can I fix the problem? -
- Can you check the contents of the /opt/mango/web/modules/excelReports/report-data over SSH or webmin? If there are file extensions there (and looking at the code I cannot imagine there are not) then the issue must either be your computer/browser, or however you're downloading the file. Maybe circle in a screenshot where you're downloading the file from?
I was not able to reproduce what you described, and further I cannot see any way in the code for the files on the ES not to have the proper extension, and there is certainly nothing that would be stripping that extension off when you download the file.