office-interop

Excel file generation on server without Excel installed

折月煮酒 提交于 2020-01-04 04:01:08
问题 I am using Microsoft.Office.Interop.Excel and generating Excel files using the SaveAs method. This all works correctly on computer with Excel installed. However, my server does not have Excel installed. How can I generate my files? 回答1: If you generate a file using Interop you need to install Excel on the server. Microsoft doesn't support installing Excel (or Word) on the server. Instead you should download the Office Open XML SDK from Microsoft and use that library to generate Excel 2007

Outlook MailItem as Stream

守給你的承諾、 提交于 2020-01-04 03:57:26
问题 Is it possible to return a MailItem directly as a Stream ? ( MailItem from Microsoft.Office.Interop.Outlook ) Now I have found a temporary solution to first save a MailItem to a directory, opening it and returning the stream to the file and afterwards deleting the file again. This temporary solution is slow when processing lots of emails and I would like to replace it with e.g. returning a MailItem as MemoryStream directly. How can this be done? ( Edit due to comments: being slow is one part,

detecting when a user opens a word document and when he types in it (in c#)

╄→尐↘猪︶ㄣ 提交于 2020-01-04 02:02:36
问题 i'd like to do the following : whenever a word document is open i need to save it in a way, and then if a user starts typing in it i want to save the time the document is being edited. i'm just on the first phase, and i can't seem to manage detecting when a user opens a document. i tried using Microsoft.Office.Interop.Word, but, in this way i don't want to start word application unless the user opens a document. but, when i want to initialize a Microsoft.Office.Interop.Word.Application, it's

detecting when a user opens a word document and when he types in it (in c#)

一世执手 提交于 2020-01-04 02:02:12
问题 i'd like to do the following : whenever a word document is open i need to save it in a way, and then if a user starts typing in it i want to save the time the document is being edited. i'm just on the first phase, and i can't seem to manage detecting when a user opens a document. i tried using Microsoft.Office.Interop.Word, but, in this way i don't want to start word application unless the user opens a document. but, when i want to initialize a Microsoft.Office.Interop.Word.Application, it's

C# Export Excel Chart as object (not as picture) to Word

喜欢而已 提交于 2020-01-03 17:46:29
问题 I want to export an excel chart to Word as an object (Excel Chart), not as a picture. As picture is very easy with Chart.CopyPicture I´m using AddOleObject, but it gives an error about not being able to link the file. This is the code: Document doc; // Existing document string chartSheet = xlsFilePath + "!" + chartSheetName; string type = "Excel.Chart.8"; InlineShape shape = doc.Content.InlineShapes.AddOLEObject(ClassType: type, FileName: chartSheet, LinkToFile: false, DisplayAsIcon: false);

Alias for Microsoft.Office.Interop.Word namespace not recogized

拟墨画扇 提交于 2020-01-03 16:59:08
问题 Here is my code in Form1.vb: Imports Word = Microsoft.Office.Interop.Word Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim oWord As Word.Application Dim oWord1 As Microsoft.Office.Interop.Word.Application Dim oWord2 as Application I'm using VStudio2012 and Office 2010 and following the sample from https://support.microsoft.com/kb/316383 The declaration of oWord is flagged by intellisense as "Type 'Word

Alias for Microsoft.Office.Interop.Word namespace not recogized

别等时光非礼了梦想. 提交于 2020-01-03 16:58:44
问题 Here is my code in Form1.vb: Imports Word = Microsoft.Office.Interop.Word Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click Dim oWord As Word.Application Dim oWord1 As Microsoft.Office.Interop.Word.Application Dim oWord2 as Application I'm using VStudio2012 and Office 2010 and following the sample from https://support.microsoft.com/kb/316383 The declaration of oWord is flagged by intellisense as "Type 'Word

starting excel application with addins from c# application

眉间皱痕 提交于 2020-01-03 16:12:26
问题 I have a c# app and it needs to create an excel application & then open a workbook. The issue is I need a Bloomberg addinn to be loaded when excel opens. The only way I have found is in this post working example. This indeed starts excel and able to use the Bloomberg functions. However I was wondering if there was a way to cast myXl to xlApp where xlApp is of type Microsoft.Office.Interop.Excel.Application? var myXl = Process.Start("excel.exe"); The reason being is I have a library which has

starting excel application with addins from c# application

岁酱吖の 提交于 2020-01-03 16:10:06
问题 I have a c# app and it needs to create an excel application & then open a workbook. The issue is I need a Bloomberg addinn to be loaded when excel opens. The only way I have found is in this post working example. This indeed starts excel and able to use the Bloomberg functions. However I was wondering if there was a way to cast myXl to xlApp where xlApp is of type Microsoft.Office.Interop.Excel.Application? var myXl = Process.Start("excel.exe"); The reason being is I have a library which has

C# Word Automation : Replace picture with Text

柔情痞子 提交于 2020-01-03 03:21:12
问题 I am programming a software and it requires images to be replaced with either images or text. I found some code to replace images with images it works fine. I want to tweak this code so that i can also replace images with text . I know there are better ways to do it but I specifically need it done using Interlope. Any help would be appreciated. using System.Collections.Generic; using Word = Microsoft.Office.Interop.Word; namespace WordExample { class WordExample { #region Constructor public