Hey everyone, I am using the FILEDEF command to send a report to a specified location, but each time I open the file in excel, Excel tells me it is corrupted.
If I specify the file as something other than xlsx it works properly. The problem is that I really need it as xlsx. Can anyone help?
So this doesn't work:
APP PATH IBISAMP
-UNIX rm /filepath/cartest.xlsx
FILEDEF CARSEND DISK /filepath/cartest.xlsx
-RUN
TABLE FILE CAR
PRINT *
WHERE RECORDLIMIT EQ 20
ON TABLE HOLD AS CARSEND FORMAT XLSX
END
But this does:
APP PATH IBISAMP
-UNIX rm /filepath/cartest.csv
FILEDEF CARSEND DISK /filepath/cartest.csv
-RUN
TABLE FILE CAR
PRINT *
WHERE RECORDLIMIT EQ 20
ON TABLE HOLD AS CARSEND FORMAT COMT
END
Any ideas why the FILEDEF would have problems with XLSX and not COMT?This message has been edited. Last edited by: rray9895,
WebFOCUS 8.105M, Windows 10, App Studio
November 09, 2019, 12:44 PM
Danny-SRL
This worked fine for me:
-SET &ECHO=ALL;
-* File rray01.fex
FILEDEF CARSEND DISK BASEAPP/CARSEND.XLSX
TABLE FILE CAR
SUM SALES RCOST DCOST
BY COUNTRY BY CAR BY BODYTYPE
ON TABLE HOLD AS CARSEND FORMAT XLSX
END
I see you are on a UNIX box. Could this be the reason? Did you try using FORMAT EXL2K or EXL07?
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
November 10, 2019, 03:19 PM
Waz
Also try adding this SET command. May help.
SET EXCELSERVURL = ''
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
November 12, 2019, 10:30 AM
rray9895
quote:
Originally posted by Danny-SRL: This worked fine for me:
-SET &ECHO=ALL;
-* File rray01.fex
FILEDEF CARSEND DISK BASEAPP/CARSEND.XLSX
TABLE FILE CAR
SUM SALES RCOST DCOST
BY COUNTRY BY CAR BY BODYTYPE
ON TABLE HOLD AS CARSEND FORMAT XLSX
END
I see you are on a UNIX box. Could this be the reason? Did you try using FORMAT EXL2K or EXL07?
I tried EXL2k and EXL07 with the file extension of .xls in the FILEDEF path, but got the same error on opening in Excel:
The file format and extension of 'carsend.xls' don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyways?
APP PATH IBISAMP
SET EXCELSERVURL = ''
-UNIX rm filepath/cartestxlsx.xlsx
FILEDEF CARSEND DISK filepath/cartestxlsx.xlsx
-RUN
TABLE FILE CAR
PRINT *
WHERE RECORDLIMIT EQ 20
ON TABLE HOLD AS CARSEND FORMAT XLSX
END
I'm working with our IT staff after reading this. WebFOCUS is hosted offsite, and the filepath is actually a mount point. From the mount point, the file is FTP-ed over to a network location on my local network. The file I am trying to open is the one that is FTP-ed over. I'm going to see if the IT staff at the location can open the file at the mount point to find out where the corruption is happening.
It sounds like something may be broken with the file transfer. I don't know why it would handle CSV and TXT files perfectly, but have issues with XLSX. I will update this thread with whatever information I get from the IT staff.
WebFOCUS 8.105M, Windows 10, App Studio
November 12, 2019, 05:16 PM
rray9895
We got the issue resolved. I asked the IT staff what the problem was and they indicated that it related to "Ascii/Binary" detection. Not sure what that means, but I'm leaving it here just in case it can help any future person who encounters this weird issue.
Thank you all for your help!
WebFOCUS 8.105M, Windows 10, App Studio
November 12, 2019, 05:28 PM
Waz
My guess is that the FTP step transferred the file as text not binary.