Unable to change width of cell/column in html to xlsx recipe



  • Hi,

    I noticed that we are supposed to be able to change the width of a column, that being the width of the cell with the biggest width. (Using css and classes)

    The thing is, it works in the playground: https://playground.jsreport.net/w/admin/qMdNLHkz

    But in my template, when doing the same (creating a class in style with the width, and assigning the width through the class)

    .w-60 {
        width: 60px;
    }
    
    <table>
        <tr class="lh-fixed-48">
            <th class="w-60 border bottom">         Product                     </th>
       </tr>
    </table>
    

    The width wont work (Before that, I have tried changing th to td, deleting the tabs that I use for code formatting, and usual stuff that "this shouldn't happen but it might happen". It just doesn't work.... :(

    I use jsreport 2.0.5

    Btw: another doubt if someone might know how to make it work: How do I insert a line break? I can't use html because everything inside td gets parse as is, but \n, <br>, a linebreak even... nothing is working.


  • administrators

    hi! hmm i'm not sure why using a css class won't work for you, however if you can share the full template and find a way to replicate the problem in the playground i can try to find the reason.

    about doing a line break you can just put a <br /> and put a overflow: scroll style in the cell with the line break (live example). this works fine in latest version jsreport-html-to-xlsx@2.3.0. you can try to install it manually or you can wait until we release jsreport 2.4.0 which is almost ready for release.


Log in to reply
 

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