设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 编程开发 >> 网络编程 >> C#应用 >> c#操作word表格
精品推荐
C#应用点击TOP10
·c#操作word表格
·用C#实现木马程序
·C#操作xml文件入门
·C#编写的windows计算器-源代码
·C#反射实例讲解
·在C#中应用哈希表(Hashtable)
·C#中连接DataTable的方法
·c#中的委托和事件的简单实例
·C#实现Word中表格信息读取
·C# 2.0 套接字编程实例初探
网络编程点击TOP10
·ASP.NET 程序中常用的三十三种代码
·CHK文件恢复工具
·.NET 初 级 读 本
·c#操作word表格
·『原创』C#中TreeView类操作全攻略:建立树,新增节点,删除节点,修改节点,拖动节点,与Oracle数据库交互操作(一)
·我的.NET书架 (入门篇)
·十天学会ASP.net之第一天
·从零开始学ASP.NET(基础篇)
·用C#实现木马程序
·官方水晶报表 .NET 应用程序实例下载 (C#、Visual C++.NET)
精选专题

c#操作word表格

作者: 来源:http://www.xgdown.com/ 时间:2005-11-19 1:23:00

c#操作word表格(1)

最近由于工作需要,做了一些关于C#操作Word文档方面的工作.主要是对word中表格的操作,以下是部分代码,关于操作不规则表格的.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using System.IO;

using System.Reflection;
using System.Runtime.InteropServices ;
using System.Threading;

public void MakeMyTable(DataTable DT,string strFilePath)
  {
  
   string strEnd   = this.txtEnd.Text.Trim().ToString();
   string strStart = this.txtStart.Text.Trim().ToString();
//生成文档分页中的起始和终止页
   string strSign = "("+strStart + "-" + strEnd + ")";

   //杀掉所有word进程以保证速度
   //KillWordProcess();

   object Nothing = System.Reflection.Missing.Value;
   object missing = System.Reflection.Missing.Value;
   object filename= strFilePath; 

   Word.Application wordApp=new Word.ApplicationClass();
   Word.Document wordDoc=wordApp.Documents.Add(ref Nothing,ref Nothing,ref Nothing,ref Nothing);

   try
   {
    //生成过程中屏蔽返回按扭,不允许中途停止
    Button2.Enabled = false;
    #region 生成文档
    //设置文档宽度
    wordApp.Selection.PageSetup.LeftMargin  = wordApp.CentimetersToPoints(float.Parse("2"));
    wordApp.ActiveWindow.ActivePane.HorizontalPercentScrolled = 11 ;
    wordApp.Selection.PageSetup.RightMargin = wordApp.CentimetersToPoints(float.Parse("2"));

    Object start = Type.Missing;

共14页 9 7 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [148 :>

c#操作word表格 相关文章:
c#操作word表格 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com