Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6218703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:39:22+00:00 2026-05-24T07:39:22+00:00

I am populating a template Excel sheet, with the data from the database :

  • 0

I am populating a template Excel sheet, with the data from the database :

 for (Map<String, Object> resultRow : dbResults) {
        if ((currentRow = sheet.getRow(currentDataRow)) == null) {
            currentRow = sheet.createRow(currentDataRow);   // Creates a new row.
        }
        //currentRow.getRowStyle().setHidden(false);

        for (int i = 0; i < resultColumns; i++) {
            currentCell = currentRow.getCell(i, Row.CREATE_NULL_AS_BLANK);
            setCellValue(currentCell, resultRow.get(dbcolumnNames[i]));
        }
        currentDataRow += 1;
    }

// How to hide all empty/Un-used rows following currentDataRow ?

Aim to Achieve :

  • I want that the Un-Used rows following the populated rows should be hidden ?
  • All Populated rows must be visible.
  • Eg: If 1st 100 data rows are filled, then rows following 101 and onward should be hidden.

Please, help !!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:39:24+00:00Added an answer on May 24, 2026 at 7:39 am

    POI recognizes the number of logical rows in your sheet when you create it.
    So as you populate it with 100 rows, it will create 100 records. The rest will appear when you open the XLS in Excel with the default layout – but these are not POI records.

    You’ll have to create some dummy rows after your last data record like this

    for (int i=currentDataRow ;i<65000;i++)
                    sheet.createRow(i);
    

    Create a cell style, and set it to hidden

    CellStyle hiddenstyle = workBook.createCellStyle();
    hiddenstyle.setHidden(true);
    

    Set this style for all rows from your last row to end of sheet

    while (rows.hasNext()){
                    Row row1 = rows.next ();
                    row1.setRowStyle(hiddenstyle);
    
    
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've defined a DataTemplate in a ResourceDictionary. The template need some data (for populating
I am populating combo box from database. In debug i can see that the
I am working on populating my database with test data using populate.rake: Repertoire.includes(:jokes).each do
I am wondering what solutions out there for populating data for a template. Right
Im populating a GridView from List so am forced to use TemplateField controls to
im populating the data in the combo box using dataset tables...with some table name..now
I'm populating a ListView with items and add images from an ImageList (in the
I am populating a combobox dropdown with node fields from an Xml document. I
I m populating data for different entities into set of lists using generic lists
Preparing data in json format on backend and populating data to templates via ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.