You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem with Powerpoint, Excel or Word document: Word Document
Steps to Reproduce
Try to embed a excel file called sample.xlsx into word document. On adding a new resource I am passing "removed_after_used": true. This removes the temporary file once it is embedded in the document.
Once it is deleted in the code, still the createReadStream is trying to look for the file as the contents copying is still not finished. This is resulting into the below error
ENOENT: no such file or directory, open 'D:\sample1.xlsx
This stops the officegen to generate a docx file
[fill]
Expected Behavior
The file should be deleted only after the createReadStream has finished reading the file. It should be done on the finished event of createReadStream or the reading should be done synchronously using readFileSync
Actual Behavior
The file is still being accessed by createReadStream even after it has been deleted by officegen resulting in an error.
case 'file':
resStream = fs.readFileSync(
privateData.resources[cur_index].data ||
privateData.resources[cur_index].name
)
break
This is deleting the file after use but the above createReadStream is still accessing it.
privateData.resources.forEach(function (resource) {
if (resource.removed_after_used) {
var filename = resource.data || resource.name
Environment
node -v
: 18.16.0npm -v
: 9.5.1Steps to Reproduce
Try to embed a excel file called sample.xlsx into word document. On adding a new resource I am passing "removed_after_used": true. This removes the temporary file once it is embedded in the document.
Once it is deleted in the code, still the createReadStream is trying to look for the file as the contents copying is still not finished. This is resulting into the below error
ENOENT: no such file or directory, open 'D:\sample1.xlsx
This stops the officegen to generate a docx file
[fill]
Expected Behavior
The file should be deleted only after the createReadStream has finished reading the file. It should be done on the finished event of createReadStream or the reading should be done synchronously using readFileSync
Actual Behavior
The file is still being accessed by createReadStream even after it has been deleted by officegen resulting in an error.
case 'file':
resStream = fs.readFileSync(
privateData.resources[cur_index].data ||
privateData.resources[cur_index].name
)
break
This is deleting the file after use but the above createReadStream is still accessing it.
privateData.resources.forEach(function (resource) {
if (resource.removed_after_used) {
var filename = resource.data || resource.name
The text was updated successfully, but these errors were encountered: