Beispiel #1
0
        public static string Address([ExcelReference] XlOper o)
        {
            ExcelThread xlt = ExcelThread.Current;
            var         ret = xlt.Call(Excel.Functions.GetCell, 1, o);

            return(ret.AsString());
        }
Beispiel #2
0
        public static Array Expand(Array a, int rowOffset = 0, int colOffset = 1, string refTxt = null)
        {
            ExcelThread xlt = ExcelThread.Current;
            XlOper      o   = refTxt == null || refTxt == "" ? xlt.GetCaller() : xlt.Call(Excel.Functions.Indirect, refTxt);
            var         des = xlt.Call(Excel.Functions.Offset, o, rowOffset, colOffset, a.GetLength(0), a.GetLength(1));

            Excel.AsyncRangeUpdate(xlt.RefText(des, false), a);
            return(a);
            //var app = Excel.Application;
            //app.GetType().InvokeMember("Run", BindingFlags.InvokeMethod, null, app, new object[] { "QDefineRangeName", "hh" });
            //object workbook = app.GetType().InvokeMember("ActiveWorkbook", BindingFlags.GetProperty, null, app, null);
            //object properties = app.GetType().InvokeMember("BuiltinDocumentProperties", BindingFlags.GetProperty, null, workbook.GetType(), null);
            //object property = app.GetType().InvokeMember("Item", BindingFlags.GetProperty, null, properties, new object[] { "Author" });
            //object value = app.GetType().InvokeMember("Value", BindingFlags.GetProperty, null, property, null);
            //xlt.CallPrivileged(Excel.Commands.DefineName, "hehe", "$A$2");
            //xlt.CallUDF("QDefineRangeName", "hh");
        }