Questions tagged [office-interop]

Office Interop is the layer using the COM Interop that allows .NET or C# to communicate with standard COM objects and libraries.

Office Interop is the layer using the COM Interop that allows .NET or C# to communicate with standard COM objects and libraries.

3602 questions
8
votes
1 answer

How to add items one at a time to to a new line a word document using word interop

I am trying to add these three types of content into a word doc. This is how I am trying to do it now. However, each item replaces the last one. Adding images always adds to the beginning of the page. I have a loop that calls a function to create…
sixshift04
  • 329
  • 4
  • 8
  • 19
8
votes
3 answers

How to add text into Word Documents at a specific position?

How do I write to a specific position in a Word document, for example, line 5, character 50? I have searched for a couple of hours, but couldn't find a solution. I am using Microsoft.Office.Interop.Word
mahboub_mo
  • 2,908
  • 6
  • 32
  • 72
8
votes
3 answers

How to print a docx to a specific printer using Microsoft.Office.Interop.Word.Document.PrintOut()

This seems like such a simple need, but for some reason I cannot find how I can accomplish this. I have code like this: Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application(); MemoryStream documentStream =…
andrew
  • 2,235
  • 3
  • 18
  • 22
8
votes
2 answers

Download EXCEL file from ASP.NET page without Generating physical file on server (On The Fly)

I am trying to export C# DataTable to EXCEL file on the fly (without creating physical file) using Microsoft Office EXCEL INTEROP and download it through asp.net webpage through Response object. I am able to generate memorystream using the library…
Sankalp
  • 929
  • 1
  • 7
  • 16
7
votes
2 answers

How can I capture a Microsoft Access VBA debug error from my C# code?

I have a C# program that opens several Microsoft Access files, and executes functions from within each one. Essentially, the code looks something like this: Microsoft.Office.Interop.Access.Application app = new…
transistor1
  • 2,915
  • 26
  • 42
7
votes
6 answers

Get specific window handle using Office interop

I'm creating a new instance of Word using the Office interop by doing this: var word = Microsoft.Office.Interop.Word.Application(); word.Visible = true; word.Activate; I can get a window handle like this: var wordHandle =…
HotN
  • 4,216
  • 3
  • 40
  • 51
7
votes
1 answer

Advancing Powerpoint Slideshow programmatically with click animations

What I am trying to do is control a Powerpoint presentation from my WPF application. With the code from this question: C# - way to programmatically advance Powerpoint slide show? it is working quite well for normal slides. But as soon as I get to a…
Malyngo
  • 863
  • 7
  • 18
7
votes
2 answers

Get text above table MS Word

This one is probably a little stupid, but I really need it. I have document with 5 tables each table has a heading. heading is a regular text with no special styling, nothing. I need to extract data from those tables + plus header. Currently, using…
user194076
  • 8,787
  • 23
  • 94
  • 154
7
votes
1 answer

Outlook Filter Items - Get all recurring appointments in a week range

I'm trying to get all appointments in outlook in week range, but reoccurring appointments are not showing up. Here is the code: var outlook = new Microsoft.Office.Interop.Outlook.Application(); var calendar =…
Daryl
  • 18,592
  • 9
  • 78
  • 145
7
votes
2 answers

Pen and marker using PowerPoint 2010 interop

I'm new to PowerPoint interop and I'm trying to draw red pen and yellow text marker (not shapes!!!) lines while in presentation mode. UPDATE: I can draw a line like this: settings = presentation.SlideShowSettings; window = settings.Run();…
Hinek
  • 9,519
  • 12
  • 52
  • 74
7
votes
1 answer

Creating statecharts in Visio using c#

Can anyone point me to an example of how to programatically create a statechart in visio? I can create blank pages, drop shapes, open template etc, but when I try to add transitions it complains that the page is not the right type. Can't find a…
John3136
  • 28,809
  • 4
  • 51
  • 69
7
votes
2 answers

How to access an already opened Excel file in C#?

I have an excel workbook opened via double-clicking it in windows explorer but cannot access it in code Excel.Application xlApp = (Application)Marshal.GetActiveObject("Excel.Application"); Excel.Workbooks xlBooks = xlApp.Workbooks; xlBooks.Count…
Jon Erickson
  • 112,242
  • 44
  • 136
  • 174
7
votes
6 answers

different format into one single line Interop.word

I've been trying to figure out how to insert 2 different formats into the same paragraph using interop.word in c# like this: hello planet earth here's what I want to do
David Lopez
  • 141
  • 1
  • 3
  • 4
7
votes
2 answers

Can't obtain Outlook.Application while Outlook is running until a non-Outlook window is in the foreground

Marshal.GetActiveObject("Outlook.Application") throws Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)) when Outlook is started and continues while it is running until a non-Outlook window becomes the active foreground…
Shroom
  • 73
  • 4
7
votes
2 answers

Primary Interop Assemblies for Microsoft Office Applications

I'm trying to install Interop Assemblies for Microsoft Office on my web servers, for the use of reading word documents from my site. Can I install just the Assemblies? Or the only way is installing an office suite? The exception : Could not load…
Shlomi Komemi
  • 5,445
  • 3
  • 28
  • 41