-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
LT-21708 Add image and caption textframes to word export #28
Conversation
- Reconfigure images to be inline instead of anchored. (Textframes require inline images; textboxes require anchored.) - Clean up cloning of image runs. - Create a global paragraph style to use for textframes. - Link textframe style to images and their captions and ensure image and associated caption are added to the same textframe. - Ensure Word does not merge adjacent images into the same textframe. This requires adding an empty paragraph between the image textframes, otherwise Word will automatically merge them into a single textframe that can't be split. Change-Id: I331b0d0294c137ea685a42ddac41282c4f7bb146
Change-Id: Ib93eaab6519cecb11e71fe2b22aabb890477a47c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1.
Reviewable status: 1 of 2 files reviewed, 4 unresolved discussions (waiting on @aror92)
Src/xWorks/LcmWordGenerator.cs
line 6 at r1 (raw file):
using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Office2010.Drawing;
Probably remove.
Code quote:
using DocumentFormat.OpenXml.Office2010.Drawing;
Src/xWorks/LcmWordGenerator.cs
line 310 at r1 (raw file):
{ WP.ParagraphProperties paragraphProps = new WP.ParagraphProperties(new ParagraphStyleId() { Val = styleName }); par.PrependChild(paragraphProps);
Nice catch! This fixes some of the problems I was seeing with styles not being applied.
Code quote:
PrependChild
Src/xWorks/LcmWordGenerator.cs
line 1008 at r1 (raw file):
// and it is being added after another image run was previously added from the same piece, // we need to append an empty paragraph between to maintain separate textframes. if (run.Descendants<Drawing>().Any())
If we only care about adjacent images then instead of Any should we check Last?
Code quote:
Any
Src/xWorks/WordStylesGenerator.cs
line 335 at r1 (raw file):
case DictionaryNodePictureOptions pictureOptions: //return new Styles();
Should this be removed?
Code quote:
//return new Styles();
Previously, mark-sil (Mark Kidder) wrote…
This line only functions to verify that the current run contains an image. (Any is preferable to last for that check because the image run could contain e.g. a text object after the image, but if an image is contained anywhere inside the run, the run is an "image run".) We could add a check for if the image runs in question are adjacent. But, looking for adjacent images won't have the expected result because each image run is followed by other runs containing associated items like Caption, Copyright & License that are added to the textframe but do not contain images. My understanding is that a piece corresponds to one lexical entry, and the images are all added sequentially at the end of the piece, after all of the senses. So the order of runs within a piece is: headword run, sense1 run, sense2 run, ... , [image1 run, caption1 run, copyright&license1 run], [image2 run, caption2 run, copyright&license2 run]... In other words, if a piece contains more than one image, they will all be adjacent. Since we need empty paragraphs added between the [] textframe chunks, this corresponds to adding an empty paragraph immediately before any image run that is not the first image run. |
Change-Id: Ida735978efdc85c5c8df2038e99110d6e28ee8f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed all commit messages.
Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on @aror92)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @mark-sil)
Src/xWorks/LcmWordGenerator.cs
line 6 at r1 (raw file):
Previously, mark-sil (Mark Kidder) wrote…
Probably remove.
Done.
Src/xWorks/LcmWordGenerator.cs
line 310 at r1 (raw file):
Previously, mark-sil (Mark Kidder) wrote…
Nice catch! This fixes some of the problems I was seeing with styles not being applied.
Done. Thanks!
Src/xWorks/WordStylesGenerator.cs
line 335 at r1 (raw file):
Previously, mark-sil (Mark Kidder) wrote…
Should this be removed?
Done.
Change-Id: Ic0f54e9582b1bce5b966fa63a3168fd6e730981f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 3 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @aror92)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @aror92)
Change-Id: Ibd4aa655e630c8195ab238e8c6c618c579ba7d98
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @aror92)
This change is