Free Support Forum - aspose.com

Compilation problem

Hi,
I am evaluating the ASPOSE.excel but when I compile onto a sample web page it gave me
"c:\Inetpub\wwwroot\Test\bin\Aspose.Excel.dll Cannot declare a namespace and a type both named ‘?’"

Do you know why it failed?

Do you use VS.net to compile it? How about compiling with our feature demos?

I compiled with VS.Net 2003.
If I compiled the demo, it is fine. But when I compiled on my own test project it gave the compilation error as mentioned.
FYI, I include the ASPOse.Chart in the project as well but there is no problem with that.

If I remove all the reference and the codes related with ASPose.Excel, everything is compiled and running fine.
What I did in the project is include the dll for ASPose.Excel and put a reference into it, then I used the import from datatable feature into excel with the following snipplet:

Excel excelExportedData;
Worksheets wrkshtExportedData;
Worksheet shtExportedData;
Cells cellsExportedData;
int intSheetIndex;

intSheetIndex = 0;
excelExportedData = new Excel();
wrkshtExportedData = excelExportedData.Worksheets;
shtExportedData = wrkshtExportedData[intSheetIndex];
cellsExportedData = shtExportedData.Cells;
cellsExportedData.ImportDataTable(dsItemList.Tables[“vw_Test”], true, 0, 0);
intSheetIndex = wrkshtExportedData.Add();

excelExportedData.Save(“MyExcelTest.xls”, SaveType.OpenInBrowser, FileFormatType.Default, this.Response);


What’s the name of your test project? What’s the name of the web page? There may be name conflicts with your defined class name with Aspose.Excel. Could you please zip and post your test project here?

Thank you.

I have found the problem.
It is because in my page, I useed both Aspose.Chart and aspose.Excel.
Both used the same object name. When I compiled, the compiler does not know whether it refers to chart object in Aspose.Chart or aspose.Excel.

You are correct, it because of the naming conflict.
Once, I used a full name by including the namespace, everything is fine.