Skip to content
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

Docx writer - support new table features #6315

Closed
jgm opened this issue Apr 24, 2020 · 16 comments
Closed

Docx writer - support new table features #6315

jgm opened this issue Apr 24, 2020 · 16 comments

Comments

@jgm
Copy link
Owner

jgm commented Apr 24, 2020

Add support for new table features introduced in
jgm/pandoc-types#66
including table attributes (including identifier), rowspan, colspan, table head and foot, multiple header lines, row headers, captions that allow block-level content and include an optional short caption.

@danlobo02
Copy link

Is it worth me raising a ticket for open office writer?

@tarleb
Copy link
Collaborator

tarleb commented Apr 19, 2021

I'm starting to work on this now.

@tarleb tarleb self-assigned this Apr 19, 2021
@tarleb
Copy link
Collaborator

tarleb commented Apr 26, 2021

I'm wondering how important it is to ensure support for Word 2007? I'm currently writing against the spec and testing with LibreOffice, so I'd miss any incompatibilities. Is this Word 2007 still worth considering?

@tarleb
Copy link
Collaborator

tarleb commented Apr 26, 2021

E.g., I'm not sure if Word 2007 is able to layout a table automatically. The current version gives bad results, at least in LibreOffice, when no explicit column widths are given. I have a good, working solution, but currently can't test if it works in Word 2007.

@mb21
Copy link
Collaborator

mb21 commented Apr 26, 2021

From what I hear no version of Word follows their own specs very well? While I'm not sure about Word 2007, maybe we should test with a relatively recent M$ Word?

@jgm
Copy link
Owner Author

jgm commented Apr 27, 2021

In our current reference.docx we use the 2006 versions of the schemas (that's Word 2007) I guess.
So is your question is whether we should update to a more recent one, or use a more recent one in addition?
A blank document from recent Word has

<w:document
xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas"
xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex"
xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex"
xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex"
xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex"
xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex"
xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex"
xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex"
xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex"
xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink"
xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml"
xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"
xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex"
xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid"
xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml"
xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex"
xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"
xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk"
xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
  xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex wp14">

Personally I think we could consider not supporting Word 2007, especially in the writer. (For the reader, it would be nice to be able to convert old documents, but I don't see why we need to produce them.) But it depends on what the alternative is. Is there a more recent standard that would support the table features you need?

@tarleb
Copy link
Collaborator

tarleb commented Apr 28, 2021

I hadn't thought that far, my main concern was that I could break the output by not testing with an old enough Word. The docx writer assumes behavior which is not documented in the standard, and I'm worried that I will break things just by relying on the OOXML standard. I don't mind supporting Word 2007 in general, but using a more recent schema might be easier to test.

I know fairly little about MS products and formats these days, so I'm not sure.

@jgm
Copy link
Owner Author

jgm commented Apr 28, 2021

I'm not sure either, and I sure don't have a version of Word 2007 lying around. (I've only been testing with the most recent.)

@tarleb
Copy link
Collaborator

tarleb commented May 1, 2021

Support for new table features:

  • Cells that span multiple rows or columns;
  • Row headers;
  • Header with more than one row;
  • Sub-headers for each table body;
  • Custom cell styles;
  • Custom row styles;
  • Custom table style.

@tarleb
Copy link
Collaborator

tarleb commented May 13, 2021

Related or more specific issues: #2667, #6429, #6670.

@tarleb
Copy link
Collaborator

tarleb commented May 14, 2021

I created issues #7284 and #7285. This should cover all remaining topics when combined with the three issues mentioned in the previous comment. Closing in favor of those other issues.

@tarleb tarleb closed this as completed May 14, 2021
@jgm
Copy link
Owner Author

jgm commented May 14, 2021

Great, I think you've taken care of the most common features already.

@braadworst
Copy link

Hi, I was just wondering if there will be support for firstColumn (and last column) styles for the docx tables. One of the documents we need to generate this have this styling but I cannot make them work even though the styles are nicely set in the reference.docx. I looked in the code and did see a mention for firstColumn but I think it i not used, but I cannot really tell as I am not well versed in Haskell. Thanks

@tarleb
Copy link
Collaborator

tarleb commented Jun 7, 2021

@braadworst I think we can make that work, at least for firstColumn, when we tackle #7284. Could you comment there with a few details about what you need, and how you'd expect to use the feature?

@braadworst
Copy link

@tarleb sorry for not responding earlier, must have missed the notification. That is great news. So basically I need to set the background color and a right border in my case. I've added an image for reference.

Thanks

image

@agusmba
Copy link
Contributor

agusmba commented Sep 6, 2021

@braadworst Note that the specific formating for the first column is defined in the "Table" style, and its on each specific table where you should (somehow, depending on the final implementation) indicate that first-column-formatting should be applied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants