FAQ Database Discussion Community


Use Microsoft Office 2013 interop dll in sharepoint 2010

sharepoint,sharepoint-2010,ms-office,office-interop,excel-interop
Is it possible to use interop dll from Office 2013 in Sharepoint 2010 solutions? I need to use excel in my Sharepoint solution, but on server was installed Office 2013 and i cant chose Microsoft.Office.Interop.Excel. Thanks a lot...

Microsoft.Office.Interop.Word with C# - Identify Existing Table of Contents Object

c#,ms-word,office-interop,tableofcontents
I'm working off a template document that has an existing Table of Contents object. I am having trouble identifying it and assigning it to a TableOfContents object programatically for further manipulation/updating. I have examined the documentation for the TablesOfContents interface, and the only way I can see to return an...

Drag'n'drop outlook mail to wf is working incorrectly

winforms,drag-and-drop,outlook,office-interop
I have WF application that allows to drag and drop emails from outlook and read the contents of an email. But when I drag'n'drop email, the emails that were dropped before are not cleared up and as a result I get the copies of the previous emails + current dragged...

Writing data to excel file from C# [closed]

c#,sql-server,excel,office-interop
Building an app that pulls data from SQL Server, creates a new excel file, throws that data in and saves the file to a remote server. Edit. I have researched and found several ways of doing this and the most pertinent to my particular situation seem to be doing it...

Make ajax call from Excel Add-in

c#,office-interop
Is it possible to make ajax calls from Excel 2013 Add-in? If not then what is the best way to create Task Pane for Excel that can do ajax calls?

MS Word document not visible when opening programmatically through interop

c#,ms-word,vsto,office-interop,word-interop
The following code opens the document in the background but not make it visible even though I am using Visible = true and oDoc.Activate(); using Word = Microsoft.Office.Interop.Word; Word.Application oApp = new Word.Application(); Word.Document oDoc = oApp.Documents.Open(FileName: @"C:\Folder1\Test1.docx", Visible: true); oDoc.Activate(); According to this SO post, it should have worked....

OpenSharedItem locating recipient

c#,outlook,office-interop,msg
Using OpenSharedItem functionality to read .msg files and have encountered a problem with determining the recipient of an e-mail if the recipient has had a name change after the file was saved. If a .msg file is saved on disk I can read the PR_RECEIVED_BY_EMAIL_ADDRESS to get back the receiving...

How to hide Visio 2013 when using interop assembly in PowerShell

powershell,office-interop,visio,powershell-v4.0,visio2013
I'm willing to run Visio 2013 silently through PowerShell. At the moment I use the following code: Add-Type -Path 'Microsoft.Office.Interop.Visio.dll' $visio = New-Object Microsoft.Office.Interop.Visio.ApplicationClass $visio.Visible = $false $visio.Quit() The code works but I briefly see the Visio splash screen before it is hidden. I would like to create the application...

Is using Interop the recommended method when auto-generating Office documents?

c#,ms-word,office-interop
As stated in the title, I need to do some C# coding from a Web Application that will auto-generate a Word document. So far, targeted towards Office 2007 and above users. My question would be, is using the Interop library the recommended way of doing this? Isn't there some issues...

Installing Microsoft Office on a windows server?

ms-office,windows-server-2008,office-interop
I could not google a straight simple answer to this, so i'm trying my luck here. is there a problem installing Microsoft office 2007\2010\2013 on a network windows-based server, to be able to do some server-side conversions and simple automatic operations using its inter ops libraries on user generated documents?...

Hide font range without text on next page moving up a page

c#,ms-word,office-interop
I am currently working on generating a Word document which will hide parts of a document, depending on the type of insurance selected. if (g.First().GetProductCategory() == "Income Protection") { this.document.Bookmarks.get_Item("life_insurance").Range.Font.Hidden = 1; this.document.Bookmarks.get_Item("tpd").Range.Font.Hidden = 1; } else { this.document.Bookmarks.get_Item("income_protection").Range.Font.Hidden = 1; } This works well, but I have a small...

Microsoft Word how to change background color with DocX

