Smrf.NodeXL.ExcelTemplate.ApplicationUtil.OnWorkbookStartup C# (CSharp) Method

OnWorkbookStartup() public static method

public static OnWorkbookStartup ( Microsoft application ) : void
application Microsoft
return void
    OnWorkbookStartup
    (
        Microsoft.Office.Interop.Excel.Application application
    )
    {
        Debug.Assert(application != null);

        AutoCorrect oAutoCorrect = application.AutoCorrect;

        if (!oAutoCorrect.AutoExpandListRange)
        {
            const String CheckboxPath =
                "Office Button, Excel Options, Proofing, AutoCorrect Options,"
                + " AutoFormat As You Type, Include new rows and columns in"
                + " table"
                ;

            String Message =
                "Excel's \"auto table expansion\" feature is turned off, and"
                + " NodeXL cannot work properly without it.  Do you want"
                + " NodeXL to turn it on for you?"
                + "\n\n"
                + " (You can turn it off later if necessary using "
                + CheckboxPath
                + ".)"
                ;

            if (MessageBox.Show(Message, FormUtil.ApplicationName,
                MessageBoxButtons.YesNo, MessageBoxIcon.Warning,
                MessageBoxDefaultButton.Button1) ==
                DialogResult.Yes)
            {
                oAutoCorrect.AutoExpandListRange = true;
            }
            else
            {
                FormUtil.ShowError(
                    "NodeXL will not work properly.  You should turn on"
                    + " Excel's auto table expansion feature using "
                    + CheckboxPath
                    + "."
                    );
            }
        }
    }