Free Support Forum - aspose.com

Work book open issue from Windows application

Hi,

I am facing a strange issue while trying to open a workbook. I am using Aspose.Cells in a windows application. and have kept an excel file in the installation directory.

First user browses an xml file from a folder location and uploads by clicking a button. Then the code tries to open the excel file from the installed folder to process some data. I used the following code to open the excel

Workbook workBookSource = new Workbook();

workBookSource.Open("ReportMapping.xlsx");

However the second line is throwing a File Not Found exception and is expecting the excel file to be present in the browsed folder location from where user selects the xml file. Is there something needs to be defined so that the code picks up the excel from the installation folder?

Thanks

Hemangajit

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Well, the default / root directoy to look for the template file is Bin/Debug folder in the application (same as File.OpenRead). So, if the template file is not in that folder it will give you the exception. So either you can place the file in Bin/Debug or use the following code:

Workbook workBookSource = new Workbook();

workBookSource.Open("..\\..\\ReportMapping.xlsx");

If you still face any problem, please creation a sample application and post it here to show the issue. We will check it soon.

Thank You & Best Regards,