-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Captions for Tables and Images #300
Comments
I just analyzed a document.xml file.
I am not yet sure about all the parts (no experiences with ooxml), but this would be the way to go I think. |
I am looking for having this feature on PHPWord as well. 👍 |
Do I also need this feature to update? |
@jonnsn did you ever manage to make it work? I need this feature too. Is it implemented in your fork? Thanks. |
I'm not big expert on OOXML but the xml produced by captions seems like a field according to http:https://officeopenxml.com/WPfieldInstructions.php The key would be to add more functionality to Field class, to support the SEQ command. A quick implementation would consist in just addings two more elements to Field::fieldsArray: 'SEQ Figure' and 'SEQ Table', with standard options. Something like this:
I'm not sure if 'options'=>array('PreserveFormat') is strictly necessary and it could be just emptied, like, 'options' => array() Additional instructions, as explained in http:https://officeopenxml.com/WPfieldInstructions.php can be added, but I don't feel it's really necessary for this purpose. Then, you could just modify addTable and addImage methods to receive an optional 'caption' parameter so that when it's not null you add a text run after the image/table. In such text run, you can do something like:
I know this is not elegant implementation. Table and Figure are just names I've chosen for table and image numbering lists. Edit: Forgot to mention that, as happens in TOC numbers, all fields need to be refreshed manually when opening the document. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Any chance of this being implemented. Also, it would be interesting if a could refer this seq fields in the text. |
In Word you can right-click a table or an image and insert a caption for it which provides a short title or description and can be placed at top or bottom.
This way you can also insert a list of all tables or images in the document.
The Caption-Property (http:https://officeopenxml.com/WPtableCaption.php) seems not to be the right element for this purpose, as this adds a title in the table properties, which is not visible in the document itself.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: