How the handle 'Convert' operation?

Add-in Express™ Support Service
That's what is more important than anything else

How the handle 'Convert' operation?
I tried to use TadxRibbonCommand or TadxBuiltInControl, but the events are not fired. 
Tamas Szabo




Posts: 28
Joined: 2008-07-03
Dear Developers,

I'm developing an AddIn-In Express 7.6.1219, with delphi 7, I use office 2007,2010, 2013. I would like

to handle the 'Convert' operation.
I'm talking about the 'Convert' operation which is used to convert a workbook opened in 'Compatibility

mode'. Basically, If I open an '.xls' file(Excel 97-2003 workbook) in Excel 2010; it opens in

Compatibility mode. Excel then provides the 'Convert' button. Using this button, we can convert the

document to an '.xlsx'.

I found in MSO that the IDMSO='UpgradeWorkbook' and BuiltInId=16128.
I tried to use TadxRibbonCommand or TadxBuiltInControl, but the events are not fired.

Do you have any idea or suggestion how to solve the handling of 'Convert'operation?

Best Regards
Tamas
Posted 02 Sep, 2014 06:30:04 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Hello Tamas,

IdMso means you use the Ribbon UI, not CommandBar UI. That is, you need to use TadxRibbonCommand to intercept clicking that button.


Andrei Smolin
Add-in Express Team Leader
Posted 02 Sep, 2014 07:04:33 Top
Tamas Szabo




Posts: 28
Joined: 2008-07-03
Hello Andrei,

I use TadxRibbonCommand, I set IdMso property to 'UpgradeWorkbook', I set the Ribbons property to msrExcelWorkbook, I write a code in OnAction event,
but doesn't enter the event.

Best Regards
Tamas
Posted 03 Sep, 2014 07:09:54 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Tamasz,

Try "UpgradeDocument", not "UpgradeWorkbook"


Andrei Smolin
Add-in Express Team Leader
Posted 03 Sep, 2014 07:58:52 Top
Tamas Szabo




Posts: 28
Joined: 2008-07-03
Hello Andrei,

If I know well -from MS documents- the "UpgradeDocument" was included from office2010 on and not in office2007. I tried it in 2007,2010,2013; but doesn't enter the event. :-(

Best Regards
Tamas
Posted 04 Sep, 2014 07:16:00 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Tamas,

I have just tried to catch clicking on the Convert button and neither "UpgradeWorkbook", nor "UpgradeDocument" ids works for me too.

But I have noticed that WorkbookBeforeSave event is raised immediately after clicking the Convert button. The SaveAsUI parameter is True, the Saved property of the Wb parameter is also True.

Hope this helps you.
Posted 04 Sep, 2014 10:52:43 Top
Tamas Szabo




Posts: 28
Joined: 2008-07-03
Hi Dmitry,

That is the core my problem, I overwrite the OnDocumentBeforeSave event, but cannot decide whether the event was activated, by "Convert" button or "SaveAs" button. Because the same might happen if a non-modified document gets a save as command. That is why I tried to catch clicking "Convert" button.

If you have any idea, that might be helpful.

Thanks in advance.

Best Regards
Tamas
Posted 05 Sep, 2014 09:43:39 Top
Andrei Smolin


Add-in Express team


Posts: 18830
Joined: 2006-05-11
Tamas,

My tests show there are two buttons in Excel 2013: "UpgradeDocument" is the button File | Info | Convert. You can disable the button using the ADXRibbonCommand comonent (see section Intercepting built-in Ribbon controls at http://www.add-in-express.com/docs/net-ribbon-components.php) but you cannot intercept it as Excel ignores the event handler I added to the OnAction event.

Another button is "UpgradeWorkbook". You can add it to the Quick Access Toolbar:
- right-click the Ribbon and choose "Customize Quick Access Toolbar" on the context menu
- In the "Choose commands from" dropdown, select All Commands
- in the left list find the item "Convert to an Open XML..." and click the button "Add > >"

Similarly, you can create a custom tab/group and add the button to that tab. It is interesting that the item is called differently in this case - "Convert".

The "UpgradeWorkbook" can be disabled and it is interceptable.

I think you need to disable the "UpgradeDocument" button. Otherwise, I don't see a way out.


Andrei Smolin
Add-in Express Team Leader
Posted 08 Sep, 2014 10:35:08 Top