2006-12-19

用C#把文件转换为XML

来源: 博客园 作者:佚名 评论 0 条
 
   this.button3 = new System.Windows.Forms.Button();
   this.button4 = new System.Windows.Forms.Button();
   this.SuspendLayout();
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(96, 32);
   this.button1.Name = "button1";
   this.button1.TabIndex = 0;
   this.button1.Text = "生成xml";
   this.button1.Click = new System.EventHandler(this.button1_Click);
   //
   // button2
   //
   this.button2.Location = new System.Drawing.Point(96, 80);
   this.button2.Name = "button2";
   this.button2.TabIndex = 1;
   this.button2.Text = "生成doc";
   this.button2.Click = new System.EventHandler(this.button2_Click);
   //
   // button3
   //
   this.button3.Location = new System.Drawing.Point(8, 32);
   this.button3.Name = "button3";
   this.button3.TabIndex = 2;
   this.button3.Text = "加载doc";
   this.button3.Click = new System.EventHandler(this.button3_Click);
   //
   // button4
   //
   this.button4.Location = new System.Drawing.Point(8, 80);
   this.button4.Name = "button4";
   this.button4.TabIndex = 3;
   this.button4.Text = "加载xml";
   this.button4.Click = new System.EventHandler(this.button4_Click);
   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(184, 141);
   this.Controls.Add(this.button4);
   this.Controls.Add(this.button3);
   this.Controls.Add(this.button2);
   this.Controls.Add(this.button1);
   this.Name = "Form1";
   this.Text = "Form1";
   this.ResumeLayout(false);
   //
   //手工注册一下Load和Closed事件
   //
   this.Load = new System.EventHandler(this.Form1_Load);
   this.Closed = new System.EventHandler(this.Form1_Closed);

  }
  #endregion

  /**//// <summary>
  /// 从这个入口启动窗体
  /// </summary>
  static void Main()
  {
   Application.Run(new Form1());
  }
  /**//// <summary>
  /// 把加载的Office文件转换为xml文件
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void button1_Click(object sender, System.EventArgs e)
  {
   saveFileDialog1.Filter = "xml 文件|*.xml";//设置打开对话框的文件过滤条件
   saveFileDialog1.Title = "保存成 xml 文件";//设置打开对话框的标题
   saveFileDialog1.FileName="";
   saveFileDialog1.ShowDialog();//打开对话框

   if(saveFileDialog1.FileName != "")//检测用户是否输入了保存文件名
共4页: 上一页 [1] 2 [3] [4] 下一页

(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:JSP使用技巧预编译消除性能瓶颈  
下一篇:一些实用的图形用户界面方法
    评论加载中…
 推荐文章
     

网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号