コード例 #1
0
 public void Generate()
 {
     indensionStack.Clear();
     indensionStack.Push(-1);
     if (app == null) app = new Application();
     thisPresentation = app.Presentations.Add(MsoTriState.msoFalse);
     var cl = new DocumentClosure(null, thisPresentation, app);
     CurrentClosure = cl;
     ChangeTheme();
     cl.Initialize();
     cl.WorkPath = DefaultWorkPath;
     var module = thisPresentation.VBProject.VBComponents.Add(vbext_ComponentType.vbext_ct_StdModule);
     module.CodeModule.AddFromString(Resources.VBAModule);
     while (true)
     {
         var thisLine = ScriptReader.ReadLine();
         if (thisLine == null) break;
         Console.WriteLine(thisLine);
         if (!string.IsNullOrWhiteSpace(thisLine) && thisLine.TrimStart()[0] != '#')
             ParseLine(thisLine);
     }
     while (CurrentClosure != null) ExitClosure();
     app.Run("PAG_PostProcess", thisPresentation);
     var wnd = thisPresentation.NewWindow();
     thisPresentation.VBProject.VBComponents.Remove(module);
     wnd.Activate();
     //thisPresentation.Close();
 }