office-interop

Microsoft.Office.Interop.Excel.dll - Server doesnot have Excel installed

笑着哭i 提交于 2019-12-08 06:45:44
问题 I'm generating an Excel file using "Microsoft.Office.Interop.Excel.dll" and my deployment server does not permit to install Excel? I know that its mandatory to install Excel, so my question is: Is there any way that we can deploy the same code without installing Excel? 回答1: I know that its mandatory to install Excel, so my question Is there way that we can deploy same code without installing Excel or any other way suggested? No, it's mandatory to install Excel. But you already know that,

Is it possible to use Microsoft.Office.Interop.Word to programatically remove line numbering from a Word document?

大兔子大兔子 提交于 2019-12-08 05:23:30
问题 I would like to use Microsoft.Office.Interop.Word to programatically remove all line numberings from a Word document. (How) is it possible? Should I use the LineNumbering interface? 回答1: Line numbering is an document- or section-level setting, and it's controlled over the PageSetup object. To simply turn it off throughout the document: Word.Document doc = wdApp.ActiveDocument; doc.PageSetup.LineNumbering.Active = false; 来源: https://stackoverflow.com/questions/49496067/is-it-possible-to-use

How do I remove an Excel Chart Legend Entry with C#?

六眼飞鱼酱① 提交于 2019-12-08 04:32:25
问题 I want to remove the legend entry for some, but not all, series in my Excel chart. From my experience it seems as if SeriesCollection.Item(index) and LegendEntries.Item(index) are not related. Given a series n how can I remove only the legend for that series? I'm using Office Interop 2010 with Visual Studio 2010. This is easily accomplished via the GUI by selecting the legend entry, then right clicking and choosing "delete". 回答1: To delete a legend entry you have to know the index of the

VSTO Alternatives [closed]

天涯浪子 提交于 2019-12-07 16:25:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . What alternatives exist for VSTO? What does managedxll do that VSTO does not - When would you use one vs the other Google does not bring much up on this subject This is more of an interview question - What are the pros and cons and both is the crux of the question here 回答1: VSTO presumes you are using Visual

Detecing password protected PPT and XLS documents

旧街凉风 提交于 2019-12-07 11:25:47
问题 I found this answer https://stackoverflow.com/a/14336292/1537195 which gave a good way to detect password protection for DOC and XLS files. //Flagged with password if (bytes.Skip(0x20c).Take(1).ToArray()[0] == 0x2f) return true; //XLS 2003 if (bytes.Skip(0x214).Take(1).ToArray()[0] == 0x2f) return true; //XLS 2005 if (bytes.Skip(0x20B).Take(1).ToArray()[0] == 0x13) return true; //DOC 2005 However it does not seem to cover all XLS files and I am also looking for a way to detect PPT files in

Word Automation - Disable Alerts

喜你入骨 提交于 2019-12-07 10:54:19
问题 I am automating Word, so I would like to suppress all alerts. Word.Application word = new Word.Application(); word.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone; I use the code listed above, but I keep getting messages from Word - e.g., the document is already open. Is there a way to avoid this? How to supress all those stupid messageboxes? EDIT : Concider to all answers, I guess a watchdog is really the only option. To bad nothing has changed in last years. Thread

Word interop - how to close one Word window without closing all of them?

只谈情不闲聊 提交于 2019-12-07 10:03:45
问题 I'm using Microsoft Word Primary Interop Assemblies to slave MS Word. My application opens up its own Word window (using an instance of Microsoft.Office.Interop.Word.Application). After the app does its thing, I want to close the Word window that I opened, but I don't want to affect other Word windows that the user might have open . If I use Application.Quit then all the Word windows end up closing. If I use Application.ActiveWindow.Close then the word document closes but the Word window that

Issue with SentOnBehalfOfName

放肆的年华 提交于 2019-12-07 09:56:30
i'm stack with Outlook issue where i want to change Email Sender . I want to send all emails from Outlook with one sender. When i change sender from Outlook it works fine but when i change it from Outlook plugin it's not work. I'm using following code: private void adxOutlookEvents_ItemSend(object sender, ADXOlItemSendEventArgs e) { if (e.Item is MailItem) { MailItem mail = e.Item as MailItem; mail.SentOnBehalfOfName = "UserName"; mail.Save(); return; } } But nothing happens. I don't see any error or exception but email come to Outlook with old sender. Can you please help me with that? UPDATED

Can you paste a block of cells in one shot using Excel Interop w/o using the clipboard?

老子叫甜甜 提交于 2019-12-07 09:44:23
问题 I'm trying to transfer data from a DataSet into an Excel workbook. Unfortunately, I need more control than I can get by simply linking to Excel via ADO.NET and using standard SQL to select and insert the data, so I'm using excel interop. My original algorithm involved looping through all the tables/rows/items of the data set and individually setting the Formula of each cell in Excel. This worked, but it was taking nearly half a minute to transfer all the data. I decided to try a different

error “string parameter too long”. at microsoft.office.interop.word.find.execute

筅森魡賤 提交于 2019-12-07 05:55:24
问题 I want to create a world document using C#. So this is my code for replace word document variables. private void FindAndReplace(Microsoft.Office.Interop.Word.Application WordApp, object findText, object replaceWithText) { try { object matchCase = true; object matchWholeWord = true; object matchWildCards = false; object matchSoundsLike = false; object nmatchAllWordForms = false; object forward = true; object format = false; object matchKashida = false; object matchDiacritics = false; object