Is it possible to remove gridlines for a particular cell range by using Aspose Cells

I am trying with below code to remove gridlines for a particular cell range by using Aspose Cells. Please provide solution to remove gridlines from a particular cell range.

Range range = worksheet.Cells.CreateRange(0, 0, 1, 3);
range.IsGridlinesVisible = false; //something like this.

GridLinesRemoval.png (4.6 KB)

Regards,
Senthilnathan R


This Topic is created by Amjad_Sahi using Email to Topic tool.

@SenthilRG27,

I guess you need to merge cells, see the document with example code for your complete reference.

Also, see the sample code that you may try:
e.g
Sample code:

   //Merge A1:C1 cells to make A1 cell
    worksheet.Cells.Merge(0, 0, 1, 3);

Moreover, you can use borders (in white color) to hide grid lines for your desired range of cells. See the sample code for your reference:
e.g
Sample code:

 Workbook workbook = new Workbook();
            Cells cells = workbook.Worksheets[0].Cells;

            //apply white border style to a range of cells to make the gridlines invisible.
            Range range = cells.CreateRange(0, 0, 1, 3);
            Style stl = workbook.CreateStyle(); 
            stl.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Hair;
            stl.Borders[BorderType.LeftBorder].Color = Color.White;
            stl.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Hair;
            stl.Borders[BorderType.RightBorder].Color = Color.White;
            stl.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Hair;
            stl.Borders[BorderType.TopBorder].Color = Color.White;
            stl.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Hair;
            stl.Borders[BorderType.BottomBorder].Color = Color.White;

            StyleFlag flg = new StyleFlag();
            flg.Borders = true;

            range.ApplyStyle(stl, flg);

            workbook.Save("e:\\test2\\out1.xlsx"); 

Hope, this helps a bit.

Hi Amjad,

Thank you for your support.

@SenthilRG27,

You are welcome.