Convert html table to XLSX

Asked

Viewed 295 times

-3

I can only convert to .xls or .pdf but I need to .xlsx. The simpler the code, the better.

------ Requested example ------

I use the Salesforce platform, it has some changes in relation to html but I was able to adapt perfectly, without any problem.

<!--IMPORTAÇÕES NECESSÁRIAS-->
TODAS IMPORTAÇÕES SÃO ENCONTRADAS NO SITE DO COMPONENTE
https://www.travismclarke.com/tableexport/ -->

    <apex:includeScript
`value="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" />
    <apex:includeScript value="{!$Resource.xlsxcoremin}"/>
    <apex:includeScript value="{!$Resource.Export2ExcelJS}"/>
    <apex:includeScript value="{!$Resource.TableExportJS}"/>
    <apex:includeScript value="{!$Resource.TableExport2JS}"/>
    <apex:includeScript value="{!$Resource.FileSaverJS}"/>`


`<table id="tabela" style="width:100%">
            <tr>
                <th>CABEÇALHO</th>
            </tr>
            <tr>
                <apex:repeat value="{!registro}" var="reg">
                    <td><apex:outputText value="{!reg.Name}"/></td> 
                    <td><apex:outputText value="{!reg.Complemento__c}"/></td>
                    <td><apex:outputText value="{!reg.Data__c}"></apex:outputText></td>
                    <td><apex:outputText value="{!reg.Banco__c}"></apex:outputText></td>
                </apex:repeat>
            </tr>
        </table>
<input id="clickMe" type="button" value="clickme" onclick="exibeOpcs();" />
`

`function exibeOpcs(){    
            $("#tabela").tableExport({
                headings: true,
                footers: true,
                formats: ["txt", "xlsx"],
                fileName: "Planilha",
            });
        }`
  • What have you tried to do? Want to export a <table> for .xlsl?

  • I will actually use another data component, but I tried everything already, using table, plain text and everything I found ahead. Any path that leads to the . xlsx will already help, no matter much the input component.

  • @Miguel, think that any simple <table> will be used. I haven’t finished the code because I don’t know how to do what I want yet.

1 answer

-1


  • 1

    It is not necessary to write an answer just to say "thank you". The best way to thank is accepting the answer that helped you. - From Review

  • 2

    You can give an example of how to use this component?

  • 1

    @GOKUSSJ4 Colleague, the situation is that no suggestion here was helpful, I thanked those who tried, but it was I who found the perfect solution to my situation and wanted to share.

  • 1

    The problem is that you answered yourself but did not demonstrate how you solved your problem, just put a link where supposedly has the solution. And answers only with links are not recommended. The solution helped you, but it might be interesting to edit the answer showing how you solved it, so that it serves as an example for others with similar problem :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.