Tag: vsto

VSTO Outlook嵌入图像MailItem

我需要在用户签名之后将图像作为电子邮件的一部分嵌入,而不是在电子邮件的末尾,因为如果我发送大型电子邮件的回复,嵌入式图像将位于底部电子邮件链 如何将图像作为电子邮件内容的一部分嵌入 (不是指向外部图像的链接)? 如何在用户签名后添加此图像? 我正在使用VSTO,VS2008 Fwk3.5和Outlook 2007 这是我的代码: public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { this.Application.ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend); } private void Application_ItemSend(object Item, ref bool Cancel) { if (Item is Outlook.MailItem) { Outlook.MailItem mailMessage = (Outlook.MailItem)Item; //do something to add the image after the signature } }

Excel中的CustomTaskPane不会出现在新工作簿中

我在Excel 2013中添加了一个CustomTaskPane,可以让用户快速搜索照片。 如果用户只打开/创建一个工作簿,它的工作正常。 问题是,如果他们打开另一个工作簿或创建一个新工作簿,任务窗格不会出现在出现的新窗口中。 它只是放在原来的窗口。 我知道这种行为是由于我只是在打开Excel时初始化面板而引起的。 我向ActiveWindow事件添加了一个事件处理程序,以便在打开另一个工作簿时初始化一个新面板。 问题是我无法弄清楚如何判断CustomTaskPane是否已经存在于窗口中。 如果是,则简单地创建另一个CustomTaskPane,因此在该窗口中现在有两个。 我编写了以下代码来处理原始文件并创建一个新文件,但它引入了一些滞后(1-5秒),每次更改工作簿窗口时都会引起用户疯狂。 有没有办法查看窗口中是否已存在CustomTaskPane以避免处置和重新创建新的以避免堆叠重复的任务窗格? Microsoft.Office.Tools.CustomTaskPane PartPhotoTaskPane; Globals.ThisAddIn.Application.WindowActivate += Application_WindowActivate; void Application_WindowActivate(Excel.Workbook Wb, Excel.Window Wn) { if (PartPhotoTaskPane != null) { PartPhotoTaskPane.Dispose(); InitalizePartPhotoViewerTaskPane(EPPF); } else { InitalizePartPhotoViewerTaskPane(EPPF); } } /// /// Start up the part photo viewer task pane /// private void InitalizePartPhotoViewerTaskPane(ExcelPartPhotoFunctions _EPPF) { //intialize the part search […]

检测受密码保护的文档

有没有办法知道doc / ppt / xls文件是否在打开文件之前受密码保护?

VSTO加载项,COMAddIns和RequestComAddInAutomationService

请参阅1st Edit (底部的屏幕截图): 我已经按照本文的说法让Winform应用程序触发VSTO加载项方法: http : //blogs.msdn.com/b/andreww/archive/2007/01/15/vsto-add-ins-comaddins-and -requestcomaddinautomationservice.aspx 在上面的文章的最后,作者提到了一个问题,并试图在这里改进它: http : //blogs.msdn.com/b/andreww/archive/2008/08/11/why-your-comaddin-object-should -derive从- standardolemarshalobject.aspx 我现在已经多次通过代码,并且派生StandardOleMarshalObject以改善exception的方法不起作用 ! System.InvalidCastException: Unable to cast COM object of type ‘System.__ComObject’ to interface type … This operation failed because the QueryInterface call on the COM component for the interface with IID 这是一个repro – 两个项目的目标.Net 3.5: a)创建新的Office> 2007或2010> Excel加载项: namespace ExcelAddIn1 { […]

由于某种原因,combobox是相互关联的

我有以下代码来填充3个combobox: private void PopulateDDLs() { SqlConnection connection; SqlCommand command; SqlDataReader reader; DataTable dt; using (connection = new SqlConnection(“connection string here”)) { using (command = new SqlCommand(“sql query here”, connection)) { connection.Open(); using (reader = command.ExecuteReader()) { dt = new DataTable(); dt.Load(reader); ddl1.ValueMember = “col1”; ddl1.DisplayMember = “col2”; ddl1.DataSource = dt; ddl2.ValueMember = “col1”; ddl2.DisplayMember = […]

如何通过指定发件人地址使用Microsoft.Office.Interop.Outlook.MailItem发送邮件

我正在使用Interop通过Outlook发送电子邮件,但我无法指定发件人电子邮件地址。 我想向来自同一发件人(来自)的多个用户发送邮件。 我需要提一下电子邮件地址。 但是我找不到使用Intellisense的属性,允许我指定它。 请帮忙。 Microsoft.Office.Interop.Outlook.Application olkApp1 = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem olkMail1 = (MailItem)olkApp1.CreateItem(OlItemType.olMailItem); olkMail1.To = txtpsnum.Text; olkMail1.CC = “”; olkMail1.Subject = “Assignment note”; olkMail1.Body = “Assignment note”; olkMail1.Attachments.Add(AssignNoteFilePath, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, 1, “Assignment_note”); olkMail1.Save(); //olkMail.Send();

HRESULT:Worksheet.range上的0x800A03EC

我在Worksheet.range方法上获得了HRESULT:0x800A03EC。 行数超过70K。 Office 2007。 码: Microsoft.Office.Interop.Excel.Range neededRange = currentWS.Range[cell.Cells[1, 1], cell.Cells[nRowCount, nColumnCount]]; 这里我的行数超过65530。 打破这个function。 我观察到它只在行数超过65530时才会中断。

如何使用RtdServer在C#中创建实时Excel自动化加载项?

我的任务是使用RtdServer在C#中编写实时Excel自动化加载项。 我非常依赖Stack Overflow中遇到的知识。 我决定表达我的感谢,写下如何记录所有我学到的东西。 Kenny Kerr的Excel RTD服务器:最小的C#实现文章帮助我入门。 我发现Mike Rosenblum和Govert的评论特别有帮助。