Free Support Forum - aspose.com

Hiding portions of grid

Is there any ways we can hide a portion of a grid? I tried the following options:

1. I set the rowheight and columnwidth to 0pt. This results in a dark chaos because of all the data in those columns.

2. So I merged those rows and columns. Now it’s hidden.

3. But if I retrieve a value from a hidden cell, obviously it returns null, as it is merged now

Is there any ways I can hide them, still able to retrieve the values? May be setting the bgcolor and forecolor of the cells to white may help. But I don’t think there are methods available for that. It would be great if you guys can give me solution like GridWeb1.Cells[""].visible = false or atleast GridWeb1.Cells[""].bgcolor = “white”.

Thanks.

Hi,

Kindly use Cell.Style.BackColor and Cell.Style.ForeColor properties for your need.

E.g..,

WebWorksheets sheets = GridWeb1.WebWorksheets;
WebWorksheet sheet = sheets["Sheet1"];
WebCells cells = sheet.Cells;
cells["A1"].PutValue("a");
cells["B4"].PutValue("b");
cells["C5"].PutValue("c");
cells["D6"].PutValue("d");
cells["E7"].PutValue("e");

cells["B4"].Style.BackColor = Color.Transparent;
cells["B4"].Style.ForeColor = Color.White;

Thank you.

I’ll try it out. Thank you.

Thank you very much. Problem solved :slight_smile: