Excel Width Problem



  • Hello... I want to ask, I use microsoft visual studio and I try to render excel file using : Recipe - HtmlToXlsx

    It renders successfully, but i get problem with the width column. You can check the pic below :
    0_1530787840854_upload-cbf71aad-309a-4e52-bdbe-37422465aa55

    I used css style , width : px to control it but it give me no result. My code :

    @model NetWebApp.Model.InvoiceModel
        <style>
            .heading > td {
                background-color: green;
                color: white;
                border: 3px solid #73AD21;
                width:500px;          
            }        
        </style>
        <table>     
            <tr class="heading ">
                <td style="border:1px solid #000000;width:308px;">
                    Allocation Category
                </td>
                <td style="border:1px solid #000000;width:310px;">
                    Allocation Parameter
                </td>
                <td style="border:1px solid #000000;width:338px;">
                    Current Allocation Method
                </td>
                <td style="border:1px solid #000000;width:558px;">
                    Current Allocation Formula
                </td>
                <td style="border:1px solid #000000;width:337px;">
                    New Allocation Method
                </td>
                <td style="border:1px solid #000000; width:558px;">
                    New Allocation Formula
                </td>
            </tr>
    
                <tr class="item">
                    <td>
                        Allocation Category
                    </td>
                    <td>
                        Allocation Parameter
                    </td>
                    <td>
                        Allocation Method
                    </td>
                    <td>
                        Allocation Formula
                    </td>
                    <td>
                        Allocation Method
                    </td>
                    <td>
                        Allocation Formula
                    </td>
                </tr>
                    
        </table>
    
    

    Please tell me, am I doing something wrong? Thanks....


  • administrators

    hi! you are using jsreport v2, right? if not, in case of .net sdk to use jsreportv2 you should be able to install a pre-release v2 version from Nuget. hmm so far i see that this problem happens when html-to-xlsx in running with phantom as html engine, but when i use chrome as html engine for html-to-xlsx it renders the columns correctly. i did not find a css workaround to make it work with phantom so the best i think will be to try v2 version (which uses chrome by default) and see if helps you



  • Thank you I'll try it :D
    I hope it works


Log in to reply
 

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