c#,office-interop,novacode-docx
I am trying to change the background color(only for a few words) in a Word document. I am using DocX(https://docx.codeplex.com/SourceControl/latest#Examples/Program.cs), but I cannot find any methods/properties which allow me to do so. Here is my code: var rb = new Formatting(); rb.UnderlineColor = this.GetResultColor(stu.RespectfulBehavior); rb.FontColor = this.GetResultColor(stu.RespectfulBehavior); templ.ReplaceText(PlaceHolders.RespectfulBehaviour.GetDisplayName(), " ",...

Is there an alternative to Microsoft.Office.Interop.Excel.Application?

telerik,office-interop
It may be a class from Telerik. It must not be assumed that Office is installed. So, I've to use another class with the same features or similar.

Will VSTO Work With Microsoft Office for Mac 2015

.net,visual-studio,ms-office,vsto,office-interop
With .NET coming to the Mac, I see no reason why support for VSTO (and therefore the ability to write cross platform office ad-ins) couldn't come with it. Have there been any announcements to this effect either way? I'm almost certain that they'll support their office web app platform, but...

VS Community 2013 cannot add reference to office.interop

c#,visual-studio,f#,office-interop
My settings : - Office 2010 is fully installed and running with default settings including .Net development, - Office 2010 Primary Interop Assemblies (v14) are installed (checked with control panel programs list) Problem : In C# or F# projects, I cannot add a reference to Microsoft.Office.Interop in the Solution Explorer...

Excel <-> C# - how do I call into a C# library from Excel?

c#,excel,vba,excel-vba,office-interop
We have a couple of spreadsheets here that we populate with some data and do some formatting using Microsoft.Office.Interop.Excel. Now that part is all good - it's something along the lines of what is done here: Write to Excel example. What I'd like to do is: Add a button inside...

How to read Math Equations from Powerpoint and write it to Word document in C#

c#,math,ms-office,powerpoint,office-interop
I am developing a PowerPoint extraction tool since march 2014 which extracts the words or paragraphs from PowerPoint and write it to word document. It has been developed. During the testing. we found that Math Equation has not being fetched from PowerPoint slide. I am using Microsoft.Office.Interop.Powerpoint.dll library. i am...

Office 2010 monitoring calendar events

c#,vb.net,outlook,ms-office,office-interop
Hey all I have the following code in VB.net that i translated from C# that I found on the internet for monitoring a outlook calendar events (Add, modify and delete). The code is: Public Class ThisAddIn Private Sub ThisAddIn(sender As Object, e As System.EventArgs) Handles Me.Startup Dim monitor As New...

Not able to insert image after the current one in word with microsoft.office.interop.word

c#,selenium-webdriver,ms-word,office-interop
I am trying to open an existing word file and insert image into it (image name with path being passed to the function ). Code logic is working fine but challenge is every time the new image file is inserting / place on the top of the last one.mean the...

Using Microsoft.Office.Interop.Outlook without Outlook Client installed

c#,outlook,interop,office-interop
I'm trying to enumerate Outlook Global Address List and I don't have Outlook Client installed on a development server. I'm getting following error An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll Additional information: Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error:...

Powerpoint to Text C# - Microsoft.Interop

c#,text,powerpoint,office-interop,file-conversion
I have been trying to read .ppt files from last 3 days. I searched a lot on internet and I came up with different source code snippets but nothing was perfect. And now i tried this code, and it is not printing "Check4" because of some unidentified problem in "Foreach"...

Unable to open mailItem because of outlook interface..!

c#,outlook,office-interop,office-2013
I have an application where i create a mailItem using Outlook interop. On some systems the code works without problems. But on one of the systems this error appears: Message= 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 call on...

Pre-populate palette colors in Microsoft Office?

excel,vba,ms-office,powerpoint,office-interop
My coworkers have very specific colors they use in their Excel and PowerPoint documents, and they came to me hoping for some automation. They often have to go through the annoying task for every new document of re-picking the same three colors off the color selector. They have to select...

Microsoft Interop OutLook C#- Cannot save attachments of type OLE

c#,outlook,interop,office-interop,com-interop
I have a C# program saving attachments from unread emails from Outlook mail box to a folder and the below line of code breaks(first line) for attachment types that are of OLE type with the error "Outlook cannot perform this action on this type of attachment"(Where 'it' is of type...

Outlook 2013 Cannot create ActiveX component from ASP.NET Application

asp.net,vb.net,outlook,office-interop
I am trying to send email in VB.Net using outlook 2013. I tested as localhost in debug mode and everything is fine. I can send and read Outlook emails in vb.net. However, when I publish the web application and click the send button I get the following exception: System.Exception: Cannot...

Retain the source template when saving slides in ppt

c#,vsto,office-interop
I am trying to save selected slide so it doesnt retain my source template. how do i retain the existing template while i save the slides private void SaveSelectedSlide_Click(object sender, RibbonControlEventArgs e) { try { PowerPoint.Application ppApp = Globals.ThisAddIn.Application; PowerPoint.SlideRange ppslr = ppApp.ActiveWindow.Selection.SlideRange; string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); var temporaryPresentation =...

How to access an Office IEnumerable interface?

c#,ms-word,powerpoint,office-interop,word-interop
I am trying to write a C# add-in for PowerPoint with VS2013. But (after some years of absence in programming :) I am struggling with C#. Task is to let the user choose one installed proofing language and set it for all slides. First, it seems that PowerPoint doesn't have...

Using MS Word VBA how to Find and Replace highlighted text with the value of the highlight color

vba,ms-word,office-interop,word-vba
Suppose the following text in an MS Word 2007/2010 document, I have "testA" highlighted with blue and "testB" highlighted with green color: "This is testA and testB.". I want to programmatically replace testA with its background color index 2, and replace testB with its background color index 11. Ref: WdColorIndex...

WebBrowser shortcuts not working in Outlook add-in. WebBrowserShortcutsEnabled is true

c#,outlook,webbrowser-control,add-in,office-interop
I have an Outlook add-in. Webbrowser control is shown inside UserControl on the pane. Problem is that standard shortcuts don't work (ctrl+c, ctrl+v, ctrl+a, tab). WebBrowserShortcutsEnabled is true. Typing in the WebBrowser inside Outlook works fine. Similar issue like mine is described in WebBrowser shortcuts not working in PowerPoint add-in......

Invalid parameter - c# Excel Interop Series.Points()

c#,excel,charts,office-interop
I have been trying to figure this one out for a while, but can't seem to get anywhere. I am simply trying to change the color of the last column in an Excel column chart (e.g. first 3 columns blue, last column orange) using C#. I have scoured many forums...

Find out background color of highlighted text in MS Word document using C# or VBA

c#,vba,ms-word,office-interop,word-vba
Following finds the highlighted text in a Word document (even if the different text at different places is highlighted with different colors). How can we find out the background color of each highlighted text. I'm using C# but VBA will also be ok: With ActiveDocument.Range.Find .Highlight = True While .Execute...

Extract powerpoint titles with C#

c#,powerpoint,office-interop
I have powerponint 97-2003 files(.ppt extension) and I need to extract slide titles programatically using C#. I have tried using Microsoft.Office.Interop but without success. I have search with google and as a maximum I have found how to obtain reference to PowerPoint.Slide: using System; using System.Collections.Generic; using System.Linq; using System.Text;...

How can I use VSTO project dll for excel in my another .NET application

.net,visual-studio-2010,c#-4.0,office-interop
I have created a project using Visual studio 2010 office template(for excel 2007).and its working fine. I am performing my calculation in ThisWorkbook_Startup() method which is being using in Startup event, defined as #region VSTO Designer generated code /// <summary> /// Required method for Designer support - do not modify...

Interop.Outlook Print to File (PDF)?

html,pdf,outlook,office-interop
There are many libraries out there which purport to transform HTML to PDF. All that I've looked at have there limitations. We don't want to spend any money on this so wanted to know if it is possible to print to file in PDF format without all the pop ups...

Use Office Interop on ASP.net MVC6 website

com,ms-word,office-interop,asp.net-mvc-6
I want to generate word documents from my ASP.net MVC 6 website. I've implemented several ways to generate a document in a POC : DocX, NetOffice, OpenXml, COM Interop objects. I was seduced by it. I made a Console App to test and it works. But, with ASP.net MVC6, we...

How to insert a HTML file as such that an object icon that links to the HTML file appears in Microsoft Word?

c#,html,ms-word,office-interop
I need to achieve the same behavior as shown above using C# code. All I have is a set of HTML files in my file system which should be added as objects to an existing Microsoft Word, so that the end user could open the HTML file(s) by clicking...

Word Interop 12: SaveAs new filename without dialog

c#,office-interop
I am writing a Windows Explorer extension that opens an existing .docx file, edits a few things, and saves it to a different path and name. It successfully opens the file, but when it hits the document.SaveAs() command it just opens the Save As dialog with the original filename and...

Determine the file format(version) for old Microsoft office files

.net,file,ms-office,office-interop
I have 50k+ .doc files on one of our servers that users have accumulated since the early 90's. Some of these files were created on Macintosh, or on really old version of Word. I've tried to look at the metadata in Word with no luck. I've tried to use the...