Free Support Forum - aspose.com

Word Application events and ribbon buttons disabled implementation using ASPOSE WORD

Hi ,

we are migrating and application from VB6 to DOTNET during this migration all the Word functionality that is present in VB6 should be converted using Aspose.words(.net).

We have two variables related to Word object in VB6

Private WithEvents objWordApplication As Word.Application

Private WithEvents objWordDocument As Word.Document

So objWordApplication is Application object and objWordDocuments is document object. Since it is WithEvents we can associate event with this objects. So there are few application object events like

objWordApplication_DocumentOpen - Occurs when the document is opened to application object

objWordApplication_NewDocument - Occurs when a New document is added to application

objWordApplication_DocumentBeforeClose - Occurs when the Document is closed in application

objWordApplication_DocumentBeforePrint - Occurs when user clicks on Print in Word application

objWordApplication_DocumentBeforeSave - Occurs when user clicks on Print in Word application

there is even codes to control the New button and Open button in the ribbon of word application (to disable it or not) like below

With objWordDocument
With .CommandBars(strSTANDARD_COMMANDBAR)
.Controls(lNEW_BUTTON).Enabled = ppvfNewButtonWasEnabled
.Controls(lOPEN_BUTTON).Enabled = ppvfOpenButtonWasEnabled
End With
With .CommandBars(strMENU_BAR_COMMANDBAR).Controls(lFILE_MENU)
.Controls(lNEW_MENUITEM).Enabled = ppvfNewMenuItemWasEnabled
.Controls(lOPEN_MENUITEM).Enabled = ppvfOpenMenuItemWasEnabled
End With
End With

can you please let me know if there a possiblity to control the Word Application events using ASPOSE.WORD and controls the buttons in tool bar or ribbon of word application using ASPOSE.WORD.

Thanks and Regards,

Ujwal.

Hi Ujwal,


Thank you for considering Aspose.Words.

When you load a Word document into Aspose.Words, it builds a DOM (Document Object Model) in memory which allows you to programmatically read, manipulate and modify content and formatting of a Word document. You can simply obtain detailed programmatic access to document elements and formatting by using the classes of the Aspose.Words DOM.

Regarding your request of callback events, I have logged a ticket in our bug tracking system as WORDSNET-7518. We also have an existing request for ‘Providing printing events in the API’ (WORDSNET-7447). Your request has been linked to the appropriate issues and you will be notified as soon as these are available. Sorry for the inconvenience.
Ujwal:
can you please let me know if there a possiblity to control the Word Application events using ASPOSE.WORD and controls the buttons in tool bar or ribbon of word application using ASPOSE.WORD.
I am afraid there is no way you can achieve this using Aspose.Words and it is simply outside the scope of Aspose.Words.

Please let me know if I can be of any further assistance.

Best regards,

Hi Ujwal,


Thanks for your inquiry. I’m afraid hooking into the Application events of a Microsoft Word document is out of the scope of Aspose.Words. Depending upon what your macro does you can just convert the code into Aspose.Words, logic, otherwise you may need to leave those parts as a VBA macro in a document. Aspose.Words fully preserves such macros during open and save of documents.

If we can help with anything else, please feel free to ask.

Thanks,