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

Free Support Forum - aspose.com

How to hide and unhide columns

i have a dropdown in one of my column in excel sheel.based on the value am selecting in the dropdown i need to hide and unhide certain columns

Hi,


Please see the document for reference about hiding / unhiding columns:
http://www.aspose.com/docs/display/cellsnet/Hiding+Unhiding+Rows+and+Columns

I think you may try to get the dropdown/combobox shape and fetch the selected value in the template file at runtime by using Aspose.Cells APIs, now you may hide / unhide your desired columns accordingly (via Aspose.Cells APIs). See the sample code:

Sample code:

Workbook wb = new Workbook(@“e:\test\Book1.xls”);
//Browse all the shapes in the first worksheet.
foreach (Aspose.Cells.Drawing.Shape s in wb.Worksheets[0].Shapes)
{
if (s.GetType().ToString() == “Aspose.Cells.Drawing.ComboBox”)
{
Aspose.Cells.Drawing.ComboBox cb = (Aspose.Cells.Drawing.ComboBox)s;

//Get your Favorite options/attributes
string cbText = cb.Text;
string cbName = cb.Name;
string cbSelectedValue = cb.SelectedValue.ToString();
//Your code goes here.
}
}



Thank you.