How to implement a simple add-in for MS Excel on C++ - c++

I need a help for implementing add-in for Excel 2010 or higher on C++, the only functionality of this add-in is renaming of current Excel sheet.
The add-in should create new custom tab on the Ribbon with name: “Test Add-in”, this tab contains group with name “My Functionality”, this group contains large button with some picture with name “Rename Current Sheet”. After clicking on the button, I should show the following dialog:
User can enter new name, click ok and after this, the name of current sheet will be changed.
I understand that I need to use #import directive for getting references to Office API, use ATL to wrap COM objects, MFC or WTL to create dialog, but I I'm not opposed to using the mentioned methodologies.

Related

Accessing xml to edit ribbon elements

I am using BCGPro for ribbon control in my VS15, MFC project. The ribbon syntax is saved in a form of xml. I want to create a tool that would load that ribbon.xml as a CBCGPRibbonBar element.
The problem is that it needs a resourceId, which is defined in rc2 of the respective project in which the ribbon is implemented, and i am trying to access that xml from another external project.
Project_1 -> ribbon implemented
Project_2 -> tool, that needs to load ribbon xml of Project_1.
P.S. please take care that it is not native MFC ribbon, but a BCG control.
Please suggest if anyone got any clue to perform this stunt. Thanks in advance!

Is there visual representation in Visual Studio 2013 like in Netbeans?

I want to ask if there is in Visual studio 2013 a visual representation of my application like in NetBeans where i can add thing like containers or controls ex. Button or checkbox?
I know that one is Java and one is C++ (in my case).
Depending on the type of project that you create, you will be presented with different options to populate the UI. If you create a xaml or winforms project, it will present a toolbox on the left hand sidebar. These elements can be dragged onto your form and events can be added via the properties window on the right hand sidebar.
It's pretty easy to use and master within an hour or so. Don't be afraid to whip up a small test project to sample the different elements available.
[EDIT] - Once you have completed the creation of the win32 project, you'll need to add a new windows form. You do this as so:
right click on the solution explorer root (possibly called Win32Project1)
click the add item on the popup window
choose new item
select the Visual c++ node->UI
choose the Windows Form item and add
Now you will see the form on screen. Next, navigate to View Toolbox (CTRL+W, X). Now choose you control (start off in the All windows forms section). From here drag the desired control onto the form and party on it :). Thereafter, it's just a matter of adding code to the events (or creating class objects and referencing them via the events)

How to modify captions of windows created by visual studio project wizard

I have craeted a Visual C++ project using studio 2010 wizard in which I have added things like FileView, ClassView, PropertiesWindow, OutputWindow etc, with the help of wizard. Now I am interested in changing the default captions/names of one of these items let's say FileView. The FileView has a resource string "IDS_FILE_VIEW" associated with it with value "File View" which is displayed as a caption of the FileView window. If I change the value of above mentioned string in the resources it does not change that caption and still shows "File View" as a caption. Could anyone suggest me that how can I customize captions and other features of such common windows created through studio wizards?
Thanks a lot.
You don't say, but I assume from the "IDS" that you are using the MFC libraries.
In MFC, the resource strings like IDS_FILE_VIEW are defined and used by the designer but it is quite possible to override them. Changing the IDS_FILE_VIEW resource's value will indeed change what is displayed when that resource is used, but you may have (inadvertently) prevented that resource being used where you expect.
I would check through your project files to see where this and related names appear and verify that there are no inconsistencies.
HtH
Ruth

MFC: How to create options dialog with listbox and multiple pages?

Developing using Visual Studio 2010 C++ and MFC. I want to create an options (preferences/settings) dialog box that can display several options. After considering many different options dialog box UIs I think I like the listbox-with-multiple-pages-style similar to visual studio's option dialog box (but I don't need the treeview, a list box is fine).
What's a good way to implement this? Do I use a CListBox and then handle the selection event to load up the individual pages? I'm new to MFC, what would the individual pages even be? Something like a panel? Ideally I would design them in the resource editor and then be able to load them up.
Take a look at http://www.codeproject.com/KB/dialog/embedded_dialog.aspx for one possible way of doing this.
The individual property pages can be designed as dialogs in the resource editor, and then the relevant page can be displayed in your main dialog depending on the selection in the list box, by handling the LVN_ITEMCHANGED message.
See CPropertySheet and CPropertyPage classes. This allows you to easily manage a properties window with several views.

How to hide the list ribbon in XSLT List Web part in SharePoint 2010?

In SharePoint 2010, I have a custom list "Clients" on a site. On the home page of the site, I have added a Clients List Web Part. When I access the home page in a browser and click anywhere in that list, it displays the "List Tool" ribbon group which has "Items" and "List" ribbons. I do NOT want these ribbons at all when clicking on the list. How do I achieve this? Should I disable the click event on the list so these ribbons do NOT appear? How do I disable the click event on the list? Or What should I do to hide these ribbons when clicking on the list?
Basically I want it to behave same as content query web part. In content query web part, if you click anywhere in it, it doesn't show up any extra ribbons. I want the same behavior with list web part.
Thanks
Hitesh
One approach would be to follow the tutorial outlined in this blog post: Remove actions from the ribbon: SharePoint 2010
The end result is a UserControl that you can place on any page and "trim" (i.e. hide) certain portions of the Ribbon: entire tabs, or individual groups or buttons on the ribbon.
If you follow the prescribed solution from the blog, then you would add the following lines in your Page_Load event:
SPRibbon ribbon = SPRibbon.GetCurrent(this.Page);
if (ribbon != null) {
ribbon.TrimById( SPRibbon.ListTabId );
ribbon.TrimById( SPRibbon.ListItemTabId );
}
Additional ribbon element IDs can be found at:
As referenced in the CMDUI.xml XML file
As defined by public fields on SPRibbon (used in example above)
Of course, the downside to using this approach is that the particular ribbon elements you hide are hard-coded in the UserControl. To get around this, I used the UserControl as a basis to create a Web Part that allows you to define which ribbon elements to hide via a property. It works great and is generic enough to be applicable to many different scenarios.