Free Support Forum - aspose.com

How to set inner border to range

hi,supporter
i am a new user for aspose cells.i like your produt. but when i use the cells i found i cant create a inner border to a range.
for example in excel i can select a range like A1:E6 , then i click the borders icon and then i click more borders ,in this form you can see there are three borders “none”,“outline” ,“inside” . i wnat to know in the aspose.cells how can i add inside border like what excel inside border dose?
could you help me please ?
thank you very much.

@jack_from_usa,

See the sample code for your reference:
e.g.
Sample code:

            Workbook workbook = new Workbook("e:\\test2\\Book1.xlsx");
            Worksheet worksheet = workbook.Worksheets[0];
            Cells cells = worksheet.Cells;
            Range range1 = cells.CreateRange("A1", "E6");

            Style stl = workbook.CreateStyle();
            stl.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin;
            stl.Borders[BorderType.TopBorder].Color = System.Drawing.Color.Black;
            stl.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin;
            stl.Borders[BorderType.LeftBorder].Color = System.Drawing.Color.Black;
            stl.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
            stl.Borders[BorderType.BottomBorder].Color = System.Drawing.Color.Black;
            stl.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin;
            stl.Borders[BorderType.RightBorder].Color = System.Drawing.Color.Black;
            StyleFlag flg = new StyleFlag();
            flg.Borders = true;

            range1.ApplyStyle(stl, flg);

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

Hope, this helps a bit.