Free Support Forum -


I have seen the AutoFiltering Wiki site but when I try to add an item to it I get an error.

Is there a way to add a dropdownlist without using AutoFilter. I want to add a list of carriers

into a dropdown from my database into the Excel worksheet.

This is what I have so far:

Excel excel = new Excel();

Aspose.Excel.License license = new Aspose.Excel.License();

license.SetLicense( mapPath + "\\bin\\Aspose.Custom.lic" );

Worksheets sheets = excel.Worksheets;

sheets[ sheetIndex ].Name = "Dedicated Long Distance";

sheets[ sheetIndex ].AutoFilter.Range = "C1:C1";

sheets[ sheetIndex ].AutoFilter.Filter(0, "Bananas");

excel.Save( locationName + "_" + DateTime.Now.ToString("MM_dd_yyyy") + ".xls", SaveType.OpenInExcel, FileFormatType.Default, Response);

When it gets to the part where it adds Bananas (comes from your wiki page) it craps out.

I am using Aspose.Excel version 2.8.3


In v2.8.3, this piece of code is not supported yet.

sheets[ sheetIndex ].AutoFilter.Filter(0, "Bananas");

Please download and try v3.6.

You can create it in your template file and use Aspose.Excel to import it. But currently there is no other way to set dropdownlist at run time.

Thanks for the quick reply.

Since that is not possible could I pass an array to a macro and have the macro fill in the DropDownList.

If I can pass an object such as an array (The array is needed because I need to get the information from my database) then how can I go about doing it. I didn't see any code that would allow for that to occur.

By the way, I have downloaded the lastest Excel dll.

If you want to create a standalone dropdownlist and populate data in that dropdownlist, I think you can use VBA code to dynamically create it when users open your file. Then you just use Aspose.Excel to import your template file with VBA code and populate other contents at run time.