none
Changing formatting while attaching the template RRS feed

  • Question

  • Hi,

    This is Gururajan. I am a word developer. The below is my query.

    When i attach a word template in Word 2010, some paragraph styles and formatting in the word document get changed. I could not able to find a exact solution. Can anyone provide a solution for this issue? I have attached the screen-shots for your review.

    Thanks in Advance,

    Gururajan

    Wednesday, March 4, 2015 1:38 PM

All replies

  • Open the document.

    On the Developer tab of the ribbon, in the Templates group, click Document Template.

    Make sure that the check box "Automatically update document styles" is clear (not ticked).

    Click OK.

    Now styles should not change when you attach a different template to the document.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, March 4, 2015 3:16 PM
  • Hi,

    I tried the above solution before, but i want the paragraph and character styles to be applied on the document. When the check box (Automatically update document styles) is clear, the styles (character and paragraph) do not apply on the document. I have to apply the styles on the document that are occurred in the attached template and the same time the formatting should not be changed. It would be more helpful if you could provide a solution for this.

    Thanks in Advance,

    Gururajan

     


    Gururajan

    Thursday, March 5, 2015 7:06 AM
  • Styles ARE formatting, so your requirements are contradictory.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Thursday, March 5, 2015 2:49 PM
  • Hi,

    Actually i had loaded all the paragraph and character styles in a template, because the loaded styles to be applied in the document. When the check box is clear, the styles do not apply in the document. So when you just attach the template, the formatting (bold or italic) gets changed in some paragraphs. Some of the paragraphs also appear in list format that i mentioned in the screenshot. I hope this is clear with you. Kindly provide a solution for this.

    Thanks in Advance,

    Gururajan


    Gururajan


    • Edited by GururajanK Friday, March 6, 2015 6:50 AM
    Friday, March 6, 2015 6:48 AM
  • If a style is not italic in the document and italic in the template, the text will become italic after ticking the check box "Automatically update document styles". I really don't understand your problem.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Friday, March 6, 2015 11:15 AM
  • Hi Gurujan

    A question about the document you're using for testing: Was ALL formatting applied to text in this document applied using styles? Or was some of the formatting applied using direct formatting tools (Bold or Italics buttons, for example).

    Changing the style defintions by attaching a template and having the option suggested by Hans will affect ONLY text that was formatted with a style. Text that has been formatted directly will usually NOT be affected: direct formatting will take precedence over style formatting. There are commands to remove direct formatting, but you want to be very sure this is what you want to do...

    Numbering doesn't import very well via updating styles - this is a known issue. It's difficult to give you a recommendation without knowing more about the style and numbering definitions of both the original document and the template you're attaching - and what, exactly, you want to have happen.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, March 6, 2015 7:17 PM
    Moderator
  • Hi,

    All the character styles (formatting such as bold, italic, underline, etc) and paragraph styles such as headings, para, etc. are loaded in a template. I just open the word application 2010 and open the raw manuscript for styling, and then manually attach the template with "Automatically update document styles" check box option is enabled for styling the document. When i just attach the template before styling the document in a raw manuscript, the formatting gets changed in some of the paragraphs as mentioned in the screenshot. What i want is, when i attach a template in word with the word option "Automatically update document styles" check box is enabled (then only i apply the styles in a document, otherwise the styles do not apply in the document), the formatting (bold, italics, etc) should not be changed and any changes like changing some paragraphs into list type etc. should not be happened in the document. I look forward to hear solution from you.

    Thanks in Advance,

    Gururajan


    Gururajan

    Tuesday, March 10, 2015 10:56 AM
  • Hi Guruajan

    We simply don't have enough information about the "raw manuscript". Obviously, someone has done some formatting in it, otherwise it wouldn't have bold, bullets and other things in it. Without knowing the source of this formatting it's impossible to know exactly why things are happening when you attach a template and update the styles.

    Perhaps it would make more sense to copy the styles from the template into the document rather than using Update Styles? That would be the Application.OrganizerCopy method in Word's object model. Do you see any different result if you go that route? (And yes, I know it's a lot more code to type, so you might want to start with a couple of "problem styles".)

    But the most likely explanation - at least for what you show in your screen shot - is that the style of the same name in the template (h4, for example) is defined (1) with outline style numbering and (2) as italics and not bold. If you don't want that then you need to change the style definition in the template before attaching it.


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, March 10, 2015 7:16 PM
    Moderator
  • Hi,

    Thanks for your thoughts on this. I just want to mention that the style "h4-sub-head2" is already present in the document itself. After attaching the template, i will change the style (h4-sub-head2) to something else (my input style in the attached template). And also, I copied the styles from the template using "CopyStylesFromTemplate" in VBA, but the same result was happened. Okay let me try some other ways if any to rectify this problem.

    Thanks in Advance,

    Gururajan


    Gururajan

    Wednesday, March 11, 2015 6:36 AM