nissl-lab/npoi
关于
一个 .NET 库,无需安装 Microsoft Office 即可读写 Office 格式文件。不依赖 COM+ 或互操作功能。
开发工具实测星标增长
- 24小时
- -2
- 7天
- -2
- 15天
- -1
- 1个月
- +2
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文[!IMPORTANT] To ensure the long-term sustainability of this project, a monthly maintenance fee has been introduced. This fee is required to be paid by all organizations or users of any library from this project who generate revenue. You can pay the fee via GitHub Sponsors.
To enact this, an EULA on binary releases is added to the repo and nuget packages since 2.8.0 that requires payment of the maintenance fee.
For more information on who must pay the fee and other frequently asked questions, please see the Open Source Maintenance Fee organisation page.
What's NPOI
This project is the .NET version of Apache POI project. With NPOI, you can read/write Office 2003/2007 files very easily.
Documentation
Automatic column widths without loading SkiaSharp
If IIS Web Deploy cannot replace libSkiaSharp.dll after AutoSizeColumn runs,
enable estimated column widths at application startup, before creating any workbooks:
AppContext.SetSwitch("NPOI.UseEstimatedColumnWidths", true);
The switch applies to automatic column sizing for XLS, XLSX, and streaming XLSX. The estimate uses font size and text length, so check fit for wide glyphs and proportional fonts. Other drawing and measurement APIs can still load SkiaSharp. Restart the application to release any copy of the DLL already loaded.
Sponsors
Thank you for all the sponsors. Here is the sponsors list
Advantage of NPOI
a. It's totally free to startups, freelancers, and hobbyists (whose annual revenue is less than $10,000 USD)
b. Cover most features of Excel (cell style, data format, formula and so on)
c. Supported formats: xls, xlsx, docx.
d. Designed to be interface-oriented (take a look at NPOI.SS namespace)
e. Support not only export but also import
f. Real successful cases all over the world
g. Works on both Windows and Linux
PPTX foundation (XSLF)
The initial NPOI.XSLF.UserModel API supports creating an empty transitional
.pptx presentation, adding blank slides, and saving and reopening the package:
using NPOI.XSLF.UserModel;
using System.IO;
using var presentation = new XMLSlideShow();
presentation.CreateSlide();
presentation.CreateSlide();
using var output = File.Create("blank-slides.pptx");
presentation.Write(output);
Use new XMLSlideShow(inputStream) or new XMLSlideShow(opcPackage) to open an
existing presentation, and GetSlides() to access slides in presentation order.
Closing the presentation closes its underlying OPC package. As with the other
OOXML APIs, save to a different file when opening a package from a file path.
The foundation follows the existing OOXML layering: partial PresentationML data
models live in OpenXmlFormats/Presentation, while XMLSlideShow, XSLFSlide,
XSLFRelation, and XSLFFactory live in ooxml/XSLF/UserModel. Packaging uses the
existing OPC implementation. Slides, masters, and layouts share XSLFSheet.
GetSlideMasters() and GetSlideLayouts() follow their XML reference-list order.
XSLFTheme exposes read-only theme metadata using the existing DrawingML model.
Unchanged master, layout, and theme parts retain their original bytes; unmodeled
content remains intact when supported sheet models are saved.
Opaque extension children retain their order relative to modeled sheet content,
including extensions preceding common slide data in masters and layouts.
Use a layout from the same presentation to create a slide explicitly:
var master = presentation.GetSlideMasters()[0];
var layout = master.GetLayout("Blank");
if (layout == null)
throw new InvalidOperationException("This master has no layout named Blank.");
var slide = presentation.CreateSlide(layout);
var theme = slide.GetTheme(); // May be null when the master has no theme.
Layouts expose Name and the PresentationML Type string. Slides expose
GetSlideLayout(), GetSlideMaster(), and GetTheme(). The layout must be listed
by a referenced master in the same presentation. Attaching a layout does not
yet copy placeholder shapes or resolve inherited text formatting. Theme editing
is not supported.
This is a foundation, not full PowerPoint support. Parameterless slide creation requires an existing blank layout (included in newly created presentations). The layout overload can select other layout types. Existing slide content and unsupported related parts are retained, but high-level text boxes, pictures, tables, charts, notes, rendering, and animation APIs are not yet implemented. Strict OOXML and macro-enabled presentation formats are not supported.
System Requirement
.NET 8, .NET 10
.NET Standard 2.1 (.NET Core 3.x, .NET 5, .NET 6)
.NET Standard 2.0 (.NET Core 2.x)
.NET Framework 4.0 and above
Contributors
For detailed contributors list, you are read here
探索相关项目
加载中…