Beispiel #1
0
 /// <summary>
 /// The basic function of ExcelPlate, used to output
 /// </summary>
 /// <returns>The flag indicates whether output is successful</returns>
 public override bool Output(int Mode)
 {
     base.Output(Mode);
     IAutomation ea;
     if (this.PlateMode == PlateModeType.Xml)
     {
         ea = new ExcelAutomationXml(Page.Server.MapPath(this.FilePath), this);
     }
     else
     {
         ea = new ExcelAutomationCom(Page.Server.MapPath(this.FilePath), this);
     }
     try
     {
         (ea as IAutomation).Run();
     }
     finally
     {
         (ea as OfficeAutomation).Plate.OnAfterOutput(new EventArgs());
     }
     return true;
 }
Beispiel #2
0
 /// <summary>
 /// The basic function of ExcelPlate, used to output
 /// </summary>
 /// <param name="Mode">The type of output</param>
 /// <returns>The flag indicates whether output is successful</returns>
 public override bool Output(int Mode)
 {
     if (base.Output(Mode))
     {
         OutputModeType type = this.OutputMode;
         if (Mode == 1)
         {
             frmOutputMode fom = new frmOutputMode("LaunchExcel");
             if (fom.ShowDialog() == DialogResult.OK)
             {
                 switch (fom.cbMode.Text)
                 {
                     case "None": type = OutputModeType.None; break;
                     case "LaunchExcel": type = OutputModeType.Launch; break;
                     case "Email": type = OutputModeType.Email; break;
                 }
             }
             else
             {
                 return false;
             }
         }
         IAutomation ea;
         if (this.PlateMode == PlateModeType.Xml)
         {
             ea = new ExcelAutomationXml(this.FilePath, this);
         }
         else
         {
             ea = new ExcelAutomationCom(this.FilePath, this);
         }
         frmProgress fp = new frmProgress("Excel Plate", ea, type);
         fp.FormClosed += delegate(object sender, FormClosedEventArgs e)
         {
             if (fp.modetype == OutputModeType.Launch)
             {
                 Process.Start("excel.exe", "\"" + this.FilePath + "\"");
             }
             else if (fp.modetype == OutputModeType.Email)
             {
                 frmEmail fe = new frmEmail(EmailAddress, this.FilePath, EmailTitle);
                 fe.ShowDialog((Srvtools.InfoForm)this.OwnerComp);
             }
         };
         fp.Show();
         if (!ShowAction)
         {
             fp.Hide();
         }
     }
     else
     {
         return false;
     }
     return true;
 }