We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Ambiguous reference between 'System.Web.UI.WebControls.Button' and 'Aspose.Cells.Button'

Yes, I'm a newby. I just installed the software and am trying to code up my first page and I'm getting errors all over the place that are conflicts between the System.Web.UI.WebControls and Aspose.Cells.

The specific error is: Compiler Error Message: CS0104: 'Button' is an ambiguous reference between 'System.Web.UI.WebControls.Button' and 'Aspose.Cells.Button'

I'm sure if I went through this page and set everything explicitly that I could make it work, but is there a simpler solution?


Thanks for considering Aspose.

Since Aspose.Cells namespace has Button class so does System.Web.UI.WebControls, so you have to provide full qualified namings for these objects in your code.


//Create a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet in the workbook.
Worksheet sheet = workbook.Worksheets[0];
//Add a new button to the worksheet.
Aspose.Cells.Button button = sheet.Shapes.AddButton(2, 0, 2, 0, 28, 80);
//Set the caption of the button.
button.Text = "Aspose";

For further reference about inserting controls, kindly check: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/working-with-controls.html

Thank you.

Same problem with basic windows forms controls:

'GroupBox' is an ambiguous reference between 'System.Windows.Forms.GroupBox' and 'Aspose.Cells.GroupBox' C:\...\mysource.cs 64 17 mysource

You can either:

a) Remove the "using Aspose.Cells;" statement and fully qualify the Aspose object names (i.e. Aspose.Cells.GroupBox) in the source files where you are having problems.


b) Move all of the Aspose-related items to another source file that doesn't contain a "using System.Windows.Forms;" statement and use the identifiers without qualification.

Since all of my UI controls are in the same source file that the UI designer uses, and all of the code that handles the Excel access is in another module, I've gone with option (b). Hope this helps!

-- Carl