InsertRange is applying the borders also. Need only Formatting

Hi Team

Could you please help me on this.

I am using the below logic to apply the formatting of the first row to next row.
CellArea area = CellArea.CreateCellArea(col1, col2);//B1-B7
xlwkst.getCells().insertRange(area, 1, ShiftType.Down);

I need only the formatting to be copied to next row however using the above logic, it is adding the borders also.

Please see attached document.

Thanks

Issue.docx (28.7 KB)

@Siva72

Please share us a sample source file and runnable code. We will log a ticket for you.

Hi
Please find the below details.

Attached is the template file which i use to create the report.
7th row columns in the sheet are formatted based on the currency type.

When populated the details in the 7th row, i need to copy the formatting to the next row without any borders as i am handling the borders manually based on the grouping of the records.

Below is the method i used to create the formatting to next row.

private void xlins(String col1, String col2)
{
//using excel
//xlwkst.get_Range(col1, col2).Insert(Excel.XlInsertShiftDirection.xlShiftDown, System.Type.Missing);

        CellArea area = CellArea.CreateCellArea(col1, col2);
        xlwkst.Cells.InsertRange(area,1 , ShiftType.Down);
        xlclose();

    }

When the above code executes, as per my previous post, it is creating a new 8th row with formatting as well as borders.

I cannot able to provide the runnable code as it will take some time to create a demo project. Could you please suggest asap. ThanksEISMR1Init.zip (20.5 KB)

@Siva72,

Thanks for the sample file and details.

I did test your scenario/case using your template file with Aspose.Cells APIs and found the issue as you talked about. But when I do the same thing manually in MS Excel, it works the same way. I opened your Excel file into MS Excel manually. Then, I selected the range, i.e., “B7:H7” and click “Copy” of right-click menu. Then, I select B8 and click “Insert Copied Cells…” of the context menu. I noticed the borders are also copied to the range “B8:H8”. To remove the borders of the cells (B8:H8) I have to manually off for the range of cells. So, apparently, Aspose.Cells works the same way as MS Excel does.

Thanks Amjad_Sahi.

I tried by manually removing the borders and it worked. Thanks

@Siva72,

Good to know that your have sorted it out now. Feel free to write us back if you have further queries or comments.