office-interop

Prevent actions to be added to the word undo redo OR Remove actions from the undo redo CommandBarComboBox

痴心易碎 提交于 2019-12-12 12:34:57
问题 We are inserting content controls programmatically in word document and we don't want to add actions to the undo stack of word. The only way that we found is to access the undo commandbar-combobox and to remove the items related to inserting content control action, we are using the code below : var commandBars = _wordDocument.CommandBars.Cast<CommandBar>(); var standardCommandBar = commandBars.First(bar => bar.Name.Equals("Standard")); CommandBarComboBox undoControl = standardCommandBar

Adding multiple word tables into word using interop

≯℡__Kan透↙ 提交于 2019-12-12 11:34:38
问题 I'm trying to insert multiple tables into a word document using c#, but when I add another block of code to add a table in I am getting an error and the second table is not being inserted. How do I move the range down to the bottom of the page and then add another table? I tried creating a new range using the end of doc reference but this doesn't seem to work, can anyone give me some help? Word._Application objApp; Word._Document objDoc; try { object objMiss = System.Reflection.Missing.Value;

How can I change the font color of a TextRange in PowerPoint from C#?

梦想的初衷 提交于 2019-12-12 10:43:06
问题 I created a PowerPoint presentation using C#: PowerPoint.Application powerpointApplication; PowerPoint.Presentation pptPresentation; PowerPoint.Slide Slide; // Create an instance of PowerPoint. powerpointApplication = new PowerPoint.ApplicationClass(); // Create a PowerPoint presentation. pptPresentation = powerpointApplication.Presentations.Add( Microsoft.Office.Core.MsoTriState.msoTrue); // Create empty slide Slide = pptPresentation.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank);

Microsoft Interop: Excel Column Names

微笑、不失礼 提交于 2019-12-12 10:33:34
问题 I am using Microsoft Interop to read the data. In excel-sheet the column-names are like A,B,C,D,....,AA,AB,.... and so on. Is there any way to read this column-names? If you need any other info please let me know. Regards, Priyank 回答1: Excel.Application xlApp = new Excel.Application(); Excel.Workbook xlWorkbook = xlApp.Workbooks.Open("workbookname"); Excel.Worksheet xlWorksheet = xlWorkbook.Sheets[1]; // assume it is the first sheet int columnCount = xlWorksheet.UsedRange.Columns.Count; List

How to open Outlook's new mail window with prepopulated attachment

↘锁芯ラ 提交于 2019-12-12 07:29:50
问题 I need to open a new email window with a prepopulated attachment when a user clicks some button or link in my application. 回答1: Old question, but I also ran in to this so here's a copy and paste solution: Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application(); Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); oMsg.Subject = "subject

Problem with interop.word in a .net application

▼魔方 西西 提交于 2019-12-12 06:15:51
问题 Solution Environment: MS Visual Studio 2010 Ultimate, MS Office 2010 Professional, Microsoft Interop classes Scenario: I've created a .Net application which uses the Interop classes to interact with MS Word. Consider this: An application which mimics a key-value pair table. When the user clicks on the "value" field, the .net application opens up a winword window where the user can enter some notes. Upon clicking close (winword), .net app will do a winword.wordopenxml and save the data in the

C# Microsoft.Office.Interop

允我心安 提交于 2019-12-12 05:42:23
问题 I need to reference this library, however when I right click and go to add references, I can't find it in the list. I have office 2007 installed. C# Microsoft.Office.Interop 回答1: You have to Install Office Primary Interop Assemblies first. You can download it from http://www.microsoft.com/en-us/download/details.aspx?id=18346 来源: https://stackoverflow.com/questions/12945462/c-sharp-microsoft-office-interop

How to modify the AppointmentItem.Parent object

不羁岁月 提交于 2019-12-12 05:13:57
问题 I need to set a UserProperty on a master of a recurring Appointment, from an appointment instance. The scenario is: a. user opens an instance of a recurring meeting/appointment. b. my program sets a UserProperty on the master of the appointment series Getting the master appointment is easy with the Parent property, however it is read-only. How can I get a modify-able reference to the master appointment? The code I want to execute is along these lines Outlook.AppointmentItem masterAppointment

Identifying a shape parent in visio

佐手、 提交于 2019-12-12 04:57:01
问题 Hii i have a visio document which is an BPMN template .In that BPMN document i have placed a BPMN shape and also other shapes from Engineering,FLowChart,Networking,Basic shapes etc by choosing Moreshapes-> and so my BPMN visio document looks like below in that BPMN and Task named are a BPMN shapes,Computer is a shape from Network->Computer ,Rectangle is from General->BasicShapes like that the other shape also . (ie) In a BPMN visio document , with the BPMN shape i have the other shapes also.

ActiveX control of Word. Select text and images

核能气质少年 提交于 2019-12-12 04:48:04
问题 This is what I have done so far: word = actxserver('Word.Application'); document = word.documents.Open('C:\Documents and Settings\kz7213\Desktop\Test.docx'); selection = word.Selection; selection.TypeText('Big Finale'); selection.Style='Heading 1'; selection.TypeParagraph; FIG1 = figure('Visible','off'); plot([1 2 3 4 5],[4 1 3 5 7]); print -dmeta selection.Paste; selection.Style='Heading 1'; selection.InsertCaption('Figure','Test figure 1'); %Not working selection.Style='CaptionStyle';