用Aspose.Words从HTML中插入一个表
来源:互联网 发布:淘宝手机退货退款流程 编辑:程序博客网 时间:2024/06/01 10:44
来源于慧都控件网
Aspose.Words使用DocumentBuilder.InsertHtml方法,就可以支持插入为一个HTML源中的文档插入内容。 输入可以是一个完整的HTML页面或只是一个部分片段。使用这种方法我们可以利用表元素如< table >、< tr >、< td >为我们的文档插入表。
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Document doc =
new
Document();
DocumentBuilder builder =
new
DocumentBuilder(doc);
// Insert the table from HTML. Note that AutoFitSettings does not apply to tables
// inserted from HTML.
builder.InsertHtml(
"<table>"
+
"<tr>"
+
"<td>Row 1, Cell 1</td>"
+
"<td>Row 1, Cell 2</td>"
+
"</tr>"
+
"<tr>"
+
"<td>Row 2, Cell 2</td>"
+
"<td>Row 2, Cell 2</td>"
+
"</tr>"
+
"</table>"
);
doc.Save(MyDir +
"DocumentBuilder.InsertTableFromHtml Out.doc"
);
Visual Basic
1
2
3
4
5
6
7
8
Dim
doc
As
New
Document()
Dim
builder
As
New
DocumentBuilder(doc)
' Insert the table from HTML. Note that AutoFitSettings does not apply to tables
' inserted from HTML.
builder.InsertHtml(
"<table>"
&
"<tr>"
&
"<td>Row 1, Cell 1</td>"
&
"<td>Row 1, Cell 2</td>"
&
"</tr>"
&
"<tr>"
&
"<td>Row 2, Cell 2</td>"
&
"<td>Row 2, Cell 2</td>"
&
"</tr>"
&
"</table>"
)
doc.Save(MyDir &
"DocumentBuilder.InsertTableFromHtml Out.doc"
)
- 用Aspose.Words从HTML中插入一个表
- 用Aspose.Words 从Word文档中提取表格数据
- 用Aspose.Words 从Word文档中提取表格数据
- Aspose.words之插入水印
- 使用Aspose.BarCode 和 Aspose.Words从Word文档中识别条码
- 使用文档处理控件Aspose.Words从Word文档中识别条形码
- aspose.words生成的word文档中插入表格,用Microsoft office的word打开,表格显示正常,用wps打开,表格挤压成粗线条
- Aspose.Words使用教程之插入文档元素(三)
- Aspose.Words for .NET HTML代码直接生成WORD
- Aspose.Words使用教程之从零创建OOXML图表
- 用Aspose.Words将表单信息写入到word模板中
- Aspose.Words把DataTable 中的数据导出到word中
- 利用Aspose.Words,在word文档中创建表格
- Aspose.Words导出带图片人员信息到Word中
- Aspose.Words如何在文档中添加水印
- Aspose.Words使用模板导出数据库中图片内容
- java SSM框架中使用aspose-words导出数据
- aspose 获取Excel中插入的对象
- c 中 stdout, stderr 容易忽视的一些细节
- iphone 常用预编译代码
- 真实世界的Windows Azure:使用Windows Azure社交游戏开发商享有更低的成本和改进的扩展性
- UBUNTU下安装热键驱动及触摸板禁用驱动
- Android API中文翻译合集
- 用Aspose.Words从HTML中插入一个表
- Winform窗体按钮始终停靠在底部并居中的好方法
- 思密达的伤感QQ日志发布:我记得、我曾经没心没肺的笑过
- 关于环境变量的一些区别
- Linux用户管理
- Window7 + Vmware + Ubuntu : 上网和VmwareTools(菜鸟可以看看,因为是我这个菜鸟总结的)
- 看我姐和我妹子如何学编程
- wget 命令用法详解
- eclipse远程调试tomcat