Giter VIP home page Giter VIP logo

Comments (1)

TrampHRC avatar TrampHRC commented on September 27, 2024

Actually this problem was not restricted to tables, I had it even on body text.

Fortunately I found where the problem came from. I did not have the right Styles in my template.docx.

I figured it out thanks to the reStructuredText documentation.
It turns out that *this* is actually a disguised version of :emphasis:`this`.

Looking at docxbuilder's documentation Chapter 6.1.2 User defined styles, I thought that :emphasis:`this` would look for a "Emphasis" Word Style.

It turns out there is a built-in "Emphasis" Style, that appears in the Word Home>Styles.
But if you actually look at the implemented Styles (Alt+Ctrl+Maj+S) it does not appear in the list (at least not in my case).

The Fixing Operation:

  • Open my template.docx
  • Apply "Emphasis" to a chunk of text
  • Check that "Emphasis" now appears in the Styles list
  • Save

And then would my generated documents implement *this* as emphasis.

To be clear, you don't even have to define :

docx_style_names = {
   'emphasis': 'Emphasis'
}

The same can be done for **this**. Since it translates to :strong:`this`, you just have to repeat the Fixing Operation with the "Strong" Style.

Side Note:
Because I am French working with a french Word interface, my built-in Styles are translated, so "Emphasis" is called "Accentuation". But i guess the OpenXML backend treats it the same way. I did the Fixing Operation with "Accentuation" and it solved the problem the same way. So I guess, if you also have a translated version of Word, all you need is to find out what "Emphasis" and "Strong" translate to in your language.

from docxbuilder.

Related Issues (17)

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.