none
Anchored Object placement after a page break character in the paragraph RRS feed

  • Question

  • Hi,
    I have two docx files. After unzipping I analyzed the XML for both files. XML has following pattern for both
    ParagraphStart
           pageBreakCharacter
           Anchored Drawing

    ParagraphEnd

    Note there is nothing in the paragraph other than page break character and an anchored image

    However MS Office output for both is different. In one file the anchored image is on same page as the page break character but in the other file the image is on second page.

    Can you please help me understand the reason for the different output.I will highly appreciate your response.

    I am able to share the test files with you.Please let me know how can I provide you the test files

    Friday, January 3, 2014 5:30 PM

Answers

  • Hi Sfarwaha, I have determined that the second paragraph defined in the test document anchoredImgOnSamePage.docx is the cause. Even though the paragraph doesn't contain any text or images it is causing Word to format the document differently. If you remove that from the document.xml it renders as you might expect. If you add it to the other doc, you'll get the same result. I don't know why it's causing the behavior you are seeing, but it IS the cause.

     

    It's probably also worth mentioning that comparing these 2 documents is not a good test case. The 2 documents that you provided have considerably different meta-data. If you look at the app.xml and core.xml files you can see some of the differences. They were originally created by different people, based on different templates, probably with different versions of Word, and I can also tell that the document.xml from anchoredImgOnNextPage.docx was last edited with something other than Microsoft Word.

     

    Also, even if you remove all the text and image content from a document, there is a lot that gets left behind that can become the source of questionable formatting in the future. Test documents should ideally be created from scratch using the same version of Word and based on the same document template. The only differences should be the minimal xml in question.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Thursday, January 9, 2014 3:26 PM
    Moderator
  • Hi Sfarwaha, because there are so many differences between the 2 documents other than what you are comparing, it's hard to say why the second paragraph is causing this. Also, it's worth noting that the second paragraph doesn't contain a RUN, so technically there isn't 'more content' after the first paragraph.

     

    Is there a reason that you are trying to explain the odd behavior difference between the documents? Simply removing the extra paragraph fixes the issue. If you want to pursue this further, I would suggest reporting this odd behavior on the Word for Developers forum since it's not related to the ISO/IEC 29500 specification or extension document.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Thursday, January 16, 2014 6:42 PM
    Moderator

All replies

  • Hi SFarwaha:

    I have alerted the open specifications team regarding your inquiry. A member of the team will be in touch soon.


    Regards, Obaid Farooqi

    Friday, January 3, 2014 5:58 PM
    Owner
  • Hi SFarwaha, I am the engineer who will be working with you on this issue. Please send the files you mentioned to me at dochelp(at)microsoft(dot)com. I will review them and try to determine the cause of the behavior that you are seeing.

    Also, how were the files created? Were they both created with the same version of Microsoft Word, or some other application?


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Friday, January 3, 2014 6:35 PM
    Moderator
  • Hi Sfarwaha, I have determined that the second paragraph defined in the test document anchoredImgOnSamePage.docx is the cause. Even though the paragraph doesn't contain any text or images it is causing Word to format the document differently. If you remove that from the document.xml it renders as you might expect. If you add it to the other doc, you'll get the same result. I don't know why it's causing the behavior you are seeing, but it IS the cause.

     

    It's probably also worth mentioning that comparing these 2 documents is not a good test case. The 2 documents that you provided have considerably different meta-data. If you look at the app.xml and core.xml files you can see some of the differences. They were originally created by different people, based on different templates, probably with different versions of Word, and I can also tell that the document.xml from anchoredImgOnNextPage.docx was last edited with something other than Microsoft Word.

     

    Also, even if you remove all the text and image content from a document, there is a lot that gets left behind that can become the source of questionable formatting in the future. Test documents should ideally be created from scratch using the same version of Word and based on the same document template. The only differences should be the minimal xml in question.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Thursday, January 9, 2014 3:26 PM
    Moderator
  • Thanks for the response Josh.

    So from what you mentioned my interpretation is that this difference in behavior is at the end of the document vs middle of the document.
    If it is middle of document that is there is more content after the paragraph containing page break character then anchored images stays on the same page and otherwise goes to the next page.

    Do you agree?
    Tuesday, January 14, 2014 3:46 PM
  • Hi Sfarwaha, because there are so many differences between the 2 documents other than what you are comparing, it's hard to say why the second paragraph is causing this. Also, it's worth noting that the second paragraph doesn't contain a RUN, so technically there isn't 'more content' after the first paragraph.

     

    Is there a reason that you are trying to explain the odd behavior difference between the documents? Simply removing the extra paragraph fixes the issue. If you want to pursue this further, I would suggest reporting this odd behavior on the Word for Developers forum since it's not related to the ISO/IEC 29500 specification or extension document.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Thursday, January 16, 2014 6:42 PM
    Moderator