office-interop

VSTO custom taskpane on multi DPI system shows content twice

半城伤御伤魂 提交于 2019-12-22 03:43:23
问题 I am building an office addin using VSTO. On systems with multiple monitors with different DPI settings, the contents of my custom task pane is drawn twice on the monitor with the higher DPI settings: Only the smaller version is actually responding to user input. The larger version seems to be simply an upscaled image. I have tried playing around with diverse DPI related settings like: AutoScaleMode on my user control. I tried all options, no change. Setting the process to DPI aware - or not

How to convert excel workbook to pdf without using excel interop library?

廉价感情. 提交于 2019-12-21 20:29:57
问题 I have an xlsx file that includes charts each in sheets. I want to save it as pdf file. I made a sample using excel.interop: Application excelApplication = new Application(); Workbook wkb = excelApplication.Workbooks.Open(oSlideMaster._FILE_PATH, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, Microsoft.Office.Interop.Excel.XlCorruptLoad.xlNormalLoad); var basePath = HttpRuntime.AppDomainAppPath; wkb.ExportAsFixedFormat

How to convert excel workbook to pdf without using excel interop library?

一笑奈何 提交于 2019-12-21 20:29:11
问题 I have an xlsx file that includes charts each in sheets. I want to save it as pdf file. I made a sample using excel.interop: Application excelApplication = new Application(); Workbook wkb = excelApplication.Workbooks.Open(oSlideMaster._FILE_PATH, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, Microsoft.Office.Interop.Excel.XlCorruptLoad.xlNormalLoad); var basePath = HttpRuntime.AppDomainAppPath; wkb.ExportAsFixedFormat

Unit testing an application that talks to microsoft word via OpenXML

时光毁灭记忆、已成空白 提交于 2019-12-21 06:18:27
问题 I am modifying an application that does a lot of 'talking' to Microsoft Word. Right now, COM interop is used but I need to change it to Open XML. I would like to introduce unit tests for this but I am not sure how to do this. This is one of the operations for example: A template word document contains some bookmarks. The application fills up the bookmarks with some dynamic data. Can I check if this executes correctly? 回答1: In order to unit test things like this, you need to design seams at

List all the softwares installed on Network Computers by IP address

旧时模样 提交于 2019-12-21 06:18:24
问题 How to get list of the softwares installed on Network Computers. I am able to get the list of software installed for my local machine but not getting any idea of how I can extract the details of installed software on the computers within the network. I have server name or IP address of the network computer as the only input. Please guide me and help me to achieve this. Below is the code which I had implemented untill now which is getting details of installed softwares from local machine:

More C# Automating to Excel

泪湿孤枕 提交于 2019-12-21 06:01:19
问题 This launches a fresh Excel workbook: Excel.Application oXL; Excel._Workbook oWB; oXL = new Excel.Application(); oXL.Visible = true; oWB = (Excel._Workbook)(oXL.Workbooks.Add( Missing.Value )); However, what if one wants to either... -- 'GetObject' (in the familiar Automation paradigm) to a workbook that's already loaded and open on the screen?, or -- access and write data to a closed workbook by path name? Both of which are doable by old standards. Preferably the latter although I'm not a

Setting an Outlook mailitem's category programmatically?

自古美人都是妖i 提交于 2019-12-21 03:42:34
问题 There doesn't seem to much information or any good code samples for setting an Outlook 2007 MailItem's categories programmatically. MSDN has a limited page, and mentions using VB's Split function, saying more or less " you're on your own from here onwards, so sort it out yourself ". So far as I can tell we manipulate the Categories as a comma delimited string property of the mailitem. It seems a bit primitive, is that all there is to it? Does everyone just dig out their library of string

C# Outlook interop and OpenSharedItem for opening MSG files

笑着哭i 提交于 2019-12-20 17:17:21
问题 Is there any tutorial or resource I can follow in order to use the OpenSharedItem outlook interop method. My goal is to read MSG files using it (as it can apparently do so). 回答1: How to: Create a Contact Item from a vCard file and Save the Item in a Folder How to: Import Saved Items using OpenSharedItem 回答2: Thanks Svetlozar, I've used the resources to create something like the following: Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();

When do I need to call ReleaseComObject?

走远了吗. 提交于 2019-12-20 10:44:30
问题 In a Microsoft Office AddIn we are passed COM objects in events. To take a specific case, when Word opens a document we are called and passed a Document object. So when do we need to call Marshal.ReleaseComObject()? If we access the Document object do we need to call release on it? Or can we assume Word has already accessed it and will clean it up? If we access Document.Name that gives us a string. As a string is not a COM object we do not need to clean that up - correct? But if we access any

How to Freeze Top Row and Apply Filter in Excel Automation with C#

被刻印的时光 ゝ 提交于 2019-12-20 09:46:33
问题 I have automation to create an Excel document from C#. I am trying to freeze the top row of my worksheet and apply filter. This is the same as in Excel 2010 if you select View > Freeze Panes > Freeze top row, and then after selecting top row Data > Filter. I do not have any idea how to apply the filter but the following is what I tried for freezing the top row and it just froze the entire worksheet. Does anyone have a solution to my problem. The data filter problem is where I need more help