office-interop

Unstable Office(Powerpoint) Automation [duplicate]

南笙酒味 提交于 2019-12-11 06:58:44
问题 This question already has an answer here : Alternative for visio server-side automation (1 answer) Closed 2 years ago . I am working on an app that will allow the user to upload a presentation, edit it, and then download the final output as another PowerPoint presentation. I have very unstable behavior for different presentations that I upload: Sometimes the changed images are blurred (Not sure why?) Sometimes incorrect shape ids are returned, and therefore I can not merge the changed work

How to check whether a excel file is write protected or not in C#?

不羁岁月 提交于 2019-12-11 06:36:13
问题 I'm developing a sample application in which I have to open an excel file and check whether the file is write protected or not. The code is using System.Windows.Forms; using Microsoft.Office.Core; private void button1_Click(object sender, EventArgs e) { string fileNameAndPath = @"D:\Sample\Sample1.xls"; // the above excel file is a write protected. Microsoft.Office.Interop.Excel.Application a = new Microsoft.Office.Interop.Excel.Application(); if (System.IO.File.Exists(fileNameAndPath)) {

packaging a COM addin for deployment

穿精又带淫゛_ 提交于 2019-12-11 06:24:24
问题 Good Day All, I am unfamiliar with the proper techniques for packaging a windows installer for my COM level addin (This is the higher level version which registers a COM server [implements the ID2Extesibility interface] and can be distributed to all office products at once [word, excel, etc]). I am using VS2010 and am attempting to get the addin to work on a customer's computer. I believe that I have figured out the problem is within the COM registration itself. It seems that the installer

Open a document in Office via HTTPS

耗尽温柔 提交于 2019-12-11 04:54:39
问题 I want to integrate a web based document management app with some office suite (preferrably Office 360) I want to open Excel and Word documents from the browser and they should get saved back to the server via HTTPS. The "open with" feature of browsers already allows for the opening, but how to add save featues? Do I have to write an add-in or is there some Office 360 API that allows integration of "Office online" right into my wrb app? Are there some other (JS based?) office suites that

Insert text before a list using Word Interop

纵然是瞬间 提交于 2019-12-11 04:18:45
问题 I'm trying to insert text before a list. I have the Microsoft.Office.Interop.Word.Range of the list, and get the previous Range before the list. I then try to add my paragraph text to the previous range, however, the paragraph is added as the first item in the list instead of before the list. // rangeObj is the Range object for the list var previousRange = rangeObj.Previous(MSWord.WdUnits.wdCharacter, 1); Paragraph paragraph; if (previousRange == null) { var rangeCopy = rangeObj.Duplicate;

Word Interop C#: Insert new page using existing page

假如想象 提交于 2019-12-11 04:13:00
问题 I have a word template file which contains a table and it has 11 rows and 3 columns. So there are 33 cells in table on first page. I fill these cell with some data, however if number of records are greater than 33 say 66, I am creating two files, each containing 33 records. I want to create single file which will contain all 66 records and there should be two pages in one file instead of two separate files. How should I do it? Following is the code I am using to create one doc file. private

Cannot open/decrypt/encrypt .docx with password longer than 15 characters in .Net

﹥>﹥吖頭↗ 提交于 2019-12-11 04:07:09
问题 Problem The following code works for .docx files with password upto 15 characters: using Word = Microsoft.Office.Interop.Word; var app = new Word.Application(); var doc = app.Documents.Open("file.docx", PasswordDocument: "<short password>"); For longer password the .Open method fails with COMExcetion of message: "Command failed". Question(s) With longer password, how can I: Encrypt / decrypt word files? Recognize that given password opens the file ? (optionally) Open the file in Microsoft

How to determine whether two word documents are the same using word interop

我与影子孤独终老i 提交于 2019-12-11 03:47:07
问题 Is there a good way to see if two documents are the same using the word interop? I have tried using something like: Word.Document tempDoc = app.CompareDocuments(document1, document2); My issue is that tempDoc is not null if they are the same, so I'm not sure how to use this result to determine whether the documents are the same. Thanks in advance! 回答1: The document it returns is a document with track changes turned on. So all you have to do is see if there ARE any changes. So: Document

Excel add-in fails with 0x8004063E

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 03:41:31
问题 I have an Excel add in which used to work perfectly. Lately, many customers received the following error (in the end of this question). Environment details: Windows 7/8 64 bit. Microsoft Office 2013 64 bit Add in is compiled under .net 3.5 Any help will be highly appreciated. Exception from HRESULT: 0x8004063E ********** Exception Text ********** System.Runtime.InteropServices.COMException (0x8004063E): Exception from HRESULT: 0x8004063E at System.Runtime.InteropServices.Marshal

Is there a way to import PST files into Outlook using C#?

走远了吗. 提交于 2019-12-11 03:36:38
问题 Using: Visual Studio 2017 (Language: C#) I have a similar function written below in PowerShell script, but I need the C# version of it to execute on the click of a button within Visual Studio: Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null $outlook = new-object -comobject outlook.application $namespace = $outlook.GetNameSpace("MAPI") dir “$env:userprofile\Documents\Outlook Files\*.pst” | % { $namespace.AddStore($_.FullName) } Any insight or examples of code would be much