In a VSTO Workbook, I would like to get data from a ListObject made from Excel. So there is not such things like DataBinding in code. What I would like to do is something like that : var rows = ((DataTable)Globals.Feuil1.MyNamedListObject.DataSource).Rows Unfortunately, here DataSource is null because, of course, it is not bound.
I’m currently writing a VSTO addin for Excel (in C#), where I need to maintain a 1:1 relationship between the Name of the WorkBook in Excel and a property in .Net. This is pretty trivial (below is pseudo-code, but very illustrative of what is happening; might have a signature wrong or similar though): public class […]
I have a VSTO application involving an Excel pivot table where I need to test if a particular PivotField is hidden or not. Initially I tried code as follows: if (myPivot.PivotFields(myFieldName).Orientation == Excel.XlPivotFieldOrientation.xlHidden) That compiled okay, but produced a run time error. I found that if I changed it to this: if (myPivot.PivotFields(myFieldName).Orientation == (double)Excel.XlPivotFieldOrientation.xlHidden) […]
I am currently working on an Excel add in and I am having problems to set the workbook using the file path without opening the workbook itself. I have my pseudocode below: 1. FilePath = @”C:\temp\wb.xlsx”; 2. Excel.Workbook wb = new Excel.Workbook(); 3. wb = FilePath; Number 3 will raise an error. Can anybody help […]
I am working with an Excel Add-In created by someone else in Visual Studio 2015 targeting the .NET 4.5 framework. My Task is to create a simple way to deploy this Add-In onto machines that are running Office 2010 or later. I worked through this MSDN example on how to deploy an Office solution using […]
I’m trying to create an Excel document-level customization that upon opening fetches an array of strings from a webservice and for each of these strings creates a worksheet with some functionality. I’ve tried 2 approaches: I created a ‘Template’ Sheet at Design Time with all functionality, then try to copy this template worksheet for each […]
I am getting an Invalid Index COM Exception when attempting to retrieve a page break item that should exist. It appears every time I attempt to access the 3rd or higher item in an Excel.Worksheet.HPageBreaks list, it returns an invalid index error. If it’s item 1 or 2, it has no problem retrieving the item […]
I am creating a com add-in using VSTO C# but couldn’t find a function or event that allows to sort tree nodes manually and add a toggle button in excel auto filter popup screen from code. Here is the sample image attached as I want.
Can somebody help me regarding the problem I encountered in C# and Excel. Currently, my code goes like this: string fname = Globals.ThisAddIn.Application.ActiveWorkbook.FullName; con = new OleDbConnection(@”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + fname + “;Extended Properties=\”Excel 8.0;HDR=” + hdr + “\””); I am trying to connect to Excel worksheet as my database from my C# application. What bother’s […]
I have a custom XML part in my VSTO Excel Add-In. In one of my elements, I have 4 attributes: <myElement attr1=”Value” attr2=”Value” attr3=”Value” attr4=”Value” /> Whenever I update the an attribute with the following code: addInXmlPart.SelectSingleNode(“//XPath to Element”).Attributes.NodeValue = “New Value”; … it always moves the that updated attribute to the last index: <myElement […]