GithubHelp home page GithubHelp logo

docxtemplater_mwe's Introduction

Résumé

  • Le template est template.docx

  • Le résultat est generated.docx

  • Le résultat après ouverture puis sauvegarde sous Word est generated2.docx

  • Les données sont

    {
      "dfecart_actions_decidees": "<p>foo<\/p>",
      "dfecart_delai_mise_oeuvre": "<p>bar<\/p>"
    }

Le fichier generated.docx est malformé sous libreOffice alors que generated2.docx est correctement formé.

Analyse

  1. On décompresse les docx dans des répertoires distincts, puis on linte le fichier word/document.xml (dans document_lint.xml) pour plus de lisibilité
  2. En comparant template/document_lint.xml et generated/document_lint.xml, on constate que la balise html a été remplacée par
    <w:pPr>
        <w:u w:val="single"/>
        <w:pStyle w:val="TextBody"/>
        <w:rPr/>
    </w:pPr>
    <w:r>
        <w:rPr/>
        <w:t xml:space="preserve">foo</w:t>
    </w:r>
  3. En comparant generated/document_lint.xml et generated2/document_lint.xml, on constate que les balises
    <w:pPr>
        <w:u w:val="single"/>
        <w:pStyle w:val="TextBody"/>
        <w:rPr/>
    </w:pPr>
    <w:r>
        <w:rPr/>
        <w:t xml:space="preserve">foo</w:t>
    </w:r>
    ont été remplacées par
    <w:r>
        <w:t>foo</w:t>
    </w:r>
  4. enfin, en supprimant la chaîne <w:pPr><w:u w:val="single"/><w:pStyle w:val="TextBody"/><w:rPr/></w:pPr> du fichier word/document.xml, le word correspondant est correctement interprété.

Conclusion

Il semble donc que les balises

<w:pPr>
    <w:u w:val="single"/>
    <w:pStyle w:val="TextBody"/>
    <w:rPr/>
</w:pPr>

bien que supportées par Word, puissent poser problème (d'ailleurs, Word les retire lui-même du document…).

Notes :

  • Les conversions ont été effectuées depuis la page https://docxtemplater.com/demo/#html afin d'avoir une configuration la plus standard possible
  • Ce bug n'était pas constaté avec la version 3.6.6 du module html

docxtemplater_mwe's People

Contributors

circlecode avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.