Exemplo n.º 1
0
        public double[] Beta2M(double mean, double stdev, double min, double max)
        {
            this.mean  = mean;
            this.stdev = stdev;
            this.min   = min;
            this.max   = max;

            Excel.Range selection = ObjModel.GetSelection();

            /*
             * if (selection.Height != 1 || selection.Width != 4)
             * {
             *  MessageBox.Show("Improper selection size (1x4)");
             *  return null;
             * }
             */
            double dA = -1;
            double dB = -1;

            dA = (mean - min) / (max - min) * ((mean - min) / (max - min) * (1 - (mean - min) / (max - min)) / (stdev * stdev / Math.Pow(max - min, 2)) - 1);
            dB = (1 - (mean - min) / (max - min)) * ((mean - min) / (max - min) * (1 - (mean - min) / (max - min)) / (Math.Pow(stdev, 2) / Math.Pow(max - min, 2)) - 1);
            double[] vOUT = new double[4];
            vOUT[0] = dA;
            vOUT[1] = dB;
            vOUT[2] = min;
            vOUT[3] = max;
            return(vOUT);
        }
        public void btnExperimental_Click(IRibbonControl e)
        {
            ChartBuilder cb = new ChartBuilder();

            Tools.Worksheet worksheet = ObjModel.GetActiveSheet();
            Excel.Range     cells     = worksheet.Range["A1", "J20"];
            cb.AddChart(worksheet, cells, ChartBuilder.Template.Chart1);
        }
 public void btnBetaArray_Click(IRibbonControl e)
 {
     this.btnClear_Click(e);
     ObjModel.SetCell(10, "A1");
     ObjModel.SetCell(2, "B1");
     ObjModel.SetCell(3, "C1");
     ObjModel.SetCell(15, "D1");
     ObjModel.SetArrayFormulas("A2:D2", "=Beta2M(A1,B1,C1,D1)");
 }
        public void btnAddFormulas_Click(IRibbonControl e)
        {
            ObjModel.SetFormulas("A1:B2", "=C3");       //relative references
            ObjModel.SetFormulas("A4:B5", "=$C$3");     //absolute references

            ObjModel.SetCell(5, "A6");
            ObjModel.SetFormulas("A7:A10", "=A5+RandBetween(5,100)+Norm.Inv(.3,0,1)"); //add a formula to the sheet
            ObjModel.SetFormulas("E1:H1", "=Column()+2000");
            ObjModel.SetArrayFormulas("E2:H2", "=INFL(2002, 2000,1,1,4)*E1:H1");
        }
Exemplo n.º 5
0
        //============= KEYBINDS =============


        //=============== FORMATTING =========
        public static void CopyFormats()
        {
            Worksheet localSheet = ObjModel.GetActiveSheet();

            Excel.Workbook  formatBook  = Utilities.ObjectModel.OpenWorkbook(@"C:\Users\grins\source\repos\HelloWorld\HelloWorld\format_test.xlsx", ThisAddIn.MyApp, false);
            Excel.Worksheet formatSheet = formatBook.Worksheets["Sheet1"];
            Excel.Range     formatRange = formatSheet.Range["A1:C2"];
            //range.Copy;
            foreach (dynamic win in formatBook.Windows)
            {
                win.Visible = false;
            }
            //formatBook.Windows[1].Visible = false;
            Excel.Range localRange = ObjModel.GetSheetRange(localSheet, "A1:C2");
            formatRange.Copy();
            localRange.PasteSpecial(Excel.XlPasteType.xlPasteAll);
            //formatBook.Close();
        }
Exemplo n.º 6
0
 public static void ResetSheet()
 {
     ObjModel.GetActiveSheet().Cells.Clear();
 }
        public void RightClickTest_Click(IRibbonControl e)      //how to feed in the cell reference?
        {
            string selectionReference = ObjModel.GetSelection().Address;

            MessageBox.Show(selectionReference);
        }
 public MenuBuilder()
 {
     Selection  = ObjModel.GetSelection();
     Parser     = new Primer.RefParser(Selection.Address, ThisAddIn.MyApp);
     CellRegion = GetRegion();
 }
Exemplo n.º 9
0
        public static void AddFormula(string formula)
        {
            var sheet = ObjModel.GetActiveSheet();

            sheet.Cells[1, 1].Formula = formula;
        }