office-interop

Programmatically encrypt Outlook email using Inspector

百般思念 提交于 2020-01-11 11:02:50
问题 I'm using C# with Outlook Object Model (Redemption is not an option for me due to licensing) and I'm having difficulty programmatically encrypting an email message before sending it. I can successfully get a reference to the CommandBarButton which supposedly represents the Encrypt button (Id 718 according to online examples), but I cannot programmatically depress it. I tried using both the CommandBarButton Execute() method and using SendKeys (not sure if sendkeys is even valid in this context

Determine Excel Version/Culture via Microsoft.Office.Interop.Excel

本小妞迷上赌 提交于 2020-01-09 05:34:22
问题 How can I achieve that in .NET/C#? 回答1: You could use this code snippet: (taken from one of my projects, so not guaranteed to work out of the box) Microsoft.Office.Interop.Excel.Application tExcel = new Application(); CultureInfo cSystemCulture = Thread.CurrentThread.CurrentCulture; CultureInfo cExcelCulture = new CultureInfo(tExcel.LanguageSettings.get_LanguageID( Microsoft.Office.Core.MsoAppLanguageID.msoLanguageIDUI)); try { Thread.CurrentThread.CurrentCulture = cExcelCulture; double

Microsoft.Office.Interop.Outlook Not working on IIS 8

时光毁灭记忆、已成空白 提交于 2020-01-07 04:57:05
问题 using Microsoft.Office.Interop.Outlook is not working on local IIS but it is working on IIS express while debuging.but when i publish app it is not runing on IIS8. Application OutlookApplication = new Application(); MailItem email = (MailItem)OutlookApplication.CreateItem(OlItemType.olMailItem); email.Display(); email.Recipients.Add("careers@acb.com; bilal@abc.com;"); Giving Exception on IIS not on localhost. Exception: An exception of type 'System.Runtime.InteropServices.COMException'

Merge and Split Word Documents using Microsoft.Office.Interop.Word in C#

对着背影说爱祢 提交于 2020-01-07 02:55:05
问题 I need to merge many Word files into a single file, send it for a revisor and split it again to same separated files. There is about 200 small Word documents. So, when I'm doing the merge I need to add any type of mark for reference for when I will split it. I'm actually adding a tag with the original file name, the final Word file will be like this: [ c:\doc\file1.doc ] Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget ipsum non est ultricies bibendum ac a sapien. Etiam

Fill in word form field with more than 255 characters

懵懂的女人 提交于 2020-01-07 01:12:13
问题 I am trying to programmaticly fill in a microsoft word form. I am successfully able to do so if the string is under 255 chars with the following code below, however it says the string is too long if i try and use a string over 255 chars... How do I get past this limitation? If I open the word doc in word I can type in more than 255 chars without a problem. Does anyone know how to input more characters via c# code? object fileName = strFileName; object readOnly = false; object isVisible = true

How to create nested fields using C# Interop.Word (IF option with MailMerge Fields)

此生再无相见时 提交于 2020-01-06 04:11:22
问题 I am trying to set MailMerge fields and let Word fill them for me, which isn't a Problem at all... What i am looking to do and can't figure out is the following, I want to set 2 MailMergeFields in 1 place and let Word sort it out for me. In this case have a mergefield for PO_Box and Adress, if there is a PO_Box # use it, otherwise use the Standard Adress. Example of the MailMerge what it would look like in Word: { IF { MERGEFIELD PO_Box } > "1" "{ MERGEFIELD PO_Box }" "{ MERGEFIELD Adress }"

“There is insufficient memory. Save the document now.” error while opening word 2003 document

ⅰ亾dé卋堺 提交于 2020-01-05 10:34:29
问题 I have developed one windows service through which I am trying to open an word document. But when service tries to open document, it logs following error "There is insufficient memory. Save the document now." If I run the same program as normal windows application, it works fine but problem comes only when I try to run the program as windows service. I tried to google this problem, but there arent many answers about this problem. Is there any way to increase the memory limit for windows

Adding Office 2010 Interop (PIA) in Visual Studio 2012

霸气de小男生 提交于 2020-01-04 09:05:28
问题 I am writing an application in VB.NET that will send emails using outlook. My problem is that I need the Office 2010 PIA to do this. The following are the steps I have already tried (I am using Visual Studio Express 2012): Restarted the machine Downloaded Office 2010 PIARedist and installed it Restarted Visual Studio Restarted the machine again Uninstalled Office and the PIA and re-installed Office, making sure that the PIA was selected in the installation options (it was already selected by

C#, Microsoft interop, Excel numberformat problem

◇◆丶佛笑我妖孽 提交于 2020-01-04 06:18:24
问题 I am using C# to try and format a range in Excel as numbers. When doing this, I get the green error arrow in the corner to ask me if I want to format the column as a number. I used the code below to format the data: Excel.Range Data = currentSheet.get_Range("K2:K10", Type.Missing); Data.NumberFormat = "0.00"; How do I convert the range to numbers so that excel is happy? 回答1: If your cells are already formatted as numbers, using the PasteSpecial function might work: Excel.Range Data =

Excel file generation on server without Excel installed

与世无争的帅哥 提交于 2020-01-04 04:01:49
问题 I am using Microsoft.Office.Interop.Excel and generating Excel files using the SaveAs method. This all works correctly on computer with Excel installed. However, my server does not have Excel installed. How can I generate my files? 回答1: If you generate a file using Interop you need to install Excel on the server. Microsoft doesn't support installing Excel (or Word) on the server. Instead you should download the Office Open XML SDK from Microsoft and use that library to generate Excel 2007