• 大小: 3.47MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-09
  • 语言: ASP
  • 标签: aspose  

资源简介

本资源采用aspose.words 组件实现插入文件,页面设置,替换 表格操作,分页等方法。本资源采用aspose.words 组件实现插入文件,页面设置,替换 表格操作,分页等方法。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
using Aspose.Words;
using Aspose.Words.Tables;
using System.Collections;

namespace TKS.framework.Common
{
    public class AsposeWordApp
    {
        /// 
        /// word版本
        /// 

        private int _docversion;

        public int Docversion
        {
            get { return _docversion; }
            set { _docversion = value; }
        }
        private DocumentBuilder oWordApplic; //   a   reference   to   Word   application 
        private Aspose.Words.Document oDoc; //   a   reference   to   the   document 
        public void OpenWithTemplate(string strFileName)
        {
            if (!string.IsNullOrEmpty(strFileName))
            {
                oDoc = new Aspose.Words.Document(strFileName);
            }
        }

        public void Open()
        {
            oDoc = new Aspose.Words.Document();
        }

        public void Builder()
        {
            oWordApplic = new DocumentBuilder(oDoc);
            
            
        }
        /// 
        /// 保存文件
        /// 

        /// 
        public void SaveAs(string strFileName)
        {

            if (this.Docversion == 2007)
            {
                oDoc.Save(strFileNameSaveFormat.Docx); 
            }else
            {
                oDoc.Save(strFileNameSaveFormat.Doc); 
            }
           
        }

        /// 
        /// 添加内容
        /// 

        /// 
        public void InsertText(string strText double conSize bool conBold string conAlign)
        {
            oWordApplic.Bold = conBold;
            oWordApplic.Font.Size = conSize;
            switch (conAlign)
            {
                case “left“:
                    oWordApplic.ParagraphFormat.Alignment = ParagraphAlignment.Left;
                    break;
                case “center“:
                    oWordApplic.ParagraphFormat.Alignment = ParagraphAlignment.Center;
                    break;
                case “right“:
                    oWordApplic.ParagraphFormat.Alignment = ParagraphAlignment.Right;
                    break;
                default:
                    oWordApplic.ParagraphFormat.Alignment = ParagraphAlignment.Left;
                    break;
            }
            oWordApplic.Writeln(strText);
             
        }

        /// 
        /// 添加内容
        /// 

        /// 
        public void WriteText(string strText double conSize bool conBold string conAlign)
        {
            oWordApplic.Bold = conBold;
            oWordApplic.Font.Size = conSize;
            switch (conAlign)
            {
                case “left“:
                    oWordApplic.Paragrap

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-05-29 16:19  aspose.words\
     文件       19983  2013-05-29 15:37  aspose.words\AsposeWordApp.cs
     文件       51096  2013-05-24 10:13  aspose.words\CCWordApp.cs
     文件       17565  2013-05-29 14:18  aspose.words\DownWordLibary.cs
     目录           0  2013-05-29 16:18  aspose.words\lib\
     文件     7233536  2012-05-29 18:56  aspose.words\lib\Aspose.Words.dll

评论

共有 条评论