ms-office

.NET Interop: Find All instances of of a running COM object with C#

安稳与你 提交于 2019-11-30 22:43:19
Background I am automating some Office application (Word and PowerPoint) via command-line tool. One thing my tool needs to do is locate all the running instances of Word. I know how to get a reference to one of the instances... Object running_obj = null; { running_obj = System.Runtime.InteropServices.Marshal.GetActiveObject(progid); } catch (System.Exception) { //failed to find the object; } if (running_obj!=null) { var running_obj_type = System.Type.GetTypeFromProgID(progid); Microsoft.Office.Interop.Word.Application running_obj_wrapper; running_obj_wrapper = (Microsoft.Office.Interop.Word

Excel 2007: How to display mm:ss format not as a DateTime (e.g. 73:07)?

左心房为你撑大大i 提交于 2019-11-30 22:36:13
问题 I need to create and Excel table that computes daily training times. each row has the following fields: Date, Distance, Time and Minutes/Km. My main problem is that I want to display the Time in format of mm:ss . For example: 24 min and 3 sec should be 24:03 , but "Excel" turns it to 00:03:00 (3 min after midnight). I've tried setting up "special formatting" but still "Excel insists" on formatting the hours. More over, training may exceed 60 minutes and I still want it only as mm:ss My second

Different First Page in a document using microsoft office interop word in c#

不羁岁月 提交于 2019-11-30 21:10:38
问题 How can i create a different first page header and footer in a document using Microsoft.office.interop.word. I have tried the following code but only in the first page, header and footer is coming. I want it in the other way(first page shouldn't have header and footer). can any one Please help me ? i tried a lot. Microsoft.Office.Interop.Word.Application w = new icrosoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document doc; w.ActiveDocument.PageSetup

Programmatically Determine If An Excel File (.xls) Contains Macros

感情迁移 提交于 2019-11-30 20:49:18
Is there any way to programmatically determine if an .xls contains macros, without actually opening it in Excel? Also are there any methods to examine which certificate (including timestamp cert) these macros are signed with? Again without using Excel. I'm wondering in particular if there are any strings that always show up in the raw data of an Excel file when macros are present. Yes, you can open the .xls file as a compound document file and check whether is contains a VBA folder and streams containing VBA code. Sample code is available in this CodeProject article: Another OLE Doc Viewer but

Check if Office.js is loaded outside of Office client

♀尐吖头ヾ 提交于 2019-11-30 20:43:58
If we load a webpage referencing office.js outside Office client, we will get a warning: Office.js is loaded outside of Office client . This information is useful. Does anyone know if there is an API to check that inside my code? Edit 1: I explain a little bit my scenario and why I ask this question. I am making an application with angularjs which can be loaded in a browser as a web page or in Office as an add-in. And I realise that we should not do <body ng-app="myApp"> and angular.bootstrap(document, ['myApp']) together, otherwise controllers will execute twice . So I decided to not write

Add MS Office Documents to PDF via Apache PDFBox

╄→гoц情女王★ 提交于 2019-11-30 20:27:46
I'm using Apache PDFBox ( http://pdfbox.apache.org/ ) for creating PDFs out of an arbitrary amount of files, including Images and other PDFs. Now I need to add MS Office Documents (Word, Excel and Outlook MSGs) to the PDF. The files can have nearly every Office Version, so it is not granted that the file is a new office file (e.g. docx) or an old one (e.g. doc). Is there any way to do this only with free tools? My first idea is to read the contnet of every file with Apache POI ( http://poi.apache.org/ ) and recreate the file as a new PDF page, but this can become very costly, as this PDF

Looking up the value for MS Office Interop constants rather than hard coding them

↘锁芯ラ 提交于 2019-11-30 19:41:22
Using PowerShell, it is easy enough to create, say, an instance of the Excel Application class and start manipulating it: $app = New-Object -ComObject "Excel.Application" However, if I need to use the constants like xlDoubleQuote or xlDelimited - it seems like I am forced to hard code them. I would really like to be able to do something like: $constants = New-Object -ComObject "Excel.Constants" $constants.xlDoubleQuote And see that it would return the value of 1. Unfortunately I can't create an instance of an enumeration, and there doesn't seem to be a way to reference it like you would a

OpenXml and Unable to create mutex

隐身守侯 提交于 2019-11-30 18:12:56
问题 I tried to create Excel document through openXml lib, but when i wanna create Excel from large number of data, server shoe me Unable to create mutex. (Exception from HRESULT: 0x80131464) error, the stack trace is : [IsolatedStorageException: Unable to create mutex. (Exception from HRESULT: 0x80131464)] System.IO.IsolatedStorage.IsolatedStorageFile.Open(String infoFile, String syncName) +0 System.IO.IsolatedStorage.IsolatedStorageFile.Lock(Boolean& locked) +370 System.IO.IsolatedStorage

What do <o:p> elements do anyway?

泄露秘密 提交于 2019-11-30 16:46:17
I've been running into some (standard) issues with Microsoft Office injecting its nasty markup into some html after forwarding an email via Outlook. I'm interested to know: Is there a resource that explains what <o:p> elements actually do What other MSO elements are commonly injected Couldn't find any official documentation (no surprise there) but according to this interesting article , those elements are injected in order to enable Word to convert the HTML back to fully compatible Word document, with everything preserved. The relevant paragraph: Microsoft added the special tags to Word's HTML

What do <o:p> elements do anyway?

谁都会走 提交于 2019-11-30 16:22:13
问题 I've been running into some (standard) issues with Microsoft Office injecting its nasty markup into some html after forwarding an email via Outlook. I'm interested to know: Is there a resource that explains what <o:p> elements actually do What other MSO elements are commonly injected 回答1: Couldn't find any official documentation (no surprise there) but according to this interesting article, those elements are injected in order to enable Word to convert the HTML back to fully compatible Word