possibility to change only the height of the header row as in Excel

possibility to change only the height of the header row as in Excel

jurkajurka Posts: 1Questions: 1Answers: 0

how can I change only the height of the table header (with word wrapping)?

1) datatable standard - long name in the header, little text in the data
All rows same size = height

2) datatable wrap - but it wraps everything
header larger row height
data smaller line height against the line header, but also wrapped text

3) excel - only header wrapped text = greater line height
lines of equal height without wrapping text

THIS is what I would like to achieve

here's a sample, maybe it's understandable.

example: https://regruti.jednoduse.cz/datatable/datatable.jpg

HTML and JAVA for variant 1)

<table id="example1" class="display nowrap display table-bordered display compact" style="width:100%">

 // DataTable 1
    var table = $('#example1').DataTable( {

      columnDefs: [
        { targets: [3, 4, 5, 6, 7, 8, 9, 10, 11,12,13,14,15], className: "dt-body-right" },
    ],

    paging: false,
    scrollCollapse: true,
    scrollX: true,
    scrollY: 300,
    searching: false,
        info: false,
    } );


HTML and JAVA for variant 2)

 <table id="example2" class="datatable-init table table-hover table-striped table-bordered   display compact " 
style="width:100%; white-space: pre-line; word-break: break-all; margin: 0 auto; table-layout: fixed " >


// DataTable 2
    var table = $('#example2').DataTable( {

      columnDefs: [
        { targets: [3, 4, 5, 6, 7, 8, 9, 10, 11,12,13,14,15], className: "dt-body-right" },
    ],

    paging: false,
    scrollCollapse: true,
    scrollX: true,
    scrollY: 300,
    searching: false,
        info: false,
  
    } );

Thank you.

Answers

  • allanallan Posts: 61,752Questions: 1Answers: 10,111 Site admin

    You need to modify the generated Excel XML. You can do that using the customize callback for the excelHtml5 button type. I'm not sure how you specify row height in Excel though - you would need to look that up in the OpenSpreadSheet specifications and then apply that to the XML.

    Allan

  • allanallan Posts: 61,752Questions: 1Answers: 10,111 Site admin

    Oddly enough, there is another question about Excel row height. Perhaps you can work together to come up with a solution that works for you both.

    Allan

Sign In or Register to comment.