WordStart.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:4k
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using com.etong.DAL.FC;
- using com.etong.Excel;
- public partial class Workflow_WordStart : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void BtWord_Click(object sender, EventArgs e)
- {
- string strWord = "大修工程财务进帐情况表.xls", strUserName = "周飞2";
- Response.Redirect("DaiBan.aspx?strFName=" + strWord + "&Strbl=true&strUName=" + strUserName );
- }
- protected void BtXML_Click(object sender, EventArgs e)
- {
- string spath;
- spath = Server.MapPath("doc\\XML2007811142752.xml");
- EtongFXml EWord = new EtongFXml();
- EWord.RootNodesName = "XMLrecord";
- ArrayList alNodes = new ArrayList();
- alNodes.Add("DocFileName");
- alNodes.Add("EmpName");
- alNodes.Add("OpSort");
- alNodes.Add("Date");
- EWord.NodesName = alNodes;
- EWord.Address = spath;
- ArrayList al = new ArrayList();
- al = EWord.ReadXML();
- string[] sname = new string[al.Count];
- string[] semp = new string[al.Count];
- for (int i = 0; i < al.Count; i++)
- {
- string[] sal = al[i] as string[];
- for (int k = 0; k < sal.Length; k++)
- {
- switch (k)
- {
- case 0:
- sname[i] =sal.GetValue(k).ToString();
- break;
- case 1:
- semp[i] = sal.GetValue(k).ToString();
- break;
- default:
- break;
- }
- }
- }
- }
- protected void BtXMLW_Click(object sender, EventArgs e)
- {
- ArrayList alNodesHead = new ArrayList();
- alNodesHead.Add("DocFileName");
- alNodesHead.Add("EmpName");
- alNodesHead.Add("OpSort");
- alNodesHead.Add("Date");
- ArrayList alNodes = new ArrayList();
- alNodes.Add("测试.doc");
- alNodes.Add("周飞");
- alNodes.Add("种类");
- alNodes.Add("时间");
- string spath;
- spath = Server.MapPath("doc\\XML2007811142752.xml");
- EtongFXml EXML = new EtongFXml();
- EXML.Address = spath;
- EXML.Nodes = alNodes;
- EXML.NodesName = alNodesHead;
- EXML.RootNodesName = "XMLrecord";
- EXML.WriteXML();
- }
- protected void BtExcel_Click(object sender, EventArgs e)
- {
- EtongExcel EExcel = new EtongExcel(Server.MapPath("doc\\空工作表.xls"), Server.MapPath("doc\\DocTemplateCon\\111111111111111.xls"));
- //EExcel.TempletFilePath = Server.MapPath("doc\\大修工程财务进帐情况表.xls");
- //EExcel.OutputFilePath = Server.MapPath("doc\\DocTemplate\\");
- //EExcel.SetCells(10, 12, "你好");
- string a = Server.MapPath("doc\\空工作表.xls");
- string b = Server.MapPath("doc\\DocTemplateCon\\111111111111111.xls");
- ArrayList al = new ArrayList();
- al.Add(Server.MapPath("doc\\DocTemplateCon\\芜湖供电公司工程项目计划汇总表2007816151249.xls"));
- al.Add(Server.MapPath("doc\\DocTemplateCon\\芜湖供电公司工程项目计划汇总表2007816151641.xls"));
- try
- {
- EExcel.RangeCellSet(al, 3, 10);
- EExcel.SaveAsFile();
- //EExcel.KillExcelProcess();
- this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:信息合并成功!');", true);
- }
- catch (Exception ex)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- }
- }
- }