In DsExcel Java, you can cut or copy data across a range of cells or several worksheets without any hassle.
For instance, let's say you want the same title text to be put into different worksheets within a workbook. To accomplish this, if you type the text in one worksheet and copy,paste it into every other worksheet, the process can turn out to be both cumbersome and time-consuming.
A quick way of doing this would be to cut or copy information across cells or sheets using:
Refer to the following example code to perform copy operation in a workbook.
Java |
Copy Code |
---|---|
Object[][] data = new Object[][] { { 1 }, { 3 }, { 5 }, { 7 }, { 9 } }; worksheet.getRange("A1:A5").setValue(data); // Copy across sheets IRange range = worksheet2.getRange("B7"); worksheet.getRange("A5").copy(range); |
Refer to the following example code to perform cut operation in a workbook.
Java |
Copy Code |
---|---|
IRange range1 = worksheet2.getRange("B3"); // Cut across sheets worksheet.getRange("A3").cut(range1); |