C#Excel 2007打印预览功能区 [英] c# excel 2007 print preview ribbon
问题描述
是否可以从C#向excel-2007的打印预览功能区添加一些组,按钮,...,为什么?我想在功能区上放置一些图像,以便用户通过选择图像可以将其放置在工作表上(通过拖动将其放置在工作表上的任何位置)并用该工作表打印... 非常感谢!
is it possible from c# to add some groups, buttons,... to excel-2007's print preview ribbon... why? i wanted to put some images on that ribbon so that user by selecting the image will be able to put it on a sheet (where ever on that sheet by dragging it) and print it with that sheet... many thanks!
推荐答案
执行此操作的方式与将组添加到任何现有的excel功能区选项卡相同.
You do this the same way you add a group to any existing excel ribbon tab.
创建VSTO外接程序项目并添加Ribbon XML类.
Create a VSTO add-in project and add a Ribbon XML class.
在ribbon.xml文件中,这将在打印预览选项卡上为您提供一个按钮的组:
Inside the ribbon.xml file, this will give you a group with one button on the print preview tab:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_Load">
<ribbon>
<tabs>
<tab idMso="TabPrintPreview">
<group id="MyGroup"
label="My Group">
<button id="Test" label="Test"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
为了找到所有内置选项卡,组和控件的名称,请查看此下载内容
In order to find the names of all the built in tabs, groups and controls, check out this download
这将告诉您idMso(Microsoft Office id)属性要使用什么ID.
That will tell you what id's to use for the idMso (Microsoft Office id) attributes.
这里是入门的好地方:
http://msdn.microsoft.com/en-us/library /aa338202.aspx
查看使用回调部分,以获取有关如何处理按钮点击的信息.
Check out the Using Callbacks section for info on how to handle button clicks.
这篇关于C#Excel 2007打印预览功能区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!