NewLife.Office.Rendering
Rendering extension for NewLife.Office, providing document page to image rendering, image processing, watermark overlay and QR code generation, powered by SkiaSharp for cross-platform 2D graphics. NewLife.Office 的渲染扩展包,提供文档页面→图片渲染、图片处理、水印叠加、二维码生成等功能。依赖 SkiaSharp 实现跨平台 2D 图形渲染。
Install
| Product | Versions |
|---|---|
| .NET Standard | |
| Other |
README
NewLife.Office - Office Automation Library
🌐 简体中文 | 繁體中文 | Español | Deutsch | 日本語 | Français | Português | Русский | 한국어 | العربية
A comprehensive .NET office automation library covering Excel, Word, PPT, PDF and 15+ document formats in one package
Source: https://github.com/NewLifeX/NewLife.Office
NuGet: NewLife.Office (Rendering package: NewLife.Office.Rendering)
Overview
NewLife.Office is a comprehensive .NET office automation library covering Excel (xlsx/xls), Word (docx/doc), PowerPoint (pptx/ppt), PDF, Markdown, RTF, ODS, Email (eml/msg), iCalendar, vCard, EPUB, XPS, and legacy binary formats based on OLE2/BIFF8, backed by the Rendering extension package (documents → images).
- Zero external dependencies: only depends on
NewLife.Core, built directly on Open XML (ZIP + XML) / PDF / OLE2 file structures - Full framework support:
net45/netstandard2.0/netstandard2.1/net8.0/net10.0, with AOT compatibility analysis (IsAotCompatible, zero IL warnings) on net8.0+ - MIT licensed: free with no commercial license risk
- Unified API:
NewLife.Officenamespace with a consistent API style, low learning cost
CSV read/write is provided by
CsvFileinNewLife.Core; this library does not duplicate CSV.
Highlights
- Full format coverage: four core formats + ten lightweight formats + OLE2/BIFF8 legacy formats, all in one library
- Zero external dependencies: operates directly on file structures, package size <500KB
- High-fidelity roundtrip: L2/L3 fidelity architecture (model + RawXml/part passthrough), read → modify → write without losing formatting
- Markdown conversion hub: bidirectional MD↔docx/PDF/HTML/Excel/PPT/Word conversion, a unified entry for AI knowledge base ingestion
- Rendering extension:
NewLife.Office.Rendering(separate NuGet) provides document → image rendering, image processing, and QR codes - AOT/cross-platform: zero IL warnings on
net8.0/net10.0; CI covers win-x64 / win-x86 / win-arm64 / linux-x64 / linux-arm64 / osx-x64 / osx-arm64 / linux-loongarch64 (LoongArch via QEMU), with 23 AOT smoke scenarios including all 31 language tables - 31-language localization: exception messages, document output labels and assembly metadata are translated for the current culture and fall back to English;
Locales/*.ymlare compiled into the assembly and work under NativeAOT
Supported Formats
| Format | Read | Write | Template | Conversion | Render | Notes |
|---|---|---|---|---|---|---|
| Excel xlsx | ✅ | ✅ | ✅ | — | — | Styles, charts, pivot tables, conditional formatting, images, named ranges, structured tables, comments, sparklines, slicers, threaded comments, hidden rows/columns, streaming read and 1904 date support |
| Excel xls | ✅ | ✅ | — | — | — | OLE2/BIFF8, BiffReader+BiffWriter read/write, styles/merges/hyperlinks/filters/page setup |
| Word docx | ✅ | ✅ | ✅ | HTML/PDF | — | Paragraphs, tables, images, headers/footers, comments, content controls, AES encryption, mail merge, find/replace (including text boxes), footnote model, multiple sections; cross-validated with NPOI+OpenXmlValidator |
| Word doc | ✅ | — | — | ✅ doc→docx | — | MS-DOC, DocReader plain text + paragraph formatting extraction (bold/font size/alignment, etc.) + doc→docx conversion |
| PPT pptx | ✅ | ✅ | ✅ | — | Text boxes, images, tables, charts, masters, animations, comments, sections; cross-file merge (with chart/comment/notes fidelity) | |
| PPT ppt | ✅ | ✅ | — | — | — | MS-PPT: PptReader text extraction + PptWriter text slide writing |
| ✅ | ✅ | — | — | — | Fluent API, merge/split, encryption, signatures, forms, annotations, PDF-A | |
| Markdown | ✅ | ✅ | — | HTML/Word/PDF/all→MD | — | CommonMark + GFM + typed AST, full-format conversion hub |
| RTF | ✅ | ✅ | ✅ | — | — | Paragraphs, tables, template fill, image embedding (PNG/JPEG) |
| ODS | ✅ | ✅ | — | — | — | LibreOffice native format, merged cells, styles, formulas |
| EML | ✅ | ✅ | — | — | — | RFC 5322 + MIME, attachments, inline images |
| MSG | ✅ | — | — | — | — | Outlook, OLE2 + MAPI, subject/body/attachments |
| iCalendar | ✅ | ✅ | — | — | — | RFC 5545 .ics, VEVENT/VTODO/RRULE |
| vCard | ✅ | ✅ | — | — | — | RFC 6350 .vcf, vCard 3.0/4.0 |
| EPUB | ✅ | ✅ | — | — | — | EPUB 2/3, OPF/Nav/chapters/cover |
| XPS | ✅ | ✅ | — | — | — | ZIP+XML, Glyphs text extraction, multi-page write, images, metadata |
| Rendering | — | — | — | — | ✅ | Separate package (SkiaSharp): PDF/Word/PPT/Markdown → images |
Quick Start
Unified Text / Markdown Extraction
using NewLife.Office;
// One-liner: extract plain text from any supported format
String? text = OfficeFactory.ReadText("document.docx");
String? text2 = OfficeFactory.ReadText("report.xlsx");
// Extract as Markdown (preserves structure)
String? md = OfficeFactory.ReadMarkdown("slides.pptx");
// doc (97-2003) → docx conversion
OfficeFactory.ConvertDocToDocx("legacy.doc", "legacy.docx");
Command-Line Tool (NewLife.Office.Cli)
# Any office document → Markdown
dotnet run --project NewLife.Office.Cli -- convert input.docx output.md
# doc (97-2003) → docx (legacy document migration)
dotnet run --project NewLife.Office.Cli -- doc2docx legacy.doc legacy.docx
Excel Write and Read
using NewLife.Office;
using var ms = new MemoryStream();
var writer = new ExcelWriter(ms);
writer.WriteHeader("Data", new[] { "编号", "姓名", "金额" }, CellStyle.Header);
writer.WriteRow("Data", new Object?[] { 1, "张三", 1234.56m }, new CellStyle
{
Border = CellBorderStyle.Thin,
NumberFormat = "#,##0.00",
});
writer.Save();
ms.Position = 0;
var reader = new ExcelReader(ms, Encoding.UTF8);
var rows = reader.ReadRows("Data").ToList();
More capabilities (object mapping import/export, template fill, format conversion, rendering, etc.) see Requirements and the source examples.
Documentation
Ecosystem Map
NewLife is a layered ecosystem of independently versioned open-source projects. The map below is shared verbatim by every NewLife repository; each project links to its repository and its primary NuGet package.
| Project | What it does | Downloads |
|---|---|---|
| Foundation | ||
| NewLife.Core | Logging, configuration, caching, networking, serialization, scheduling and APM tracing. | |
| NewLife.XCode | Data middleware: single tables at the tens-of-billions scale, automatic sharding, read-write splitting, 10+ databases. | |
| NewLife.Net | High-performance network library: 1.77M pps / 14.5 Gbps on a single machine (TCP 1KB, 2026-10), 4M long-lived TCP connections. | |
| NewLife.Remoting | Protocol communication and RPC framework for client/server applications and IoT devices. | |
| NewLife.Agent | Installs .NET applications as OS daemons: Windows services and Linux systemd. | |
| NewLife.Templates | dotnet new project templates for console, web, API, service, data and IoT projects. |
|
| Data & Messaging | ||
| NewLife.Redis | Redis client with microsecond latency, millions of ops/s and built-in message queues. | |
| NewLife.RocketMQ | Pure managed RocketMQ client for Apache RocketMQ and Alibaba Cloud Message Queue. | |
| NewLife.MQTT | MQTT client and server, including Alibaba Cloud IoT connectivity. | |
| NewLife.NovaDb | Hybrid database in C#: embedded or networked, relational, time-series, message queue and KV in one. | |
| NewLife.MySql | MySql driver and helper layer built on the NewLife data stack. | |
| Web, AI & Distributed | ||
| NewLife.Cube | Rapid admin-platform framework: permissions, SSO, OAuth server and CRUD scaffolding. | |
| Stardust | Distributed service platform: node management, APM, configuration center, registry and release center. | |
| AntJob | Distributed task and real-time data scheduling platform with sharding, retries and backfill. | |
| NewLife.AI | Unified client for 46 LLM providers plus ChatAI, a ready-to-run web chat application. | |
| Industrial & IoT | ||
| NewLife.IoT | IoT standard library defining protocol contracts and device abstractions. | |
| NewLife.Modbus | Modbus TCP/RTU/ASCII implementation on top of NewLife.IoT. | |
| NewLife.Siemens | Siemens PLC protocol on top of NewLife.IoT. | |
| NewLife.Omron | Omron PLC protocol on top of NewLife.IoT. | |
| NewLife.Melsec | Mitsubishi Melsec PLC protocol on top of NewLife.IoT. | |
| NewLife.OPC | OPC client for industrial data access. | — |
| NewLife.BACnet | BACnet building-automation protocol stack. | |
| ZeroIoT | Lightweight open-source IoT platform with gateway and device management. | — |
| Vehicle Telematics | ||
| NewLife.JT808 | JT/T 808 vehicle positioning protocol: 70+ message bodies, 2011/2013/2019. | |
| NewLife.JT809 | JT/T 809 platform-to-platform protocol for transport authorities. | |
| NewLife.JT1078 | JT/T 1078 in-vehicle video: RTP parsing, FLV/fMP4 remuxing and live streaming. | |
| Domain Components | ||
| NewLife.Office | One package for Excel, Word, PPT, PDF and 15+ document formats. | |
| NewLife.Audio | Cross-platform audio: codecs, device I/O, DSP, containers and streaming. | |
| NewLife.Video | Video codecs, container formats, frame processing and streaming. | |
| NewLife.Map | Unified interface over Baidu, AMap, Tencent and Tianditu with geocoding and coordinate conversion. | |
| NewLife.IP | IPv4 geolocation with an offline memory-mapped database and an online API fallback. | |
| Tools & Products | ||
| CrazyCoder | Developer toolbox: network, serial port, crypto, regex, Modbus and MQTT. | |
| GitCandy | Self-hosted Git source code management system. | — |
| LuckyClover | Installs the matching .NET runtime automatically when launched from an older host. | — |
Badges show the primary package of each project; theme, extension and satellite packages are listed on their NuGet pages.The 30+ packages not listed here (FTP, LoRa, Office extensions, protocol drivers and more) are available under the NewLifeX organization and on newlifex.com.
Team
Founded in 2002, the NewLife team has spent more than two decades on the .NET and IoT ecosystem, maintains nearly 100 open-source projects (34 of them core to this map), and delivers integrated software and hardware solutions for power, logistics, healthcare, industrial control and internet industries. We live by the motto "learning has no seniority — mastery earns respect".
Open-source components have been downloaded 6.48M times from NuGet (ecosystem-wide, as of 2026-10).
Website: https://newlifex.com · Open source organization: https://github.com/NewLifeX
WeChat Official Account: 智能大石头 (scan to follow)

Changes from Previous Version
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.