none
SaveAsPDFandXPS and ApplicationEvents3::DocumentBeforeSave

    Question

  • Hi. I installed add-in for saving Word 2007 documents as PDF ( SaveAsPDFandXPS.exe ). At Save As menu appears "PDF and XPS". Eventually I found some of my add-in stoped working. My add-in handles ApplicationEvents3 DocumentBeforeSave. Event occurs for each item in Save As menu except "PDF and XPS'. Any ideas? How can I process document before being saved as PDF? Thanks in advance.
    Friday, July 18, 2008 1:44 PM

Answers

  • Hi Syntetic,

     

    You can use Ribbon Customization to override the built-in Command’s onAction call back function.

    See detailed information in the following MSDN articles:

    http://msdn.microsoft.com/en-us/library/aa338202.aspx

    And I write the following codes which work fine on my end:

    <?xml version="1.0" encoding="UTF-8"?>

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">

      <commands>

        <command idMso ="FileSaveAsPdfOrXps" onAction ="SavePDForXPS"/>

      </commands>

    </customUI>

     

            public void SavePDForXPS(Office.IRibbonControl ribbonControl, bool Cancel)

            {

                MessageBox.Show("Try to Print PDF");

            }

     

    Thanks,

    Ji

    Monday, July 21, 2008 6:10 AM

All replies

  • Hi Syntetic,

     

    You can use Ribbon Customization to override the built-in Command’s onAction call back function.

    See detailed information in the following MSDN articles:

    http://msdn.microsoft.com/en-us/library/aa338202.aspx

    And I write the following codes which work fine on my end:

    <?xml version="1.0" encoding="UTF-8"?>

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">

      <commands>

        <command idMso ="FileSaveAsPdfOrXps" onAction ="SavePDForXPS"/>

      </commands>

    </customUI>

     

            public void SavePDForXPS(Office.IRibbonControl ribbonControl, bool Cancel)

            {

                MessageBox.Show("Try to Print PDF");

            }

     

    Thanks,

    Ji

    Monday, July 21, 2008 6:10 AM
  • Thank you, Ji!
    Monday, July 21, 2008 8:22 AM
  • This works fine, but how do I call the original onAction function which displays the Publish Wizard after I have run my software which validates the document?
    Saturday, November 29, 2008 3:39 PM