Replies: 1 comment
-
I think there is two things here:
By doing CSS styles won't be translated to something in DOCX tables, unfortunately. This is something we've done for TYPST output, with what Typst offers - so with some limitation (See |Typst CSS](https://quarto.org/docs/advanced/typst/typst-css.html)) But translating global CSS for the table into OpenXml for the doc table does not seem straightforward for LaTeX or Docx. Pandoc does not support this, and we do not think it is doable in the current situation. The OpenXml spec for the docx table is rather sparse. I know gt R 📦 supports outputting in OpenXml directly, so some Regarding size, I believe column sizes are supported (when in %), though, as they will be handled directly by Pandoc's table. So you could control the table size like this. # Attempting to adjust the table width
feature_result2 = feature_result.cols_width(
cases={
"Region": "50%",
"S Score": "10%",
"T Centroid": "10%",
"Mean": "10%",
"Peak": "20%",
}
) Hope it helps |
Beta Was this translation helpful? Give feedback.
-
Description
Hello Quarto team,
I'm encountering an issue when rendering great_tables (gt-style) tables in Quarto documents. Specifically, the tab_options() settings for controlling table width (e.g., table_width="300%") seem to be ignored when the final output format is Microsoft Word (.docx).
Minimal Reproducible Example
Expected Behavior
The table_width="300%" option should scale the table to a larger, more readable format, especially in Word output, where the default width makes the table appear cramped.
Actual Behavior
In VSCode's live preview, the width responds to tab_options() correctly and html format render correctly .
In Quarto's generated Word document, the table width appears unchanged regardless of the table_width setting.
Environment
great-tables version: 0.17.0
Python: 3.12.9 (via conda-forge)
Jupyter: 1.1.1
Quarto: 1.7.27
Format: Word (.docx)
Editor: VSCode
What I’ve Tried
Tried various units (px, %, and fixed values).
Made sure the modified object was being returned (not the original).
Verified that the issue only appears in Word output and not in HTML or live preview.
Confirmed no errors or warnings during rendering.
Question
Is there a known limitation or workaround in Quarto that prevents gt/great_tables styles like table_width from being respected in Word output? Is there a preferred way to control layout and width of programmatically generated tables in .docx format?
Any insight would be appreciated—thank you for your great work on Quarto!
There are some related posts, but none of them seem to be well solved. I still haven’t found the answer to my question.
I have asked the developer of the gt package, but it seems that this is not a gt problem
posit-dev/great-tables#671 (comment)
Beta Was this translation helpful? Give feedback.
All reactions