office-interop

Prevent Excel from opening while creating excel file using interop

大兔子大兔子 提交于 2020-01-15 06:01:47
问题 Hi all am creating a excel using Microsoft office interop.and it creates files successfully.But the problem is that when it creates a files it just opens excel adds the value in to excel and saves it in the specified name.Any accidental typing at that time results leads to a exception.Am creating nearly 75 files with many rows from database and hence takes time.During the processing am unable to do any task since it creates exception if its typed in the excel.Is there any way to run the

Quit() causes Access to become visible for a moment

三世轮回 提交于 2020-01-15 03:08:49
问题 I'm trying to connect to an access DB and retrieve information. Everything is going well the project is almost complete but I need to figure out how to quit interop. I start by creating my access application then I make sure visible is set to false. (I don't see Access) but as soon as my code get to line app.Quit() (verified using step though) Access flashes on the screen just to disappear again. For added information: If I do a step through the Access window doesn't disappear and I can't

Interop - prevent a table wrapping over two pages in Word

一个人想着一个人 提交于 2020-01-14 05:06:05
问题 I am outputting multiple tables with a minimum of two lines of header information followed by 0 or several lines of data... My problem is that sometimes the tables wrap over the end of the page. How can I prevent this - is there a s property like doNotWrap' in MS Word tables? Here is the code I am using: // it's an Account list so what follows will be account data then transactions string[] sValues = pqRequests[s].Split('\t'); if (sValues[0]=="01") { iTable++; // output header info if

How it is correctly to implement IDTExtensibility2 interface for Office COM Add-In?

与世无争的帅哥 提交于 2020-01-13 12:10:14
问题 I am implementing COM Add-In for Outlook. I use IDTExtensibility2. I am not sure whether this is the best way of doing COM Add-Ins but I cannot change that. This interface defines five methods: OnConnection, OnStartupComplete, OnAddInsUpdate, OnBeginShutdown, OnDisconnection. I need to perform the following operations: Load configuration data from file Load registry data Start new session Create *.pst file Subscribe to Explorer events Connect to Internet Server to get some data Create menu

Problem closing excel interop app properly in .net

痴心易碎 提交于 2020-01-13 10:22:42
问题 I am having issues using interop with office excel in .net. I have tried a lot of things to close the excel application, workbook and worksheets i create to use in my program but i always notice the excel.exe still in memory. I have even tried forcing the garbage collector, please help. Here is the code i use to instantiate everything: Private mExcelApp As Microsoft.Office.Interop.Excel.ApplicationClass Private mWorkBook As Microsoft.Office.Interop.Excel.Workbook Private mWorkSheet As

Problem closing excel interop app properly in .net

空扰寡人 提交于 2020-01-13 10:22:07
问题 I am having issues using interop with office excel in .net. I have tried a lot of things to close the excel application, workbook and worksheets i create to use in my program but i always notice the excel.exe still in memory. I have even tried forcing the garbage collector, please help. Here is the code i use to instantiate everything: Private mExcelApp As Microsoft.Office.Interop.Excel.ApplicationClass Private mWorkBook As Microsoft.Office.Interop.Excel.Workbook Private mWorkSheet As

Print word document using c#

梦想与她 提交于 2020-01-13 05:56:12
问题 I have this code to open a word file int num = 0; object fileName = FD.FileName; object readOnly = false; object isVisible = false; object missing = System.Reflection.Missing.Value; Word.Application WordApp = new Word.Application(); Word.Document aDoc = null; WordApp.Visible = false; aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref

Excel automation: PDF export causes “Printer setup” popup

懵懂的女人 提交于 2020-01-12 08:07:29
问题 I am developing an application for automatic Excel to PDF generation. Every now and then (and without any apparent cause, the following popup comes up while the program runs: Print driver host for 32bit applications stopped working. and, shortly after, this one: Printer setup What, if anything, do I need to do here? My application is not overly complex. The error always (100%) happens on this line: _application.ActiveWorkbook.ExportAsFixedFormat(Excel.XlFixedFormatType.xlTypePDF,

Why am I receiving exception from Office's Outlook library?

a 夏天 提交于 2020-01-12 04:07:48
问题 I have an application that calls Email hello = new Email(appropriate constructor); hello.Email_Send(); I'm receiving the exception: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). from System.Runtime.InteropServices.COMException . using O = Microsoft.Office.Interop.Outlook; class Email { public void Email_Send() {

Outlook Interop Exception

痴心易碎 提交于 2020-01-11 11:26:07
问题 Trying to automate Outlook as Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.ApplicationClass(); Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI"); and getting following exception at second line i.e. GetNamespace Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface