Hi,
I'm creating two different files (bla.xml and bla_bla.xls) using Report script and trying to save them in different locations what does not work. I changed Context.setSelectedPath(...) for each of them but both of them are going to the same path(last one). I also tried to delete or rename created files with Context.deleteFile(...) / __renameFile(...) commands that did not work also. What is wrong? The Context.deleteFile(...) returns true but keeps the file empty(corrupted). The report has two output file formats: xml and xls. Could be a reason?
Thanks.
Hello Guys,
I have a problem similar to Albina's. I have to extract different files in different folders. I have image file that is retrieved from a model:
var image = modelDef.Graphic(false, false, nLocale, false); var contextCurrentTempPath = getSubDir(itemTypeCode, itemType) + "\\"; //custom function to get the right subdirectory Context.setSelectedPath(contextCurrentTempPath); var output = Context.createOutputObject(); image.Save(output, fileName); Context.addOutputFileName(fileName, Constants.LOCATION_OUTPUT);
This works by itself, but the function that calls that code, also calls another piece of code, which should create an Excel sheet.
Context.setSelectedPath(rootDir);//rootDir is the path where the Excel file should be save workbook.write(); Context.addOutputFileName("ExcelFilename.xls");
Currently, the way the code works is that it saves the JPG image files in the same location as the Excel file - rootDir .
I figured that this is because all the files that were created during the report run, are transferred over to the target dir
Context.setSelectedPath(rootDir)
, only when the report is finished.
Therefore I though that there should be a way to transfer the generated files while the report is still running. I tried using the following code:
var image = modelDef.Graphic(false, false, nLocale, false); var contextCurrentTempPath = getSubDir(itemTypeCode, itemType) + "\\"; //custom function to get the right subdirectory Context.setSelectedPath(contextCurrentTempPath); var output = Context.createOutputObject(); Context.addOutputFileName(fileName, Constants.LOCATION_OUTPUT); output.OutGraphic(image, 100, 210, 297); output.WriteReport();
Unfortunately, that did not work - no image files are generated at all, even in the server's temp directory.
I would appreciate any suggestion or help.