none
Custom XML Node for Word UPPERCASE/LOWERCASE/SentenceCase/ToggleCase changes RRS feed

  • Question

  • Hi,

    I am working on document generation system using word 2007/2010, open xml sdk and custom xml.

    When case changes are done in word document  the CASE informatio is not captured in custom XML, insttead the CASE info is getting applied to text node itself.

     

    Please see the below XML for upper case word “TEST”. 

     

     

    <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">

           <w:body>

                 <w:p w:rsidR="00F664F9" w:rsidRDefault="00567468">

                        <w:r>

                          <w:t>TEST</w:t>

                        </w:r>

                 </w:p>

                 <w:sectPr w:rsidR="00F664F9" w:rsidSect="00F664F9">

                        <w:pgSz w:w="12240" w:h="15840" />

                        <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0" />

                        <w:cols w:space="720" />

                        <w:docGrid w:linePitch="360" />

                 </w:sectPr>

           </w:body>

    </w:document>

     

    But in my application, there are scenarios where the TEXT in word document will be replaced with actual values in runtime. Lets say in design time word document has word "First Name" whose actual value "Srinivas" will be replaced in runtime.

    So if user applies UPPERCASE/LOWERCASE/SENTENCECASE/TOGGLECASE to "First Name" then the same CASE information should be apllied to generated value "Srinivas".

     

    There are scenarios like the user might select mutiple paragrahs in the document or whole document and may change the CASE.

     

    How to handle this scenario?

    Does Word provide any events for CASE changes?

     

    Thanks,

    Srinivas Akella

     

     

    Friday, March 25, 2011 9:04 AM

Answers

  • Hi Srinivas,

    I'm really not sure if this will help but Word has a number of Macros that you might be able to modify and "trap" when a change in the document is occurring. For example, there is a ChangeCase macro.

    Alt + F8 will bring up the Macros dialog and then view the list by selecting Word Commands.

    As I said ... I'm not sure if this will help, but then maybe?


    Regards
    • Marked as answer by Bruce Song Friday, April 8, 2011 11:45 AM
    Monday, March 28, 2011 1:42 PM

All replies

  • Hi Srinivas ,

    Thank you for posting.

    After reading your post, I felt that I was not very clear about the problem.

    Could you please let me know why do you want the text change information? When do the users apply CASE change to "First Name" then the same CASE information should be applied to generated value "Srinivas"?

    As far as I know, there is no such events for CASE changes, please take a look at this article: http://social.msdn.microsoft.com/Forums/en/vsto/thread/976b13e0-394a-4528-852e-f591051ea6e9

    http://www.vbaexpress.com/forum/archive/index.php/t-15718.html

    I hope this can help you and I will do further research with your detailed information. Please just 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, March 28, 2011 7:13 AM
  • Thanks Bruce.

    • I am working on an application which has word 2007/2010 integration. Basically it is document generation system.
    • If a document is opened in Word (through our application) all the pagraphs in the document will be displayed to the user. Here there are some words which are static i.e. whose actual values will be replaced when saving to DB based on some business rules after user has done modifications to the document.
    • When user modifies the document content by UPPERCASE/LOWERCASE/SENTENCECASE/TOGGLECASE features, our application should apply the same CASE during runtime business processing.
    • But Word is not supporting any events or custom xml nodes for this kind of changes.

    So how would I proceed on this?

    Thanks,

    Srinivas Akella

    Monday, March 28, 2011 10:28 AM
  • Hi Srinivas,

    I'm really not sure if this will help but Word has a number of Macros that you might be able to modify and "trap" when a change in the document is occurring. For example, there is a ChangeCase macro.

    Alt + F8 will bring up the Macros dialog and then view the list by selecting Word Commands.

    As I said ... I'm not sure if this will help, but then maybe?


    Regards
    • Marked as answer by Bruce Song Friday, April 8, 2011 11:45 AM
    Monday, March 28, 2011 1:42 PM
  • Hi Srinivas,

     Have you figured out your problem yet, and does the suggestion help you? If you still have any concern on the thread, feel free to follow up. we will try  to help you.

    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, April 5, 2011 7:25 AM