生成答题卡

try
{
string tempPath = @"D:\moban\ttt.doc";

//Open document and create Documentbuilder
//Aspose.Words.Document doc = new Aspose.Words.Document();
//DocumentBuilder builder = new DocumentBuilder(doc);
//Set table formating
//Set borders
// builder.CellFormat.Borders.LineStyle = LineStyle.Single;
//builder.CellFormat.Borders.Color = Color.Red;
//Set left indent
//builder.RowFormat.LeftIndent = 100;
//builder.MoveToCell(0, 2, i, 0); //移动单元格
// etc...
//Move documentBuilder cursor to the bookmark
//builder.MoveToBookmark("myBookmark");
//Insert some table

//builder.RowFormat.Height = 20;
//builder.CellFormat.Width = 10;
//builder.InsertCell();
//builder.EndTable();

string t1 = "D:\\moban\\temp1.doc";
string t2 = "D:\\moban\\temp2.doc";
Document dstDoc = new Document(t1);

DocumentBuilder builder = new DocumentBuilder(dstDoc);
for (int i = 0; i < 5; i++)
{
Document edite = new Document(t2);
String[] key = new String[] { "titles" };
Object[] value = new Object[] { i + "(5分)" };
//合并模版,相当于页面的渲染
edite.MailMerge.Execute(key, value);

edite.FirstSection.PageSetup.SectionStart = SectionStart.Continuous;
dstDoc.AppendDocument(edite, ImportFormatMode.KeepSourceFormatting);
}

//使用域的方式填充数据
String[] fieldNames = new String[] { "dtkname", "d01", "d02", "d03", "d04", "d05", "d06", "d07", "d08", "d09", "d10", "d11", "d12", "d13", "d14", "d15", "d01a", "d02a", "d03a", "d04a", "d05a", "d06a", "d07a", "d08a", "d09a", "d10a", "d11a", "d12a", "d13a", "d14a", "d15a", "titles" };
Object[] fieldValues = new Object[] { "物理月考试卷", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "", "3(5分)" };
//合并模版,相当于页面的渲染
dstDoc.MailMerge.Execute(fieldNames, fieldValues);
dstDoc.Save(tempPath);

}
catch (Exception)
{

throw;
}

Aspose.Words 总结的更多相关文章

  1. C#使用Aspose.Cells导出Excel简单实现

    首先,需要添加引用Aspose.Cells.dll,官网下载地址:http://downloads.aspose.com/cells/net 将DataTable导出Xlsx格式的文件下载(网页输出) ...

  2. 免费公开课,讲解强大的文档集成组件Aspose,现在可报名

    课程①:Aspose.Total公开课内容:讲解全能型文档管理工具Aspose.Total主要功能及应用领域时间:2016-11-24 14:30 (暂定)报名地址:http://training.e ...

  3. Aspose.Words简单生成word文档

    Aspose.Words简单生成word文档 Aspose.Words.Document doc = new Aspose.Words.Document(); Aspose.Words.Documen ...

  4. Aspose.Cells导出Excel(2)

    DataTable dtTitle = ds.Tables[]; DataTable dtDetail = ds.Tables[]; int columns = dtTitle.Columns.Cou ...

  5. Aspose.Cells导出Excel(1)

    利用Aspose.Cells导出excel 注意的问题 1.DataTable的处理 2.进行编码,便于中文名文件下载 3.别忘了Aspose.Cells.dll(可以自己在网上搜索) public ...

  6. C# Aspose word 替换指定键值数据

    今天研究一天的导出word,一开始准备选用为软件自带的office,但是有局限性,机子上必须安装office才能使用,最后在网上搜了一下资料aspose开源的 小公司没得钱,你懂得.最后选择了这款 开 ...

  7. 使用Aspose.Cells读取Excel

      最新更新请访问: http://denghejun.github.io Aspose.Cells读取Excel非常方便,以下是一个简单的实现读取和导出Excel的操作类: 以下是Aspose.Ce ...

  8. C# WinForm 导出导入Excel/Doc 完整实例教程[使用Aspose.Cells.dll]

    [csharp] view plain copy 1.添加引用: Aspose.Cells.dll(我们就叫工具包吧,可以从网上下载.关于它的操作我在“Aspose.Cells操作说明 中文版 下载 ...

  9. NPOI、MyXls、Aspose.Cells 导入导出Excel(转)

    Excel导入及导出问题产生: 从接触.net到现在一直在维护一个DataTable导s出到Excel的类,时不时还会维护一个导入类.以下是时不时就会出现的问题: 导出问题: 如果是asp.net,你 ...

  10. Aspose.Words 16.8 破解版、添加自定义HTML导出Jpeg压缩质量配置

    0x01 Aspose.Words 介绍Aspose.Words是一个商业.NET类库,可以使得应用程序处理大量的文件任务.Aspose.Words支持Doc,Docx,RTF,HTML,OpenDo ...

随机推荐

  1. 什么是IDOC,以及IDOC的步骤

    创建IDOC:   第一步:WE31 创建IDOC所包含的字段.   第二步:WE30 创建IDOC 把Segment分配给IDOC   第三步:WE81  创建信息类型   第四步:WE82   把 ...

  2. delphi 窗体透明

        TransparentColor:=true;    TransparentColorValue:=clFuchsia;    Color:= TransparentColorValue;  ...

  3. MySQL HA

    读写分离 在应用端处理 Spring AbstractRoutingDataSource 淘宝MyFox MySQL Replication Connection 在数据库端处理 MySQL Prox ...

  4. iOS开发——高级技术&摇一摇功能的实现

    摇一摇功能的实现 在AppStore中多样化功能越来越多的被使用了,所以今天就开始介绍一些iOS开发的比较实用,但是我们接触的比较少的功能,我们先从摇一摇功能开始 在 UIResponder中存在这么 ...

  5. AIR 程序开发系列 之五 保存数据的几种方式

    Local SharedObject 这种方法比较简单方便的保存少的数据到到设备中.你不用自己去管理这些数据,设备会自动管理他. SharedObject 在 flash.net 包中,继承自Even ...

  6. ADO.Net的小知识(连接数据库)二

    上次提到数据库连接有两种形式断开式连接和打开式连接,断开式连接我已经讲解了,下面我来给大家讲解一下打开式连接 (1)引入命名空间:using System.Data.SqlClient; 该语句用于导 ...

  7. tar备份系统

    一.概述 前几天我通过SSH正在调戏汤姆猫(tomcat)的时候,服务器上CentOS突然挂了.开机grub,使用光盘linux rescue修复提示找不到linux分区,然后想mount硬盘备份系统 ...

  8. Java HashMap 如何正确遍历并删除元素

    (一)HashMap的遍历 HashMap的遍历主要有两种方式: 第一种采用的是foreach模式,适用于不需要修改HashMap内元素的遍历,只需要获取元素的键/值的情况. HashMap<K ...

  9. How to solve GM MDI cannot complete the installation

    Dear Joy, I have a problem using GM MDI diagnostic tool. When I installed it on my laptop, the tool ...

  10. MySql安装步骤详解,MySql的root密码设置,启动MySql服务。

    1.下载mysql安装包,并解压,双击mysql-5.6.24-winx64.msi 2.点击下一步 3.选择custom 4.选择安装内容和位置,5个安装内容要选择will be installed ...