Tag: vsto

VSTO 2010加载项不能在全屏窗口中打开

我们用VS2010,.NET 4.0创build了一个VSTO Excel工作簿。 在我们发布并安装xlsx文档之后,它首次按预期打开。 然后我们使用插件运行一些操作并保存工作簿。 closures并再次打开后,Excel框架会打开全屏幕,但工作簿会在小窗口中打开,无法重新resize。 We have tried the following code on the following workbook events : Activate, Startup, Open Application.WindowState = XlWindowState.xlMaximized; Application.ActiveWindow.WindowState = XlWindowState.xlMaximized; 同样的结果,工作簿在一个不可调整的小窗口中打开。 我们希望工作簿能够全屏打开。 请提交build议/想法。 谢谢。

禁用Excel保存button

如何禁用Excel保存button或覆盖它的默认function? 我有一个VSTO Excel项目,并且没有必要保存Excel工作簿本身,因为我们正在使用我们自己的方式来使用WCF保存文档数据。 它甚至在用户没有写权限的时候给我们造成问题:然后他得到一个“另存为”对话框,它仍然没有任何作用,因为我用下面的代码取消了保存事件: void ThisWorkbook_BeforeSave(bool SaveAsUI, ref bool Cancel) { Cancel = true; } 我也可以使用以下命令取消“你想保存”提示: void ThisWorkbook_BeforeClose(ref bool Cancel) { this.Saved = true; } 但是,如果该文件是只读的,我点击保存button,那么我得到一个“这个文件是只读的”消息。 我不想得到它。

在Excel中使用VSTO,是否可以直接将Excel公式应用于Range对象?

假设我的工作表中有单元格A1:A10的Range对象。 这些单元格都包含不同长度的string,我想知道最长的string的长度。 在Excel中,我可以使用像{=MAX(LEN(A1:A10))}这样的数组公式来find这个值。 我想我可以在工作表中设置一些其他单元格来使用这个公式并检索值,但我宁愿不改变工作表。 有什么方法可以直接在代码中应用这个公式(或任何公式)到Range对象并检索结果? 或者,有没有其他简单的方法来find这个值,而不改变工作表的内容,也没有循环范围内的每个单元格?

代码转换 – MFC C ++到C#中的VSTO Excel插件

我在C#.NET4.0中将MFC C ++ COM Addin转换为VSTO Excel Addin。 有很多代码指的是C API。 这是一个例子。 我可能会使用Excel DNA来简化我的转换任务。 FYI:xlr是XLSDK中的一个类。 //allocate local storage for the reference m_pControllerReference = new xlr( controllerRange ) ; //get the name of the book and sheet with the reference g->Excel.fn( xlSheetNm, *m_pControllerReference ) ; if ( g->Excel.resultXltype() != xltypeErr ) { m_referenceSheetName = g->Excel.resultCString() ; // and […]

即使在Excel中“删除”之后,Excel / VSTO中的命名范围也会返回

我正在使用VSTO(基于客户端请求,在Visual Studio 2008上)在单个单元上创build命名范围,然后将其保存到工作簿中,随后在应用程序重新启动时读取。 如果我在Excel中删除一个包含一个或多个命名区域的行,请保存我的工作簿并重新启动excel,那么所述行中的命名范围仍然会返回,这就是我的问题。 为了命名单元格,我做了一个简单的Application.Selection.Name =“whatever”。 为了让他们回到starup我使用Application.ActiveWorkbook.Names。 有人可以告诉我,如果这是正确的行为,如果有的话,如果有任何方法来过滤范围 – 通过C#的Excel Interop代码 – 只有当前可见。 提前致谢。

F#Excel UsedRange未定义

错误:“字段,构造函数或成员UsedRange未定义”。 代码摘录: open Microsoft.Office.Interop.Excel open Microsoft.Office.Tools.Excel // Onorio's excellent suggestion didn't fix code until this line was added. // Once the above line was added, Onorio's suggestion worked, // but now F# says "The field, constructor or member 'EntireColumn' is not defined". let xl = ApplicationClass() xl.Workbooks.OpenText(… let wb = xl.Workbooks.Item(1) let ws = wb.ActiveSheet […]

VSTO对angular线在Excel单元格中

我目前正在试图find一种方法,在C#中使用VSTO for Excel,使用C#代码在单元格中绘制对angular线。 但我找不到任何人甚至试图做到这一点。 有谁知道如何做到这一点? 谢谢 (对不起,我的英文不好,但这不是我的语言)

使用C#在Excel中开发用户定义函数?

我在VS 2010中使用C#和类库在Excel中开发用户定义函数。我遵循教程如何使用C#在Excel中创buildUDF代码运行良好,它得到Registered.I可以看到我的AddIn在InstalledAddIN列表中。 但是,单击公式栏中的插入functionbutton后。 在可用的公式对话框中,“或者select一个类别”下拉框我看不到我使用VS 2010(pipe理模式)创build的function,但是EXCEL处于访客模式。权限必须对其做任何事情。 ?? 也可以任何人解释我如何安装我的AddIn? 感谢您的时间

错误:无法获取Range类的AutoFilter属性

在下面的代码中,我只收到第二次调用AutoFilter()时收到上述错误。 string FilterValue1 = tbSysCat1.Text.FilterDoesNotContain(); string FilterValue2 = tbSysCat2.Text.FilterDoesNotContain(); string FilterValue3 = tbSysCat3.Text.FilterDoesNotContain(); string[] SysCat = new string[6]; // EDIT: originally tried object[]; still got error SysCat[0] = FilterValue1; SysCat[1] = FilterValue1.ToUpper(); SysCat[2] = FilterValue2; SysCat[3] = FilterValue2.ToUpper(); SysCat[4] = FilterValue3; SysCat[5] = FilterValue3.ToUpper(); VApplication.ActiveSheet.Range[VWorkingRange].AutoFilter(9, Missing.Value, Missing.Value, Missing.Value, true); VApplication.ActiveSheet.Range[VWorkingRange].AutoFilter(9, SysCat, MSExcel.XlAutoFilterOperator.xlFilterValues, Missing.Value, true); 注意:FilterDoesNotContain()是一种扩展方法,用于为“不包含”添加特定于Excel的通配符。 […]

Excel插件。 缺lessfunction区(XMl)

我开发了Excel插件到Visual Studio 2012.使用项目Excel 2010加载项。 在该项目中创build了一个Ribbon(XML): [ComVisible(true)] public class PricelistRibbon : Office.IRibbonExtensibility { private Office.IRibbonUI _ribbon; public PricelistRibbon() { } public event EventHandler ClickButtonRibben; protected virtual void OnClickButtonRibben() { var handler = ClickButtonRibben; if (handler != null) handler(this, EventArgs.Empty); } #region IRibbonExtensibility Members public string GetCustomUI(string ribbonID) { return GetResourceText("ProcessingPricelist.PricelistRibbon.xml"); } #endregion #region Ribbon Callbacks //Create […]