html-xlsx column width issue



  • Hello, can u help me please with setting up column width in html-xlsx temlpate, idk why, but column 1-3 get width from column 6-8, but only in case when width of 6-8 bigger than 1-3, in another case - all work fine
    also, attaching playground example - https://playground.jsreport.net/w/aleksej.baula/rTeM0vSF
    UPD: i`m trying many cases, with "width: Npx", "max-width: Npx", "min-width: Npx", only "max-width: Npx; min-width: Npx" work somehow
    UPD2: and maybe you also can help with overflow, last row always hidden



  • You seem to be making nested tr. That is intentional? The result isn't a valid HTML likely.
    If I print your template with HTML, it produces the same output so I don't see what you mean with "last row always hidden".



  • hi, nested tr for get this construction, where i have each cycle inside another each cycle. If there another way to get construction like that, i will glad to see it.
    Attaching screenshot with real data, u can see last row a little bit "cut", like row didn't expand completely.
    Btw, it's not a main question!
    0_1684488439030_Screenshot 2023-05-19 122543.png


  • administrators

    hi @Oleksii-Baula

    my recommendation will be that just add a table width, and then set into the cols a value that distributes the available width, the exact distribution will depend on your needs, however i have prepared example using values that i think you were trying to replicate.

    nested tr for get this construction, where i have each cycle inside another each cycle. If there another way to get construction like that, i will glad to see it.

    in the example i have prepated you can see a different way without nesting, also another recommendation will be that you don't set overflow: scroll for all the cells, and instead only do it for cells that its content is expected to be large, so don't do it for the header cells.

    https://playground.jsreport.net/w/anon/BG1GgqNg



  • Hello, @bjrmatos
    In your example i'm seen the same problem, check screenshot.
    column A have width 144px, but 1200 * 4.55% = 54.6. The same problem with column B. From what i have researched, column A have same width as column F, column B like G, but now column C don't looks like H, it's coz width of C defined greater than H.
    Overflow for some reason don't work, attaching screenshot too
    1_1684933359318_Screenshot 2023-05-24 160126.png 0_1684933359316_Screenshot 2023-05-24 155601.png


  • administrators

    @Oleksii-Baula about the column width not being expected, I don't have a good explanation or solution, we use the chrome table layout algorithm so in this case we get the width values from chrome itself.

    for the case in which overflow does not work (meaning that it does not make the cell to text wrap) i recommend that you just don't trust what the office preview shows you, i mean that you should download the output and check how it looks when you open the file.

    I did a test and when the data in cell has spaces fiveThree fiveThree five... (like it is expected for the text wrap to work) I've observed that it looks different when opening the file locally.

    0_1685109292106_Screenshot 2023-05-26 at 8.36.56@2x.jpg

    however for the case in which the text does not have spaces fiveThreefiveThreefive... the wrap works but it hides part of the text (which is the result you don't want), basically right now in a case in which the text is long and it does not have spaces it won't work as you lile.



  • Hello this is Gulshan Negi
    Well, you can adjust column width by using below code.

    <tr>
    <td style="width: 100px;">Value 1</td>
    <!-- Rest of the columns -->
    </tr>

    Thanks





  • Ok then. I am also not getting a proper answer may be someone help you on this.
    Thanks


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.