office-interop

Blank line after deleting contentControl in word

六眼飞鱼酱① 提交于 2019-12-20 04:56:10
问题 I'm trying to write in a word document via VB.net and for this I'm using contentControls in my Word Document but sometimes I have to delete a contentControl or another via VB code. It's kind of easy with contentcontrol.delete but when this contentControl contains multipleline and I want to delete it then it leaves a blank line. How can I avoid this? 回答1: I will give you some tips based on VBA which I hope you could easily convert to vb.net and your solution. You need to cover complete range

Open/handle Word documents like SharePoint

廉价感情. 提交于 2019-12-19 11:25:09
问题 Could anyone point me in the right direction when it comes to handling Word documents (.docx) on the server using asp.net. I know I can write to and read the .docx document using the API provided. But I would like to implement this like SharePoint does it. The user browses the web site, he is logged in, then chooses to make a new Word document in a folder, then the Word document downloads and opens locally. Then I would like the user to be able to save the document back to the server.

Office 2007 [and higher] interop: retrieve RGB-color

元气小坏坏 提交于 2019-12-19 10:47:08
问题 UPDATE: If you need to determine rgb-color in office document (format 2007) look at my answer below. Have: Interop.Word.dll ver.14 from VS2010 PIA, VS2010 Express Edition MS Word 2010 (ver.14) .docx-file made in mentioned Word manually without Interop. File contains several tables with colored corner cells. Purpose: To build another .docx-file with Interop contained those tables filled with gradient color based on colors in its corners. Where problem appears: I need to transform colors in

_IContactsAndGroupsCallback.OnLookUp

感情迁移 提交于 2019-12-19 10:13:28
问题 I'd like to provide IM presence etc for Office, following the guide from http://msdn.microsoft.com/en-US/library/office/jj900715.aspx#off15_IMIntegration_ImplementRequired_ILyncClient. In response to IContactManager.Lookup(string _lookupString, object _contactsAndGroupsCallback = null, object _state = Type.Missing) I need to call Microsoft.Office.Uc._IContactsAndGroupsCallback.OnLookup(ContactManager _source, object _lookupResult, AsynchronousOperation _asyncOperation); The second parameter

How will i extract the data from the docx file using DocumentFormat.OpenXml -details below

南笙酒味 提交于 2019-12-19 04:57:13
问题 I have a Docx file created by adding the xml schema. I am giving you the link of the docx file . now I want to extract-- To,From,heading,body. Currently I am using the Library DocumentFormat.OpemXml. But didnt succeed. Can any one suggest me the steps . 回答1: This answer is late I know but after years reading this site I find myself in a position to help. As the previous answer stated it is just as simple as opening the file as a zip and examining the contents. This approach can be limiting if

Get specific window handle using Office interop

主宰稳场 提交于 2019-12-18 13:39:08
问题 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 = Process.GetProcessesByName("winword")[0].MainWindowHandle; The problem is that code works on the assumption that there's no other instance of Word running. If there are multiple, it can't guarantee that the handle it returns is for the instance that I've launched. I've tried

Proper disposal of COM interop objects in C# particularly MS Office applications

对着背影说爱祢 提交于 2019-12-18 12:58:16
问题 I am developing an application that relies heavily on multiple Microsoft Office products including Access, Excel, Word, PowerPoint and Outlook among others. While doing research on interop I found out that starting with VS2010 and .NET 4, we thankfully no longer have to go through the nightmares of PIAs. Furthermore, I have been reading a lot of articles on proper disposal of objects, the most sensible one seemed to be this one. However, the article is 5 years old and there are not many

how to make the Outlook Compose window top most?

拜拜、爱过 提交于 2019-12-18 09:50:10
问题 I am creating an Outlook Message. Sometimes the Outlook Compose window appears behind other windows. How can I make it the top most? String address = "someone@example.com"; Outlook.Application oApp = new Outlook.Application(); Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); oMailItem.To = address; oMailItem.Subject = "Help"; oMailItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain; oMailItem.Attachments.Add("H:\\file.txt"); oMailItem.Body =

how to make the Outlook Compose window top most?

谁说胖子不能爱 提交于 2019-12-18 09:50:04
问题 I am creating an Outlook Message. Sometimes the Outlook Compose window appears behind other windows. How can I make it the top most? String address = "someone@example.com"; Outlook.Application oApp = new Outlook.Application(); Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem); oMailItem.To = address; oMailItem.Subject = "Help"; oMailItem.BodyFormat = Outlook.OlBodyFormat.olFormatPlain; oMailItem.Attachments.Add("H:\\file.txt"); oMailItem.Body =

Crop MS Word Images using Matlab Activex control

风流意气都作罢 提交于 2019-12-18 09:37:59
问题 I am using MATLAB to paste and caption plots into Microsoft Word. I would like to also crop these images using the ActiveX control. something like: word = actxserver('Word.Application') word.Visible = 1 op = invoke(word.Documents,'Add') invoke(word.Selection,'Paste') invoke(word.Selection,'CropBottom',CropAmount) <----- Except there is no function that will allow me to crop. I am modifying the MATLAB File Exchange "save2word.m" Thanks 回答1: Consider this example: %# create plot and copy to