public void RefreshWR(String LRC) { WinRes WR = new WinRes(); WinResFile WRFile = WR.Files.Open(@"U:\Actuary\Planning\2019\LRC\new LRC 2019\" + LRC + @".pjx"); //WinResFile WRFile = WR.Files.Open(@"U:\Actuary\Planning\2019\LRC\review LRC 2019\" + LRC + @".pjx"); SelectedUltimate sel = null; //write array to worksheet Excel.Application myApp = Globals.ThisAddIn.Application; Excel.Workbook myWkbk = myApp.ActiveWorkbook; Excel.Worksheet templateWksht = myWkbk.Sheets["Template"]; int WkshtIndex = templateWksht.Index; MessageBox.Show(WkshtIndex.ToString()); templateWksht.Copy(templateWksht); Excel.Worksheet mySheet = myWkbk.Worksheets[WkshtIndex]; mySheet.Name = LRC; mySheet.Range["B1"].Value2 = LRC; Excel.Range myRng = mySheet.Range["B6"]; WRFile.SelectedUltimates.TryGet("Premium", out sel); for (Int16 intUWY = 0; intUWY < 22; intUWY++) { myRng.Offset[intUWY, 0].Value = sel[intUWY]; } sel = null; WRFile.SelectedUltimates.TryGet("Claim", out sel); for (Int16 intUWY = 0; intUWY < 22; intUWY++) { myRng.Offset[intUWY, 2].Value = sel[intUWY]; } sel = null; for (Int16 intUWY = 0; intUWY < 22; intUWY++) { myRng.Offset[intUWY, 1].Value = WRFile.AnalysedTriangles["Incurred"].LeadingDiagonal[intUWY]; } WR.Files.Remove(WRFile); WR = null; }
public void ImportChainLadderProfiles() { WinRes WR = new WinRes(); WinResFile WRFile = WR.Files.Open(@"U:\Actuary\Planning\2018\Analysis\WinRes Files\LRC BM\Finalized Models\6T.pjx"); ChainLadderMethod CLMethod; IProjectionMethod projMethod = null; Double[] DevFactors; Excel.Application myApp = Globals.ThisAddIn.Application; Excel.Workbook myWkbk = myApp.ActiveWorkbook; Excel.Worksheet myWksht = myWkbk.ActiveSheet; Excel.Range myRng = myWksht.Range["A1"]; projMethod = WRFile.ProjectionMethods["Premiumcl"]; CLMethod = (ChainLadderMethod)projMethod; DevFactors = CLMethod.SubModels[CLMethod.GetSelectedSubModelIndex(0)].GetFinalSelectedDevFactors(); Int32 numColumns = CLMethod.SubModels[CLMethod.GetSelectedSubModelIndex(0)].FinalFactorProviders[0].LastDevFactorIndex + 1; myRng.Resize[1, numColumns].Value = DevFactors; //String results = string.Join(",", DevFactors); //MessageBox.Show(results); }