ms-office

Serialize current ActiveDocument from office 2007 add-in

女生的网名这么多〃 提交于 2019-12-29 01:17:33
问题 Im creating a VSTO Office 2007 add-in. I need to be enable or find a solution where I can save to a webservice with a byte[] instead of hard drive. So, I open the document by going to a website and clicking on a url, that click send me a Word Document, and I select Open using MS Word 2007. The document open, and if I check the data I have: ActiveDocument.Fullname = http://[servername or ip]/[some iis folder]/file.asp?id=353&type=doc` so I think this is all in memory since I dont have the

Accessing an open Excel Workbook in C#

蹲街弑〆低调 提交于 2019-12-28 13:40:14
问题 I need to access an excel file that is already open. I thought just inspecting the .Workbooks property that it would be there but it isn't. What is the right way to get a reference to the open workbook? var app = new Microsoft.Office.Interop.Excel.Application(); // the count is 0 =( app.Workbooks.Count == 0; EDIT I can get a reference to the Excel Application via... app = (Excel.Application)Marshal.GetActiveObject("Excel.Application"); but app.Workbooks.Count is still 0 why isn't it able to

Using Python to program MS Office macros?

倾然丶 夕夏残阳落幕 提交于 2019-12-28 04:49:15
问题 I've recently taken it as a project to teach myself how to program in Python. Overall, I must say that I'm impressed with it. In the past I've typically stuck to programming in VBA mostly for MS Excel (but also a bit in MS Access and Word) and have struggled to find ways to make it do things that Python can easily do with a single command. I was wondering if there were a reasonable way to harness the programming power and ease of Python while at the same time make use of the various tools in

Initializing an array on arbitrary starting index in c#

早过忘川 提交于 2019-12-28 04:21:09
问题 Is it possible in c# to initialize an array in, for example, subindex 1? I'm working with Office interop, and every property is an object array that starts in 1 (I assume it was originally programed in VB.NET), and you cannot modify it, you have to set the entire array for it to accept the changes. As a workaround I am cloning the original array, modifying that one, and setting it as a whole when I'm done. But, I was wondering if it was possible to create a new non-zero based array 回答1: You

asp.net web service using office 2010 COM

烈酒焚心 提交于 2019-12-28 03:11:20
问题 I am writing a web service and would like to change the .docx or .doc to .xps. I'm using office com to help me to save as .xps format as following: [WebMethod] public string GetDocPreviewUrl(string m_userName, string m_orgFileName) { string m_returnUrl = ""; string m_orgFilePath = _currentDirectory + "\\" + m_userName + "\\" + m_orgFileName; if (File.Exists(m_orgFilePath)) { string m_xpsFilePath = _currentDirectory + "\\" + m_userName + "\\" + Path.GetFileNameWithoutExtension(m_orgFileName) +

asp.net web service using office 2010 COM

无人久伴 提交于 2019-12-28 03:11:09
问题 I am writing a web service and would like to change the .docx or .doc to .xps. I'm using office com to help me to save as .xps format as following: [WebMethod] public string GetDocPreviewUrl(string m_userName, string m_orgFileName) { string m_returnUrl = ""; string m_orgFilePath = _currentDirectory + "\\" + m_userName + "\\" + m_orgFileName; if (File.Exists(m_orgFilePath)) { string m_xpsFilePath = _currentDirectory + "\\" + m_userName + "\\" + Path.GetFileNameWithoutExtension(m_orgFileName) +

Cell color changing in Excel using C#

无人久伴 提交于 2019-12-27 11:45:48
问题 I am using a Windows application for exporting a data table to Excel. It's working. Now I want to give some color for particular text in the cell. How shall I do this? 回答1: For text: [RangeObject].Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red); For cell background [RangeObject].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red); 回答2: Note: This assumes that you will declare constants for row and column indexes named COLUMN_HEADING_ROW

Cell color changing in Excel using C#

血红的双手。 提交于 2019-12-27 11:45:06
问题 I am using a Windows application for exporting a data table to Excel. It's working. Now I want to give some color for particular text in the cell. How shall I do this? 回答1: For text: [RangeObject].Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red); For cell background [RangeObject].Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red); 回答2: Note: This assumes that you will declare constants for row and column indexes named COLUMN_HEADING_ROW

Change Ribbon-menu properties after ribbon-load

扶醉桌前 提交于 2019-12-25 19:47:51
问题 I build a VSTO (made with the Ribbon Designer, not using Ribbon XML). Is it possible to change the properties (like label) of the Tab from Ribbon1.cs ? I even can't change the ribbon title with : private void Ribbon1_Load(object sender, RibbonUIEventArgs e) { myRibbon.Label = "something"; } 回答1: The way to do this dynamically is using a callback. In your ribbon XML: <tab id="myTabID" getLabel="myCallback"> .... </tab> In your ribbon code: public string myCallback(IRibbonControl control) {

Using interop.word ranges

假装没事ソ 提交于 2019-12-25 18:12:15
问题 I'm having trouble figuring out how to work with word ranges. I have picture files that I am adding to a word file, but I can't figure out how to add text and tables in between the pictures. The structure I want is this: Text, table, picture. Then repeat. However, when I add text or tables, they all area added after the four pictures, which stay at the top of the file. I've been reading and I've figured out I need to use ranges to specify where you want to place the tables/text, but all the