POI Excel Inserts a new line, the following action state moves

Source: Internet
Author: User

When you do Excel templates, you will encounter the number of template rows is not fixed, such as the need to insert a row below 4

The workaround is to use the Shifrows method, where the 1th parameter refers to the row to start inserting, and the 2nd argument is the end line number

// omit the preceding data insert operation, the following is the insertion of the 4th row, the 4th line is unchanged, the dynamic Move Down if (i > 3) {     truefalse);
}
...
Hssfcell cell1 = Row.getcell (0) = = null? Row.createcell (0): Row.getcell (0);

The rest of the line is also based on the number of rows, the row index dynamically plus the number of rows, which becomes the following

The extra rows are not copied, and the style of the previous line can be taken out first, copied to the new row

POI Excel Inserts a new line, the following action state moves

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.