473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to hi-jack the button of word\excel 2007\2010 with VSTO

hi, i need to control the right of a Office document in my Visual Studio Projects, so how to enable or disable the print, what abou edit, save.....


i try to fellow the video
How Do I: Hi-jack or Repurpose a Standard Ribbon Button's Command?
to hi-jack button in word, but failed. the video from MSDN is about outlook 2010 , which has some differences with word/excel....

here is my steps:

1. Add a Ribbon XML item in Word Add-In project;
2. Copy and uncomment CreateRibbonExtensibilityObject() to ThisAddIn.cs;
3. Write OnMySave() in Callbacks region of Ribbon1.cs
Expand|Select|Wrap|Line Numbers
  1. public void OnMySave(Office.IRibbonControl control, ref bool cancelDefault)
  2.         {
  3.             System.Windows.Forms.MessageBox.Show("Hi-Jack You");
  4.         }
4. Modify the Ribbon1.xml to:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">
  3.   <commands>
  4.     <comand idMso="FileSave" onAction="OnMySave"/>
  5.   </commands>
  6.   <ribbon>
  7.   </ribbon>
  8. </customUI>
5. Debug and click the Save button, no MessageBox…

details of what i want to do:
0. i want to build a simple file management system (FMS) which just manages Word, or Excel files;

1. different users access the FMS with different roles, such as canView, canPrint, canEdit, canDelete...

2. the Word or Excel files will be stored in database by BLOB data type;

3. if the role of a person named Lyu is canView (which means he can not print the document), so when Lyu download the BLOB from database and open the document automatically with Word or Excel Application of which the print button should be disable.

regards...
Aug 24 '10 #1
0 1288

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: sheldon279 | last post by:
Hi guys. First time poster long time reader. Just wanted to say "Hi" ;) On a side note my Hubby is REAL excited about this new IPO stock GRDX. They just started trading this one like 2 days...
2
by: debashish | last post by:
hi dan Some of my pals are facing a very rare kinda problem. Thay have a Java app that connects to a SQL server instance. Currently they are testing the app on the same comp where SQL server is...
22
by: DJ WIce | last post by:
Hi, I'm looking for a script to get the hi-est z-index on a page. I want my javascript menu to be always on top of the page (moves along on top when you scroll down). Does anyone know how to...
7
by: George Hester | last post by:
Some images I want to link to using the IMG element have a name such as hi%20there.jpg. If I try to do this: <img src="hi%20there.jpg"> the image will not be found for the browser is going to...
5
Hi
by: Kevin Klement | last post by:
* Forwarded by Kevin Klement (1:134/77) * Area : ALT.SUPPORT.ANXIETY-PANIC (ALT.SUPPORT.ANXIETY-PANIC) * From : Kevin Klement, 1:134/77 * To : All * Subj : Hi Hi All, Anyone receiving...
6
by: Niklaus | last post by:
Hi, Can someone point out what is wrong with this code ? How can i make it better optimize it. When run it gives me seg fault in linux. But windows it works fine(runs for a long time). Do we...
8
by: Eric Lilja | last post by:
As the title, says: Why doesn't the following program print Hi Charles<newline> when run? #include <stdarg.h> #include <stdio.h> static void va_arg_example(const char *format, ...) { va_list...
9
by: FERHAT AÇICI | last post by:
hi all! who know arrays on visual basic please tell me.... thanks..
0
by: Tagrislam | last post by:
Hi Hi Hi my name is tagreed , I am from Syria I've seen many places of the world on TV screen and few that I've visited either for fun or/ and business as you know when we travel we meet a lot...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.