office-interop

Visio add-in getting the font size of shape's text

落花浮王杯 提交于 2019-12-25 03:03:19
问题 I'm trying to determine the size of the font of a shape's text. When I use Visio as a user, I can see this value in the Shape sheet (under Character->size ) However I'm not able to understand how to access it programatically, for reading. Which section, Row and Cell indexes should I use? Or maybe use the Characters object of the shape? 回答1: I was successful in obtaining the formula by: string fontSize = shape.CellsSRC[(short) Visio.VisSectionIndices.visSectionCharacter, (short) Visio

How to reply to an Outlook mailitem using .net

二次信任 提交于 2019-12-25 01:44:39
问题 I am writing an Outlook 2007 Add-in which composes a business quote in response to an email query. I compose the quote using Windows forms. Everything works fine until I get to the point of replying to the original message with the quote information. private void btnSend_Click(object sender, EventArgs e) { Outlook.MailItem theMail = ((Outlook._MailItem)quote.mailItem).Reply(); theMail.Subject = "This is the quote"; theMail.Body = <Some html composed elsewhere>; Outlook.Recipient rcp = theMail

How to add a checkbox control to an Excel cell programatically or check or uncheck an existing checkbox

别等时光非礼了梦想. 提交于 2019-12-25 01:17:40
问题 I am using the Excel COM object in C# and want to insert a checkbox dynamically to an Excel sheet and make it checked or unchecked based on a condition. OR how can i mark as checked an existing checkbox in the Excel sheet programatically. I have looked around and I didn't find any solution. 回答1: You can always record a macro in MS Excel and it will give you a good idea of what needs to be done with Excel object in order to achieve something. For example, when recording macro for your problem,

UWP sideload app that use Microsoft.Office.Interop.Outlook COM

こ雲淡風輕ζ 提交于 2019-12-24 23:52:34
问题 Hello Im updating a UWP app that we use in ouroffice. Before when we use it to send email it uses the Windows.ApplicationModel.Email.EmailMessage however this i really limited. So i would like to use Microsoft.Office.Interop.Outlook instead to create the email directly with outlook My test code looks like this. try { List<string> lstAllRecipients = new List<string>(); //Below is hardcoded - can be replaced with db data lstAllRecipients.Add("info@test.com"); //lstAllRecipients.Add("chandan

Add contact to distribution list programmatically

二次信任 提交于 2019-12-24 15:06:04
问题 I am really stuck in this issue and searching didn't yield me a lot. Most answers I found either get Contacts not add them or use LDAP. The best I've been able to do is display the window where you add people to the distribution list but I am not able to do that part programmatically Here is the my best attempt: Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); NameSpace oNS = oApp.GetNamespace("MAPI"); //Get Global Address List.

Excel.Range Copy() works very slowly

你说的曾经没有我的故事 提交于 2019-12-24 14:29:45
问题 I'm building a report in which try to copy the previous row cell styles in the following for (int i = 0; i < DataSource.Length; i++) { int rowNumber = i + s; Excel.Range RngToCopy = ObjWorkSheet.get_Range("A" + rowNumber.ToString(), "K" + rowNumber.ToString()); Excel.Range r = ObjWorkSheet.get_Range("A" + (rowNumber + 1).ToString(), "K" + (rowNumber + 1).ToString()); RngToCopy.Copy(Type.Missing); r.Insert(Excel.XlInsertShiftDirection.xlShiftDown); r.PasteSpecial(Excel.XlPasteType

Why am I getting an illegal value error using PpShapeFormat in Office 2013 Interop

孤人 提交于 2019-12-24 13:19:32
问题 I wrote an MS JScript utility (for use in SmartBear's TestComplete) that exports images that are embedded in a Word document to PNG files on disk. When I run this utility on Win7, with Office 2010, everything works fine. But when I run it on Win8 with Office 2013, I get an "illegal value" error when passing the PpShapeFormat filter to the Export method. Here's the relevant portion of my script: //get the list of shapes from the word doc, and how many there are var iShapeList = DocObj

Accessing a table in an excel spreadsheet using C#

∥☆過路亽.° 提交于 2019-12-24 12:44:34
问题 I'm writing a program (in C#, using Microsoft.Office.Interop.Excel) that reads in an Excel spreadsheet and applies filters, etc. to the data within. However, I'm struggling with a few issues, namely how to "get" a table object representing the table of data I am working with. I'd like to be able to access columns by their headers as well, so I assumed that I would require the DataTable namespace. I can't seem to figure out what to do, however. Here is the rough framework of my code: private

Workbooks.Open method throwing HRESULT: 0x800A03EC

亡梦爱人 提交于 2019-12-24 12:34:39
问题 I am opening an excel file using object missing = Type.Missing; xlWorkBook = xlApp.Workbooks.Open(strFilePath, missing, false, missing, missing, missing, true, missing, missing, missing, missing, true, missing, missing, missing); and it throws HRESULT: 0x800A03EC It was working fine with office 2010 but after updating office libraries to version 15 and when deployed to server which had office 2013. I started getting this message. I have also tried giving permission to Excel Object in

Microsoft.Office.Interop.Word.Document won't prompt to save changes to single document without _Application.Quit()

六眼飞鱼酱① 提交于 2019-12-24 12:28:01
问题 Before I begin, I have googled this to death and there are many posts about how to prevent the save prompt. I am having an issue showing the save prompt. I am building the template editing portion of a document generation system in C#. The system will edit 'dot' and 'dotx' files. Before outlining the problem, the environment I am using for development is running Visual Studio 2010 and Word 2010. It will eventually run on other versions, but i would like to get these versions functional first.