Ejemplo n.º 1
0
 /// <summary>
 /// Filters a list using the AutoFilter.
 /// </summary>
 /// <param name="field">The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field one).</param>
 /// <param name="criteria1">The criteria (a string; for example, "101"). Use "=" to find blank fields, or use "<>" to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is xlTop10Items, Criteria1 specifies the number of items (for example, "10").</param>
 /// <param name="criteriaOperator">One of the constants of XlAutoFilterOperator specifying the type of filter.</param>
 /// <param name="criteria2">The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.</param>
 /// <param name="visibleDropDown">True to display the AutoFilter drop-down arrow for the filtered field. False to hide the AutoFilter drop-down arrow for the filtered field. True by default.</param>
 public void AutoFilter(int?field = null, string criteria1 = null, AutoFilterOperator?criteriaOperator = null, string criteria2 = null, bool?visibleDropDown = null)
 {
     InternalObject.GetType().InvokeMember("AutoFilter", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, ComArguments.Prepare(field, criteria1, criteriaOperator, criteria2, visibleDropDown));
 }
Ejemplo n.º 2
0
        public void Sort(Range key1 = null, SortOrder?order1 = null, Range key2 = null, SortType?type = null, SortOrder?order2 = null, Range key3 = null, SortOrder?order3 = null, YesNoGuess?header = YesNoGuess.No)
        {
            //if (!(key1 is String) && !(key1 is Range) && key1 != null)
            //    throw new ArgumentException("Key1 must be a string (range named) or a range object");

            //if (!(key2 is String) && !(key2 is Range) && key2 != null)
            //    throw new ArgumentException("Key2 must be a string (range named) or a range object");

            //if (!(key3 is String) && !(key3 is Range) && key3 != null)
            //    throw new ArgumentException("Key3 must be a string (range named) or a range object");

            InternalObject.GetType().InvokeMember("Sort", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, ComArguments.Prepare(key1, order1, key2, order2, key3, order3, header));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new PivotCache.
 /// </summary>
 /// <param name="SourceType">SourceType can be one of these XlPivotTableSourceType constants: xlConsolidation, xlDatabase, or xlExternal.</param>
 /// <param name="SourceData">The data for the new PivotTable cache.</param>
 /// <param name="Version">Version of the PivotTable. Version can be one of the XlPivotTableVersionList constants.</param>
 public PivotCache Create(XlPivotTableSourceType SourceType, object SourceData, XlPivotTableVersionList Version)
 {
     return(new PivotCache(InternalObject.GetType().InvokeMember("Create", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, ComArguments.Prepare(SourceType, SourceData, Version))));
 }
Ejemplo n.º 4
0
 public Sheet Add(Sheet before = null, Sheet after = null, int count = 1, SheetType type = SheetType.Worksheet, string path = null)
 {
     return(Sheet.ResolveType(InternalObject.GetType().InvokeMember("Add", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject,
                                                                    ComArguments.Prepare(before, after, count, (String.IsNullOrEmpty(path) ? (object)(int)type : (object)path)))));
 }
Ejemplo n.º 5
0
 public Workbook this[int id]
 {
     get
     {
         return(new Workbook(InternalObject.GetType().InvokeMember("Item", System.Reflection.BindingFlags.GetProperty, null, InternalObject, ComArguments.Prepare(id))));
     }
 }
Ejemplo n.º 6
0
 private Hyperlink Add(object anchor, string address, string subAddress = null, string screenTip = null, string textToDisplay = null)
 {
     return(new Hyperlink(InternalObject.GetType().InvokeMember("Add", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, ComArguments.Prepare(anchor, address, subAddress, screenTip, textToDisplay))));
 }
Ejemplo n.º 7
0
        public SortFields Add(Range key, SortOn sortOn = SortOn.Values, SortOrder order = SortOrder.Ascending, SortDataOption dataOption = SortDataOption.Normal)
        {
            InternalObject.GetType().InvokeMember("Add", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, ComArguments.Prepare(key, sortOn, order, dataOption));

            // I'm returning this since the documentation says it returns 'SortFields' not 'SortField'
            return(this);
        }