OfficeDev / Open-Xml-PowerTools

MIT License
693 stars 26 forks source link

Fix normalization of SDTs in table cells #173

Closed sixlettervariables closed 5 years ago

sixlettervariables commented 7 years ago

This resolves #172 by pulling the W.tcs from their actual parent: W.sdtContent.

ThomasBarnekow commented 7 years ago

@sixlettervariables and @EricWhiteDev This looks good to me. My only question would be whether this deserves a unit test.

Obviously, the current and wrong behavior went undetected by the existing unit tests. Thus, a new unit test should establish the correct behavior. This would also make sure it won't be broken in the future.

sixlettervariables commented 7 years ago

It probably should, however, I've run across a new problem with it, but unfortunately my schedule does not look great for any additional work on this right now.

Sometimes when you nest tables within tables, and have a repeater around the row you get a structure like:

This fails, however, the solution isn't really obvious beyond perhaps only running the code if the sdtContent contains a tc. I played with approaches that included rotating nodes in the tree, but none were clean to implement. In any case, I fixed this by reformatting my document.

ThomasBarnekow commented 7 years ago

@sixlettervariables If the fix as it currently stands solves one issue while possibly not solving others, it is an improvement of the current code. Thus, while we might want to be able to deal with the other situation you mentioned as well, we should likely still go forward with the pull request as soon as you find the time to add a unit test.

tomjebo commented 5 years ago

Closing all PRs as this repo is being archived and will no longer be maintained by Microsoft. The project is licensed for continued use and development by forking to your own repo.