protected void Button2_Click(object sender, System.EventArgs e) { DateTime dated; dated = DateTime.Now; try { test = new CCWordApp(); test.Open(ConfigurationSettings.AppSettings["WordMod"] + "table.dot"); test.GoToTheTable(1); test.GoToDownCell(); test.InsertText(Riga1Text1.Text); test.GoToRightCell(); test.InsertText(Riga1Text2.Text); test.SaveAs(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".doc"); // Save in html format test.SaveAsHtml(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".html"); test.Quit(); } catch (Exception exc) { StatusMessage.Text = exc.Message; StatusMessage.Visible = true; test.Quit(); } }
private void Button2_Click(object sender, System.EventArgs e) { try { test = new CCWordApp(); //test.Open (ConfigurationSettings.AppSettings["WordMod"] + "normal.dot"); test.Open(); test.SetFontName("Arial"); test.SetFontSize(14); test.SetAlignment("Center"); test.SetFont("Bold"); test.InsertText(DocName.Text + ".doc"); test.SetFont("nothing"); test.SetAlignment("Left"); test.InsertLineBreak(5); test.SetFontSize(8); test.InsertText(Text.Text); test.SaveAs(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".doc"); // Save in html format test.SaveAsHtml(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".html"); test.Quit(); } catch (Exception exc) { StatusMessage.Text = exc.Message; StatusMessage.Visible = true; test.Quit(); } }
private void Button2_Click(object sender, System.EventArgs e) { DateTime dated; dated = DateTime.Now; try { test = new CCWordApp(); test.Open(ConfigurationSettings.AppSettings["WordMod"] + "template1.dot"); test.SetAlignment("Center"); test.GotoBookMark("Title"); test.SetFont("Bold"); test.InsertText(TextTitle.Text); test.SetFont("nothing"); test.GotoBookMark("name"); test.SetFont("Italic"); test.InsertText(TextName.Text); test.SetFont("nothing"); test.GotoBookMark("address"); test.SetAlignment("Right"); test.InsertText(dated.ToShortDateString()); test.InsertLineBreak(); test.InsertText(TextAddress.Text); test.SetFont("nothing"); test.SaveAs(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".doc"); // Save in html format test.SaveAsHtml(ConfigurationSettings.AppSettings["WordDoc"] + DocName.Text + ".html"); test.Quit(); } catch (Exception exc) { StatusMessage.Text = exc.Message; StatusMessage.Visible = true; test.Quit(); } }
protected void btnSaveAuthorizeLetter_Click(object sender, EventArgs e) { try { string strPath = string.Empty; strPath = Server.MapPath("~/MailTemplate" + "/AuthorizeLetter.docx"); string strPath2 = string.Empty; string SaveLoc = Server.MapPath("~/NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/"); strPath2 = Server.MapPath("~/NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/AuthorizeLetter.doc"); test = new CCWordApp(); test.Open(); string str = test.GetContent(); string NewLine = string.Empty; NewLine = txtgenMailText.Text; test.InsertText(NewLine); if (System.IO.Directory.Exists(SaveLoc) == false) { // Try to create the directory. System.IO.DirectoryInfo di = System.IO.Directory.CreateDirectory(SaveLoc); } if (System.IO.File.Exists(strPath2)) { System.IO.File.Delete(strPath2); } test.SaveAs(strPath2); int FiletypeID = 1; string FilePath = "NoticeCopies/" + Session["CBViewNoticeID"].ToString() + "/AuthorizeLetter.doc"; int DocumentTypeID = 1; int IsEditable = 1; DataSet dsData = objdropdownBL.SaveCBDocumnetsForProcess(Convert.ToInt32(Session["CBViewNoticeID"]), FiletypeID, FilePath, Convert.ToInt32(Session[Constants.USER_ID].ToString()), DocumentTypeID, IsEditable); test.Quit(); } catch (Exception ex) { throw ex; } }