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

Text Frame incompatibility with Google Docs and LibreOffice 7 #866

Open
lucashmorais opened this issue Mar 30, 2021 · 7 comments
Open

Text Frame incompatibility with Google Docs and LibreOffice 7 #866

lucashmorais opened this issue Mar 30, 2021 · 7 comments

Comments

@lucashmorais
Copy link

lucashmorais commented Mar 30, 2021

Hi all,

The new Text Frame functionality is very useful as it is right now, but I just noticed that it doesn't encode the floating text elements in a way that Google Docs and LibreOffice 7 understand.

The problem seems that both of them expect these constructs to be described as <w:drawing> elements (shapes with text inside), while the current DOCX implementation builds them as <w:framePr> blocks (strictu sensu Text Frames).

I contrast their relevant XML outputs in the following Gist:

Comparing Text Frame XML generated by DOCX and LibreOffice 7

Given that Google Docs is a very popular software (and that LibreOffice is also very convenient in the Linux world), do you feel DOCX could start generating fallback markup for supporting those tools, possibly making use of <mc:AlternateContent>?

Thanks again for the amazing work on this library!
Lucas

@dolanmiu
Copy link
Owner

What does Microsoft Word produce? I believe it uses framePr too

If so, then surely documents created by Microsoft Word would also work in google docs?

@lucashmorais
Copy link
Author

lucashmorais commented Apr 5, 2021

Hi Dolan,

Thanks for the reply. I just checked with a new Word 365 installation. The following Gist includes the whole relevant XML it produces.

document.xml generated by MS Word

The Text Frame is encoded with <w:drawing>, using <w:pict> as a fallback choice, just like Libre Office does. I've confirmed that both Google Docs and Libre Office are able to properly render and edit it.

Curiously, <framePr> is not included as a fallback option, even though the OOXML standard seems to favor this construct.

@kalda341
Copy link
Contributor

I'm not 100% sure, but I believe this is the difference between text frames and text boxes. There are a list of differences between the two here: http://addbalance.com/word/frames_textboxes.htm . It would be great if we could get text boxes supported as I am currently wrestling with positioning text in front of an image, which doesn't seem to be possible without text boxes (unless the image is in the header, which doesn't work for my use case).

@dolanmiu
Copy link
Owner

I always thought that text frames and text boxes were synonymous with each other

This is the only documentation I could find:
http://officeopenxml.com/WPparagraph-textFrames.php

It doesn't have a section about text boxes.

The only references about text boxes I could find was with DrawingML:

https://c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_textbox_topic_ID0EBETWB.html

@kalda341
Copy link
Contributor

Yes, I've had a hard time figuring out how text boxes work as well. It took me a long time to find it on officeopenxml.com - it's under the DrawingML section: http://officeopenxml.com/drwSp-textbox.php

@dolanmiu
Copy link
Owner

Yeah as of now, docx has limited support for DrawingML

If this is to be done, it should be a new Shape({ type: ShapeType.BOX }), or something similar, to account for the other shapes

@SDS712
Copy link

SDS712 commented Sep 8, 2022

Yeah as of now, docx has limited support for DrawingML

If this is to be done, it should be a new Shape({ type: ShapeType.BOX }), or something similar, to account for the other shapes

@dolanmiu Hi, any further update on this?
Drawing out shapes in docx is common usecase for us, and we're stuck at this.
Anyways, Thanks for all the work that you've been doing all these years on this library!

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

4 participants