File content not appearing
kalideir opened this issue · 1 comments
kalideir commented
I am dynamically creating an Excel file using RNFS and XSLX modules. However, when I open the file with this module the content seems as if the file is totally empty. But when I share the same file through its path to google drive using react-native-share, I am able to see the content.
Any ideas?
Here is the code for creating the file
const exportNewSession = async (filename: string, data: Row[]) : Promise<void> => {
const ws = await XLSX.utils.json_to_sheet(data);
const wb = await XLSX.utils.book_new();
await XLSX.utils.book_append_sheet(wb, ws, 'sheet1');
const wbout = await XLSX.write(wb, { type: 'binary', bookType: 'xlsx' });
const file = `${`${DocumentDirectoryPath}/history/${filename}`}`;
console.log('file exported ^');
return writeFile(file, wbout, 'ascii');
};
And here I try to open the same file:
const path = `${`file://${DocumentDirectoryPath}/history/${filename}`}`;
FileViewer.open(path)
.then(() => {
// success
})
.catch((error) => {
// error
});
oferRounds commented
Hi @Decoder3-14,
I’m seeing the same issue, were you able to solve it?