-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizing Table style in Word Output via Quarto #10066
Comments
The docx you shared has some borders But this is due to which Table is used in word document and how it is configured. You can change the default, but changing the style using a reference document. I see that Style in your docx you shared Hope it helps |
Thank you very much for your suggestion. I have modified the table style in the word template as you said, using libreoffice. However, after using the template to generate word, the exported word table is still dotted. |
A few things:
It works for me when I do this (though I am on Windows with Word to use docx files) Changing default Table styles in something that Pandoc still needs to support for Quarto to be able to benefit from it
So for now, one need to follow exactly how reference doc template works with Pandoc to be able to customize a Quarto docx output Hope it helps |
Will Quarto support this new functionality from Pandoc jgm/pandoc#10009 ? I couldn't get it to work using the Quarto Release Candidate 1.6.32 which uses Pandoc 3.4. |
I missed this change by Pandoc, thanks for pointing it out. I believe the PR you linked to is mainly aimed at HTML to docx conversion by modifying the HTML table writer only. If you look at on of the comment in there, you'll see that when editing with Markdown (like in Quarto), there is no easy way to pass attributes. I don't think Pandoc's Markdown reader as a way to read attributes in Grid table. @tarleb can you confirm that passing attributes on Markdown table for Pandoc is not already there ? So the syntax you tried is not seeing ❯ pandoc -t native
| Header 1 | Header 2 |
|----------|----------|
| Val1 | Val2 |
: {custom-style="TableCustom"}
^Z
[ Table
( "" , [] , [] )
(Caption
Nothing
[ Plain
[ Str "{custom-style="
, Quoted DoubleQuote [ Str "TableCustom" ]
, Str "}"
]
])
[ ( AlignDefault , ColWidthDefault )
, ( AlignDefault , ColWidthDefault )
]
(TableHead
(....TRUNCATED....) This is seen as caption by Pandoc. This syntax is Quarto specific and used for various Quarto only feature We do parse specific Table Caption for such content we know. THis happens in our Lua chain So to support such addition for the Docx writers, Pandoc would first need to support passing attributes to markdown table. Quarto could do it though as it already does handle some attributes, but it is a feature request to support this correctly. So for now, this is not working in Quarto (nor Pandoc when working with .md inputs) |
@cderv Thank you so much for taking the time to reply with such detailed information! I've already used the trick of a reference docx and modified the default "Table" style. |
I can confirm that pandoc Markdown, as of now, doesn't offer a way to set table attributes. I've commented in jgm/pandoc#10009 with a possible work-around that uses an extra Lua filter. |
Bug description
I encountered an issue where a table generated with pd.to_markdown in Jupyter Lab loses its borders when exported to Word using Quarto. The borders appear correctly in the PDF output.
How can I resolve the issue of missing table borders in the Word output?
How can I adjust the table style, such as center alignment, when generating Word documents? I am aware of the capabilities of knitr in R Markdown but need a solution entirely in Python.
Thank you for your assistance.
Steps to reproduce
import seaborn as sns
from IPython.display import Markdown, display
mpg = sns.load_dataset("mpg").head(3)
display(Markdown(mpg.to_markdown(index = False)))
: Demonstration of pipe table syntax
bug_demo.zip
Expected behavior
Expected: The table should have borders in both PDF and Word outputs.
Actual behavior
Actual: The table has borders in the PDF output but lacks borders in the Word output.
Your environment
Operating System: Ubuntu 22.04
Jupyter Lab Version:
IPython : 8.18.1
ipykernel : 6.29.4
ipywidgets : 8.1.2
jupyter_client : 8.6.1
jupyter_core : 5.7.2
jupyter_server : 2.14.0
jupyterlab : 4.1.8
nbclient : 0.10.0
nbconvert : 7.16.4
nbformat : 5.10.4
notebook : 7.1.3
qtconsole : 5.5.2
traitlets : 5.14.3
Quarto check output
The text was updated successfully, but these errors were encountered: