百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

SharpDocx

> 编程语言
开源

用于创建 Word 文档的轻量级模板引擎

378 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于创建 Word 文档的轻量级模板引擎

SharpDocx

Lightweight template engine for creating Word documents

Generating documents with SharpDocx is a two step process. First you create a view in Word. A view is a Word document which also contains C# code. Code can be inserted anywhere, e.g. would insert the current date and time.

The next step is to create documents based on this view. This requires two lines of code:

csharp
var document = DocumentFactory.Create("view.cs.docx");
document.Generate("output.docx");

Out of the box SharpDocx supports inserting text, tables, images and more. See the Tutorial sample (here's the view and the controller, and here's the generated document).

If you want, you can specify a view model to be used in your view. Then you could write things like .

csharp
var document = DocumentFactory.Create("view.cs.docx", myModel);
document.Generate("output.docx", myModel);

See also the Model sample.

If you want to do something that's not supported by SharpDocx, you can do so by creating your own document subclass. See the Inheritance example.

SharpDocx supports .NET Framework 3.5-4.8 and .NET Standard 2.0. Since it supports .NET Standard 2.0 it can be used in .NET Core 3.1, .NET 5.0 and .NET 6.0 projects as well.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#docxmicrosoft-wordmvcopen-xml-sdk

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言