生成答题卡

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. 使用python编写批量卸载android应用的脚本

    该脚本的功能是卸载android手机中安装的所有第三方应用,主要是使用adb shell pm.adb uninstall 命令,所以使用的前提是需要配好adb的环境变量,下面上代码: #!/usr/ ...

  2. Swift概览

    <pre name="code" class="objc">转自:http://letsswift.com/2014/06/swift_overvi ...

  3. C _数据结构 _线性表的顺序存储

    #ifndef __MY_SEQLIST_H__ #define __MY_SEQLIST_H__ typedef void SeqList; typedef void SeqListNode; // ...

  4. 微软Hololens学院教程- Holograms 100: Getting Started with Unity【微软教程已经更新,本文是老版本】

    这是老版本的教程,为了不耽误大家的时间,请直接看原文,本文仅供参考哦!原文链接:https://developer.microsoft.com/EN-US/WINDOWS/HOLOGRAPHIC/ho ...

  5. 网页js生成当前年月日 星期

    只需将下面代码插入需要显示日期的地方即可 <div style="color: brown; font-size: 10px;">今天是: <script lan ...

  6. Javascript学习总结三(Array对象的用法)

    javascript Array对象的常用API 1:concat concat() 方法用于连接两个或多个数组.该方法不会改变现有的数组,而仅仅会返回被连接数组的一个副本.举例:var a1 = [ ...

  7. java1.5新特性

    一:增强for循环 增强for的格式:for(数据类型    变量名:集合或者 数组){              } 传统的for循环可以对数组进行遍历: for(int x=0;x { Syste ...

  8. linux命令 --> pwd命令

    关于 pwd 命名前面在cd命令中已经出现过啦!!不过还是简单的说一下吧! pwd命令简单的介绍: pwd - print name of current/working directory(这... ...

  9. JavaScript高级程序设计(第三版)学习笔记6、7章

    第6章,面向对象的程序设计 对象: 1.数据属性 configurable,表示能否通过delete删除属性从而重新定义属性,能否修改属性的特性,或能否把属性修改为访问器属性,默认为true ‚en ...

  10. 介绍map.entry接口

    Map是java中的接口,Map.Entry是Map的一个内部接口.java.util.Map.Entry接口主要就是在遍历map的时候用到. Map提供了一些常用方法,如keySet().entry ...