office-interop

VSTO Outlook addin need to save settings, best way?

ε祈祈猫儿з 提交于 2019-12-03 10:51:59
问题 I'm writing a VSTO Outlook add in and i need to save some settings the addin gets from a web service. What is the best way to do this. Registry? does the VSTO addin have full access to do something like that? Maybe a file containing the settings? Thanks in advance. 回答1: You can use a Settings (.settings) file. The advantage of this file, besides having a centralized and strongly-typed repository, is that you can make these settings either application -scoped or user -scoped. Application

Adding hyperlinks in Excel[2007] in C# - Within Excel it self

雨燕双飞 提交于 2019-12-03 06:15:10
Can anybody tell me how we can add a hyperlink in Excel (2007 or later) from a cell in one sheet to a cell in another sheet using Office Interop in .NET (c#) For example: A hyperlink from Sheet1 Cell A1 to Sheet2 Cell B10 What you want to use here is the Hyperlinks.Add method. You can call it with code that looks something like this: Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets[1]; Excel.Range rangeToHoldHyperlink = worksheet.get_Range("A1", Type.Missing); string hyperlinkTargetAddress = "Sheet2!A1"; worksheet.Hyperlinks.Add( rangeToHoldHyperlink, string.Empty,

Using Microsoft Office Interop to create and parse Excel spreadsheets from ASP.NET

ぃ、小莉子 提交于 2019-12-03 04:07:13
I have a new ASP.NET MVC project that has two requirements that require using the Office Interop DLLs to generate Excel spreadsheet files in Excel 2003 format by combining several template files into a multi-sheet workbook and to parse these files once filled in. The files we parse may come back in Excel 2003, 2007 or 2010 format (I believe 2007 and 2010 file formats are identical but feel free to correct me on that). I'd be much happier if we could convince the (internal) clients to drop this requirement. They have been made aware of the risks in this type of work and still want to go ahead

C# Outlook interop and OpenSharedItem for opening MSG files

做~自己de王妃 提交于 2019-12-03 03:49:05
Is there any tutorial or resource I can follow in order to use the OpenSharedItem outlook interop method. My goal is to read MSG files using it (as it can apparently do so). How to: Create a Contact Item from a vCard file and Save the Item in a Folder How to: Import Saved Items using OpenSharedItem Thanks Svetlozar, I've used the resources to create something like the following: Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application(); var item = app.Session.OpenSharedItem("C:\\test.msg") as Microsoft.Office.Interop.Outlook.MailItem; string body =

VSTO Outlook addin need to save settings, best way?

孤街浪徒 提交于 2019-12-03 02:26:35
I'm writing a VSTO Outlook add in and i need to save some settings the addin gets from a web service. What is the best way to do this. Registry? does the VSTO addin have full access to do something like that? Maybe a file containing the settings? Thanks in advance. You can use a Settings (.settings) file. The advantage of this file, besides having a centralized and strongly-typed repository, is that you can make these settings either application -scoped or user -scoped. Application settings will be available to all users of the computer. User settings will be individualized for each user. (I

How to open Outlook's new mail window with prepopulated attachment

耗尽温柔 提交于 2019-12-03 02:14:21
I need to open a new email window with a prepopulated attachment when a user clicks some button or link in my application. Pieterjan Spoelders Old question, but I also ran in to this so here's a copy and paste solution: Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMsg.Subject = "subject something"; oMsg.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat

DateTime.Now.ToString(“MM/DD/YYYY”) contains incorrect month

谁都会走 提交于 2019-12-02 23:06:08
问题 So I have been adding a DateTime.Now.ToString("MM/DD/YYYY") to a List (along with a bunch of other data) and the later writing these lists to individual rows in an Excel workbook. This all works great (it's something I do regularly), except, the month. I have tried exporting it three times and each time I get a different month; the first time 56/26-17, the second 2/26/2017, and the third 14/26/2017.... 回答1: Use this instead: DateTime.Now.ToString("MM/dd/yyyy") "MM" for month. "dd" for days.

How to identify merged column and row in word table?

寵の児 提交于 2019-12-02 22:07:39
问题 I need to read all the text from a table. By using below I can read the content from table. https://1drv.ms/w/s!Ah-Jh2Ok5SuHel9ZpB-V5DZ66DM here I uploaded a dummy Docx file having tables. foreach (Word.Row row in tb.Rows) { foreach (Word.Cell cell in row.Cells) { string cellText = ""; if (cell.Range != null) { cellText = cell.Range.Text.ToString().Trim().Replace("\r\a", ""); } } } But for below 3 cases I face problem. Case 1: Showing in Table 1, two column cells were merged. By using above

How to Freeze Top Row and Apply Filter in Excel Automation with C#

落花浮王杯 提交于 2019-12-02 20:02:25
I have automation to create an Excel document from C#. I am trying to freeze the top row of my worksheet and apply filter. This is the same as in Excel 2010 if you select View > Freeze Panes > Freeze top row, and then after selecting top row Data > Filter. I do not have any idea how to apply the filter but the following is what I tried for freezing the top row and it just froze the entire worksheet. Does anyone have a solution to my problem. The data filter problem is where I need more help so if anyone has a solution to that please enlighten me. Many thanks, KBP workSheet.Activate(); Excel

Processing Microsoft Office Outlook 2003/2007 email messages

♀尐吖头ヾ 提交于 2019-12-02 19:11:32
问题 Summary It's been while now that I receive emails on a specific work-related domain, and I'd like to build up a database based on the information that is provided within these emails messages. These messages are work related items about some needs and requirements in the computer science industry in my corner of the world. I would like to parse or analyze these emails in an automatic way so that I can get recurring information into a database and build a business intelligence-like database