Excel file does not download or it is not saved anywhere when I give the file name lone

Hi Team,
I am using aspose.cells to exporte byte array to excel file. Below is the code snippet. But this does not download the file. If i add a folder like “C:\Downloads” or any physical path to the file name it gets downloaded there. But I want this to be downloaded to my downloads folder automatically. i cannot hardcode the downloads folder becuse it would fail on client machine when such a folder is not found.

        string excelFileName = UserID.Value + Guid.NewGuid().GetHashCode().ToString() + "tempTableView.xlsx";
        Stream fileStream = new MemoryStream(reportBytes);
        var Workbook = new Workbook(fileStream);
        Workbook.Save(excelFileName, SaveFormat.Xlsx);

@Priyarav87

Thanks for providing us sample code and details.

This is not an issue with the product by any means rather you should find the relevant APIs to get the path to user profile and its Downloads folder by yourself.

Well, it does save the file but in your project’s “/bin/debug” folder.

See the following sample code on how to get the current user’s relevant Downloads path.
e.g
Sample code:

string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
string pathDownload = Path.Combine(pathUser, "Downloads"); 

Hope, this helps a bit.

Thank you.