Free Support Forum - aspose.com

How to shift cell right in JAVA Aspose Cell

How to “shift cell right” from the selected cell in Java Aspose Cell.

@prashant.barwe,

Thanks for your query.

You may please give a try to the following sample code and provide the feedback.

Workbook workbook = new Workbook(path + "bkRange.xlsx");
Worksheet worksheet = workbook.getWorksheets().get(0);
CellArea area = CellArea.createCellArea(1,1,5,5);
worksheet.getCells().insertRange(area, ShiftType.RIGHT);
workbook.save(path + "outputJava.xlsx");

bkRange.zip (6.7 KB)
outputJava.zip (7.3 KB)

@ahsaniqbalsidiqui,
thanks for helping us, but i am facing another issue there are left border automatic enable from the same Shifted CellArea. can we remove it from the Selected Cell Area.

@prashant.barwe,

Please share screenshots describing it, and your sample files (source and output file) with us for our testing. We will reproduce the problem and provide our feedback after analysis.

@ahsaniqbalsidiqui,
Hey thanks for feedback, I have resolved the issue. Can you please say about if I shift the cell the particular farmula will be shift or not.

@prashant.barwe,

Good to know that you have sorted out your issue now. Also, formulas would be adjusted accordingly when you insert a range of cells similar to what MS Excel does. If you find any issue (regarding shifting formulas), kindly do provide us template files (input and output file) and sample code (runnable) to reproduce the issue, we will check it soon.