vsto

Programmatic access to Ribbon controls in VSTO

你说的曾经没有我的故事 提交于 2020-01-12 08:04:12
问题 I am writing C# with VSTO in Visual Studio 2008 in order to create an add-in for Office 2007. After I have defined a custom ribbon tab using XML, how do I obtain references to the various controls in the Ribbon? I would like to be able to do things like programatically manipulate the content of an EditBox. 回答1: Direct programmatic access to ribbon control properties through callbacks is not possible. However, Visual Studio has a visual ribbon designer that does allow direct access. I'll

Creating a multi-level bullet list with Word.Interop

余生颓废 提交于 2020-01-12 05:37:05
问题 I need to create a multi-level bullet list via Microsoft.Office.Interop.Word and I am currently struggling with its (horrible) API (again). I've just created the following example (not dynamic yet, just for demonstration purposes) in a VSTO document-level project for Microsoft Office Word 2010 in the programming language C#: Word.Paragraph paragraph = null; Word.Range range = this.Content; paragraph = range.Paragraphs.Add(); paragraph.Range.Text = "Item 1"; paragraph.Range.ListFormat

VSTO: process mail using newmailex before outlook rules move mail

折月煮酒 提交于 2020-01-11 19:56:34
问题 I am creating an addon for Outlook 2007 that reads a mail item when it is received, and then rewrites it. The addon works great, and rewrites the mail for items that do not have an Outlook rule that moves them into another folder. If there is a rule, it is still fine about 50% of the time. The other 50% of the time, the rule moves the mail item before my addon finishes. I get the following error: "The operation cannot be performed because the object has been deleted." I am using NewMailEx

VSTO: process mail using newmailex before outlook rules move mail

删除回忆录丶 提交于 2020-01-11 19:54:07
问题 I am creating an addon for Outlook 2007 that reads a mail item when it is received, and then rewrites it. The addon works great, and rewrites the mail for items that do not have an Outlook rule that moves them into another folder. If there is a rule, it is still fine about 50% of the time. The other 50% of the time, the rule moves the mail item before my addon finishes. I get the following error: "The operation cannot be performed because the object has been deleted." I am using NewMailEx

Read the ActiveCell content in Excel using VSTO

限于喜欢 提交于 2020-01-11 10:44:11
问题 I'm trying to read the ActiveCell from within an Excel Add-in but not getting very far. Anyone any ideas? Excel.Window W = this.Application.ActiveWindow as Excel.Window; Excel.Range R = W.ActiveCell as Excel.Range; MessageBox.Show(R.Value2.ToString()); The Exception being thrown on the last line is: - Cannot obtain fields or call methods on the instance of type 'Microsoft.Office.Interop.Excel.Range' because it is a proxy to a remote object. I tried .Value, and it says: - Property, indexer, or

DEL and BACKSPACE keys get eaten from WebBrowser

你离开我真会死。 提交于 2020-01-11 09:08:48
问题 I have a custom task pane in a VSTO Outlook add-in which hosts a System.Windows.Forms.WebBrowser control. All works well but in web forms DEL and BACKSPACE keys do not work. As if something eats those keys before they get to the browser. Any pointers are appreciated. EDIT: It seems that clicking the WebBrowser does not activate the parent task pane. If I add a simple TextBox as a sibling to WebBrowser and then click TextBox with a mouse, task pane's title bar color changes indicating it got

Excel Custom Task Pane not showing

放肆的年华 提交于 2020-01-10 19:51:46
问题 I'm showing a custom task pane in an excel VSTO add-in, I'm building it and showing it as thus: var ctrl = new CellTaskPane(); var pane = CustomTaskPanes.Add(ctrl, "Custom Sheet"); pane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight; pane.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange; pane.Visible = true; This is being done in the ThisAddin.cs file and it working just fine on my machine, both under a Debug session and with the

In VSTO Addin for Excel how to handle a button click event from active worksheet?

孤街浪徒 提交于 2020-01-07 03:07:00
问题 Currently I am developing an Excel 2010 Addin using VB.NET 2010 with VSTO. The active worksheet has a button, its click event will be handled by its own VBA code. Now I would like to handle the same button click event in Addin without affecting its original VBA function. Is it possible? And how can I achieve this? The pre-requisite of this task is that nothing is allowed to be changed on the Excel Template (including its VBA code). That's why I am trying from the event handling by VB.NET. The

How to add images from resources folder as attachment and embed into outlook mail body in C#

非 Y 不嫁゛ 提交于 2020-01-06 21:10:30
问题 I have a couple of images stored in visual studio project Resources folder, and I have to load them and display on the outlook mail body. Here it is the code: Bitmap b = new Bitmap(Properties.Resources.MyImage); ImageConverter ic = new ImageConverter(); Byte[] ba = (Byte[])ic.ConvertTo(b, typeof(Byte[])); MemoryStream logo = new MemoryStream(ba); LinkedResource companyImage = new LinkedResource(logo); companyImage.ContentId = "companyLogo"; mailitem.HTMLBody += "<img src=\"cid:companyLogo\">"

How to add images from resources folder as attachment and embed into outlook mail body in C#

爱⌒轻易说出口 提交于 2020-01-06 21:10:11
问题 I have a couple of images stored in visual studio project Resources folder, and I have to load them and display on the outlook mail body. Here it is the code: Bitmap b = new Bitmap(Properties.Resources.MyImage); ImageConverter ic = new ImageConverter(); Byte[] ba = (Byte[])ic.ConvertTo(b, typeof(Byte[])); MemoryStream logo = new MemoryStream(ba); LinkedResource companyImage = new LinkedResource(logo); companyImage.ContentId = "companyLogo"; mailitem.HTMLBody += "<img src=\"cid:companyLogo\">"