コード例 #1
0
        internal static string GetWorksheetPropertyString(Worksheet ws, string name)
        {
            ExcelUIThreadProtecter.CheckIsExcelUIMainThread();
            string  result = string.Empty;
            dynamic cp     = GetWorksheetCusotmProperty(ws, name);

            if (cp != null)
            {
                result = cp.Value;
            }
            return(result);
        }
コード例 #2
0
 internal static Range GetListObjectRange(ListObject listObject)
 {
     ExcelUIThreadProtecter.CheckIsExcelUIMainThread();
     try
     {
         return(listObject.Range);
     }
     catch //ignore error here
     {
         return(null);
     }
 }
コード例 #3
0
 internal static Range GetNameRange(Name name)
 {
     ExcelUIThreadProtecter.CheckIsExcelUIMainThread();
     try
     {
         return(name.RefersToRange);
     }
     catch //ignore error here
     {
         return(null);
     }
 }
コード例 #4
0
        internal static void SetWorksheetProperty(Worksheet ws, string propertyName, string propertyValue)
        {
            ExcelUIThreadProtecter.CheckIsExcelUIMainThread();
            dynamic cp = GetWorksheetCusotmProperty(ws, propertyName);

            if (cp == null)
            {
                CustomProperties cps = ws.CustomProperties;
                cps.Add(propertyName, propertyValue);
            }
            else
            {
                cp.Value = propertyValue;
            }
        }
コード例 #5
0
        internal static void SetWorkbookProperty(Workbook wk, string propertyName, string propertyValue)
        {
            ExcelUIThreadProtecter.CheckIsExcelUIMainThread();
            dynamic cp = GetWorkbookCustomProperty(wk, propertyName);

            if (cp == null)
            {
                dynamic cps = wk.CustomDocumentProperties;
                cps.Add(propertyName, false, MsoDocProperties.msoPropertyTypeString, propertyValue);
            }
            else
            {
                cp.Value = propertyValue;
            }
        }
コード例 #6
0
        internal static Range GetRange(Worksheet ws, string rangeName)
        {
            ExcelUIThreadProtecter.CheckIsExcelUIMainThread();
            Range    result    = null;
            Workbook wk        = ws.Parent;
            Name     namedName = GetName(wk, rangeName);

            if (namedName != null)
            {
                result = GetNameRange(namedName);
            }

            if (result == null)
            {
                ListObject lo = GetListObject(ws, rangeName);
                if (lo != null)
                {
                    result = GetListObjectRange(lo);
                }
            }
            return(result);
        }