/// <summary> /// The basic function of WordPlate, 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 WordAutomationXml(Page.Server.MapPath(this.FilePath), this); } else { ea = new WordAutomationCom(Page.Server.MapPath(this.FilePath), this); } try { (ea as IAutomation).Run(); } finally { (ea as OfficeAutomation).Plate.OnAfterOutput(new EventArgs()); } return true; }
/// <summary> /// The basic function of WordPlate, 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("LaunchWord"); if (fom.ShowDialog() == DialogResult.OK) { switch (fom.cbMode.Text) { case "None": type = OutputModeType.None; break; case "LaunchWord": type = OutputModeType.Launch; break; case "Email": type = OutputModeType.Email; break; } } else { return false; } } IAutomation wa; if (this.PlateMode == PlateModeType.Xml) { wa = new WordAutomationXml(this.FilePath, this); } else { wa = new WordAutomationCom(this.FilePath, this); } frmProgress fp = new frmProgress("Word Plate", wa, type); fp.FormClosed += delegate(object sender, FormClosedEventArgs e) { if (fp.modetype == OutputModeType.Launch) { Process.Start("winword.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; }