예제 #1
0
        CreateGraphTitle
        (
            Microsoft.Office.Interop.Excel.Workbook workbook
        )
        {
            Debug.Assert(workbook != null);

            GraphHistory oGraphHistory =
                (new PerWorkbookSettings(workbook)).GraphHistory;

            String sGraphTitle;

            // Order of precedence: suggested title, suggested file name,
            // workbook name.

            if (
                !oGraphHistory.TryGetValue(
                    GraphHistoryKeys.ImportSuggestedTitle,
                    out sGraphTitle)
                &&
                !oGraphHistory.TryGetValue(
                    GraphHistoryKeys.ImportSuggestedFileNameNoExtension,
                    out sGraphTitle)
                )
            {
                Debug.Assert(!String.IsNullOrEmpty(workbook.Name));

                sGraphTitle = workbook.Name;
            }

            return(sGraphTitle);
        }
예제 #2
0
        AppendGraphHistoryValues
        (
            GraphHistory oGraphHistory,
            StringBuilder oStringBuilder,
            params String [] asGraphHistoryKeys
        )
        {
            Debug.Assert(oGraphHistory != null);
            Debug.Assert(oStringBuilder != null);
            Debug.Assert(asGraphHistoryKeys != null);

            String sGraphHistoryValue;

            foreach (String sGraphHistoryKey in asGraphHistoryKeys)
            {
                if (oGraphHistory.TryGetValue(sGraphHistoryKey,
                                              out sGraphHistoryValue))
                {
                    StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                                                        sGraphHistoryValue);
                }
            }
        }
    AppendGraphHistoryValues
    (
        GraphHistory oGraphHistory,
        StringBuilder oStringBuilder,
        params String [] asGraphHistoryKeys
    )
    {
        Debug.Assert(oGraphHistory != null);
        Debug.Assert(oStringBuilder != null);
        Debug.Assert(asGraphHistoryKeys != null);

        String sGraphHistoryValue;

        foreach (String sGraphHistoryKey in asGraphHistoryKeys)
        {
            if ( oGraphHistory.TryGetValue(sGraphHistoryKey,
                out sGraphHistoryValue) )
            {
                StringUtil.AppendLineAfterEmptyLine(oStringBuilder,
                    sGraphHistoryValue);
            }
        }
    }