office-interop

C# VSTO Powerpoint add Text as Field

北城以北 提交于 2021-02-19 06:10:23
问题 We are developing a VSTO application and we need this kind of feature group selected text as seen on the screenshot. We are able to do it by modifying the slide1.xml of an existing powerpoint file by changing the datatype of a:fld xml tag but question is how can we do it on runtime? When the presentation is just newly opened? Thanks for the answer. 来源: https://stackoverflow.com/questions/59266899/c-sharp-vsto-powerpoint-add-text-as-field

How can we call Invoke(Delegate) method from a Microsoft Office Add-in?

非 Y 不嫁゛ 提交于 2021-02-11 14:13:31
问题 Question : How can we use Invoke(...) method in a Microsoft Office 2010-2016 VSTO project. Or, are there any work around, alternatives etc for a VSTO project? Background : I am trying to implement a source code of a third party Windows Forms application into my Microsoft Office VSTO add-in project. The third party vendor has provided its users a sample/example as a Windows Form project with source code and has asked its users to mimic that code to their other projects (WPF, Office Solutions

How can we call Invoke(Delegate) method from a Microsoft Office Add-in?

只谈情不闲聊 提交于 2021-02-11 14:08:34
问题 Question : How can we use Invoke(...) method in a Microsoft Office 2010-2016 VSTO project. Or, are there any work around, alternatives etc for a VSTO project? Background : I am trying to implement a source code of a third party Windows Forms application into my Microsoft Office VSTO add-in project. The third party vendor has provided its users a sample/example as a Windows Form project with source code and has asked its users to mimic that code to their other projects (WPF, Office Solutions

Get Currently Opened Word Document from Process

限于喜欢 提交于 2021-02-10 18:22:58
问题 The goal is to get the full path to the document opened in an instance of Microsoft Word that I have a process reference for. Pseudocode Example: Process myWordProcess = something; // This is my process reference DocumentInformation docInfo = SomeNamespace.GetDocumentInformation(myWordProcess); string documentPath = docInfo.FullName; // "C:\User\Foo\Documents\Test.docx" The starting point is a Process object which is executed by WINWORD.exe . I am not looking for a way that includes parsing

Get Currently Opened Word Document from Process

喜夏-厌秋 提交于 2021-02-10 18:21:52
问题 The goal is to get the full path to the document opened in an instance of Microsoft Word that I have a process reference for. Pseudocode Example: Process myWordProcess = something; // This is my process reference DocumentInformation docInfo = SomeNamespace.GetDocumentInformation(myWordProcess); string documentPath = docInfo.FullName; // "C:\User\Foo\Documents\Test.docx" The starting point is a Process object which is executed by WINWORD.exe . I am not looking for a way that includes parsing

DOCX to PDF: SaveAs2 vs ExportAsFixedFormat vs PrintOut

て烟熏妆下的殇ゞ 提交于 2021-02-08 10:23:22
问题 I have the tiny goal to convert a huge load of docx files to pdfs using C# and .NET without opening Word (visibly) and without using any third party library (less components to manage and less money to spend). At the moment, I am trying to correctly convert a single document, which has to be as efficient as possible in order to quickly convert the huge load mentioned before (several thousand docx files, each between 100 and 300 kb). I am using Word = Microsoft.Office.Interop.Word; and I am

Identify active slide in C#

泄露秘密 提交于 2021-02-08 07:48:23
问题 I would like to know which is the current slide viewed by the user in PowerPoint (in edition not presentation). I used an SlideChange event with var new Index = Application.ActiveWindow.View.Slide.SlideIndex . The problem is when the cursor on the thumbnail panel on the left is not on a slide but between two. In that case, I have an error View (unknown member) : Invalid request. No slide is currently in view. which is normal because there is no view pointed. Unfortunately SlideChange event is

Save file as PDF/A using Office.Interop.Excel

二次信任 提交于 2021-02-07 09:20:40
问题 How can I export an Excel spreadsheet to PDF/ A (ISO 19005-1)? EDIT: I'm asking for PDF/A, and not plain old PDF 1.5 as it exports by default. I've even emphasized the A in my original question. I can already export Word and PowerPoint documents to PDF/A, using the ExportAsFixedFormat() function, since the Word and PowerPoint functions both have an optional UseISO19005_1 parameter, but the Excel version is very different, and is missing lots of parameters. I can't seem to find any way to

Save file as PDF/A using Office.Interop.Excel

淺唱寂寞╮ 提交于 2021-02-07 09:20:31
问题 How can I export an Excel spreadsheet to PDF/ A (ISO 19005-1)? EDIT: I'm asking for PDF/A, and not plain old PDF 1.5 as it exports by default. I've even emphasized the A in my original question. I can already export Word and PowerPoint documents to PDF/A, using the ExportAsFixedFormat() function, since the Word and PowerPoint functions both have an optional UseISO19005_1 parameter, but the Excel version is very different, and is missing lots of parameters. I can't seem to find any way to

C# Get list of opened Word documents

会有一股神秘感。 提交于 2021-02-07 03:05:26
问题 Currently, I'm using this code to get the list of MS Word opened documents: List<string> doc_list = new List<string>(); try { Microsoft.Office.Interop.Word.Application WordObj; WordObj = (Microsoft.Office.Interop.Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application"); for (int i = 0; i < WordObj.Windows.Count; i++) { object idx = i + 1; Window WinObj = WordObj.Windows.get_Item(ref idx); doc_list.Add(WinObj.Document.FullName); } } catch { // No documents