Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
how to break columns to next page in html print

I want to print a HTML table with lot of columns and lot of rows. Basically a large table. I'm able to apply page-breaks for the rows correctly. However when it comes to columns it will not fit in same page. I have used table-layout as 'auto', so it will fit around 10-12 columns in a single page. But rest of the columns will not fit and hence it will be cut down. Is there I can make the remaining columns to print in the next page and then page break to print next set of rows.

Current code:


    <div id="pdf-export-grid" class="div-table">
    <div class="row">
      <% @column_values.each do |cell| %>
        <div class="column column-border grid-cell-width <%= @add_class %>" style="<%= cell["inline_styles"] %>" >
          <% if (cell["value"].present? && !cell["value"].nil?) %>
           <%= cell["value"] %>
           <% else %>
            <br/>
           <% end %>
        </div>
      <% end %>
    </div> 
    </div>

this is html.erb file so pls ignore about the variables.

css used:

    .div-table {
      display: table;         
      background-color: #eee;         
      table-layout: fixed;
      border-collapse: collapse;
      width: 100%;
      break-inside: avoid;
    }
    .column {
      padding: 4px;
      display: table-cell;
      break-inside: avoid;
    }
    .column-border {
      border-style: solid;
      border-width: thin;
      border-color: #D3D3D3;
    }
    .column-header-border {
      border-top: solid;
    }
    .row {
      display: table-row;
      clear: both;
      page-break-inside: avoid;
    }
   .column:nth-child(odd), .grid-cell-width:nth-child(odd) {
      width: 15%;
      background: #ddd;
    }
    .column:nth-child(even) {
      width: 75%;
      background: #ddd;
    }
    .column-border:last-child {
      border-right: solid;
      border-width: thin;
      border-color: #D3D3D3;
    }
    .grid-cell-width:nth-child(even) {
      width: 15%;
      background: #ddd;
    }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda