首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用docx项目将表插入DocX文件

使用docx项目将表插入DocX文件
EN

Stack Overflow用户
提问于 2013-11-26 17:23:13
回答 1查看 316关注 0票数 1

我使用DocX项目创建一个word文档。

我需要把表格插入我的医生,但我不知道该怎么办?

代码语言:javascript
复制
string fileName = @"D:\Users\John\Documents\DocXExample.docx";

// Create a document in memory:
var doc = DocX.Create(fileName);

// Insert a paragrpah:
//doc.InsertParagraph("This is my first paragraph");

// Save to the output directory:
doc.Save();

// Open in Word:
Process.Start("WINWORD.EXE", fileName);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-24 11:05:15

示例代码:

代码语言:javascript
复制
Table t = document.AddTable(20,2);
t.Rows[0].Cells[0].Paragraphs.First().Append("value1");
t.Rows[1].Cells[0].Paragraphs.First().Append("value2");
t.Rows[2].Cells[0].Paragraphs.First().Append("value3");
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20223844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档