locked
Open XML - Using stylePaneFormatFilter attribute to show “Normal” style along with the custom styles and clear formatting option RRS feed

  • Question

  • want to make changes programatically to the Word 2007 document so that It ONLY displays the "Normal" style, all the custom styles which user created and the "Clear formatting" option in the style pane.

    Now I able to show the custom styles and the clear formatting option but not the Normal style.

    From :- http://msdn.microsoft.com/fr-fr/library/documentformat.openxml.wordprocessing.stylepaneformatfilter.aspx

    0x1000 - Specifies that a style should be present which removes all formatting and styles from text. 0x0002 - Specifies that only styles with the customStyle attribute should be displayed in the list of document styles.

    I sum the hex values above to get 1002 to show both Custom Styles and the Clear Formatting. But I dont see a way to show the "Normal" style as thats is built in style. However, when you apply clear formatting on any paragraph, by default word applied Normal style. That said, users want to see "Normal" style. :-(

    Is there a way to do this? Any help is appreciated.

    Wednesday, May 4, 2011 2:18 AM

All replies

  • Hi Ashishmgupta,

    Thank you for posting.

    I have read your post carefully, but I am not clear about your requirement. From the title, I think it not possible to keep the paragraph with the custom styles after using the clear formatting option.

    >>I sum the hex values above to get 1002 to show both Custom Styles and the Clear Formatting

    After applying clear formatting on the paragraph, word will apply the Normal style, then any custom styles will be removed.

    Hope this can give you the hint and feel free to follow up.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Marked as answer by Bruce Song Monday, May 16, 2011 7:43 AM
    • Unmarked as answer by Bruce Song Tuesday, May 17, 2011 7:35 AM
    Thursday, May 5, 2011 6:54 AM
  • Hi Ashishmgupta,

    Have you resolved your problem yet, and does the suggestions help you? If you still have any concern on the thread, feel free to follow up.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 9, 2011 8:51 AM
  • "After applying clear formatting on the paragraph, word will apply the Normal style, then any custom styles will be removed."

     

    I dont want to keep the custom style after applying the normal style. Thats not the goal.

    The goal is to have all the options in the style pane - "Clear Formatting", "Normal" style and all the Custom styles. I am able to show the "Clear Formatting" and all the custom styles by setting the 1002 .

    <w:stylePaneFormatFilter w:val="1002" />

    However, I am not able to show the "Normal" style. Could somebody help me in that.

     

    Thanks,
    Ashish

    Monday, May 16, 2011 2:41 PM
  • Hi Ashish,

    I think it not possible to custom styles and "Normal" styles at the same time.

    Then, how about setting the value to be 0x1000? Will this show the "Normal" style?

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, May 17, 2011 7:55 AM