• This repository has been archived on 24/Nov/2020
  • Stars
    star
    1,877
  • Rank 24,692 (Top 0.5 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A .NET library for reading and writing Microsoft Office binary and OOXML file formats.

English | 中文

NPOI

NuGet Build status

This project is migrated from Tony Qu's NPOI by .NET Core Community.

Announcement

The root upstream project of the NPOI project is tonyqus/NPOI, which is the .NET version of the Apache POI. tonyqus/NPOI is the project with the largest number of downloads of nuget packages in the Chinese-speaking area. Developers at home and abroad know that this kind of glory and contribution cannot be obliterated. Just like Linux has derived so many distributions, but no one can deny Linus's contribution.

dotnetcore/NPOI, as a downstream project of the tonyqus/NPOI project, was born at the end of 2016. At that time, developers urgently needed the .NET Core version of NPOI. At that time, after receiving a reply from tonyqus, he made it clear that he "has no intention of migrating and maintaining the .NET Core version." So dotnetcore/NPOI was born. It forks from tonyqus/NPOI and is known to upstream project authors. The upstream project author has repeatedly asked @alexinea about the progress of the dotnetcore/NPOI unit test.

The migration method of dotnetcore/NPOI is that @yang-xiaodong migrates file by file. All readers can understand that the namespace and file directory between the two projects have undergone a lot of changes. In the readme file (README.MD) uploaded for the first time, @yang-xiaodong has stated that this project is the .NET Core version of NPOI, and the NPOI project is still under tonyqus/NPOI.

This project is for NPOI Core. NPOI is still under at [https://github.com/tonyqus/npoi](https://github.com/tonyqus/npoi)

Mr. Yang has no intention of maintaining the .NET Framework version, and tony qu has no intention of migrating and maintaining the .NET Core version. Therefore, it means that this project is only the .NET Core version of NPOI, and the original version is still in tonyqus.

In subsequent versions, Mr. Yang also made it clear in the readme file that this project was migrated from tonyqus/NPOI.

After @yang-xiaodong learned that @tonyqus clearly did not intend to migrate and maintain tonyqus/NPOI to .NET Core, with the assistance of GitHub, removed the fork relationship between dotnetcore/NPOI and tonyqus/NPOI. Since then, the dotnetcore/NPOI project has become an independent downstream project to exist and develop independently, just like a Linux downstream distribution project.

For open source projects, it is impossible for everyone to be so perfect and rigorous at all times, as long as they do not violate the open source agreement or license. Mr. Yang has no intention and NCC has no intention to obliterate any glory of @tonyqus.

We believe that dotnetcore/NPOI has completed her historical mission. She gave a choice when the community most needed the .NET Core version of NPOI.

As an upstream project, tony qu has no right to require downstream projects to be archived. Has anyone heard that upstream Linux distributions can require downstream Linux distributions to be archived?

After discussion within the NCC PMC, it was decided not to argue with him, and to block him at the organizational level.

So the storm came, tony qu contacted to persuade NCC member projects to leave NCC, contacted Microsoft to ask for DMCA dotnetcore (because he thought github.com/dotnetcore was too formal) and so on. This series of actions led to controversy in the Natasha WeChat group. But on the contrary, the NCC QQ group and WeChat group did not discuss this matter-because everyone knew that dotnetcore/NPOI did not violate any open source license.

We condemn the behavior of some people passing screenshots of chats in the Natasha WeChat group to tony qu. The author of Natasha, LanX, said at the beginning: If everyone wants to argue, he can just create a new group and let tonyqu come in and discuss it together. I wonder if the person who secretly took the screenshot told tony qu this sentence?

What's more, the Natasha WeChat group is not an NCC group. It is only a Natasha technology studying group, but it is recognized as an NCC group by tony qu. The speeches in the group are also spread everywhere by tony qu. I don't know if he really doesn't know the difference, or pretends he doesn't know the difference.

We don't intend to spend more time entangled with tony qu. After discussing with the NCC PMC, we now decide to archive dotnetcore/NPOI to prevent the NCC community from getting into bigger disputes. If there is no accident, we will not make any response to this matter in the future.

We NCC thank the developers for their support and understanding, and we NCC are willing to work with developers and open source communities, including you, to make more contributions to .NET technology and ecology.


What is NPOI ?

NPOI is the .NET version of POI Java project at http://poi.apache.org/. POI is an open source project which can help you read/write xls, doc, ppt files. It has a wide application.

For example, you can use it to

  • generate a Excel report without Microsoft Office suite installed on your server and more efficient than call Microsoft Excel ActiveX at background;
  • extract text from Office documents to help you implement full-text indexing feature (most of time this feature is used to create search engines).
  • extract images from Office documents
  • generate Excel sheets that contains formulas

Install NuGet Package

Install-Package DotNetCore.NPOI

How can it work on Linux?

On Linux, you need install libgdiplus. Since 1.2.0 libdl is also required.

  • Ubuntu 16.04 and above:

    • apt-get install libgdiplus libc6-dev
    • cd /usr/lib
    • ln -s libgdiplus.so gdiplus.dll
  • Fedora 23 and above:

    • dnf install libgdiplus
    • cd /usr/lib64/
    • ln -s libgdiplus.so.0 gdiplus.dll
  • CentOS 7 and above:

    • yum install autoconf automake libtool
    • yum install freetype-devel fontconfig libXft-devel
    • yum install libjpeg-turbo-devel libpng-devel giflib-devel libtiff-devel libexif-devel
    • yum install glib2-devel cairo-devel
    • git clone https://github.com/mono/libgdiplus
    • cd libgdiplus
    • ./autogen.sh
    • make
    • make install
    • cd /usr/lib64/
    • ln -s /usr/local/lib/libgdiplus.so gdiplus.dll
  • Docker

    • Alpine

      # base sdk-alpine/aspnetcore-runtime-alpine images
      
      RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
      RUN apk --update add libgdiplus
      
    • Debian

      FROM microsoft/dotnet:2.1-aspnetcore-runtime
      RUN apt-get update && apt-get install -y libgdiplus libc6-dev && ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
      ...
      

Getting Started

Export Excel

var newFile = @"newbook.core.xlsx";

using (var fs = new FileStream(newFile, FileMode.Create, FileAccess.Write)) {

    IWorkbook workbook = new XSSFWorkbook();

    ISheet sheet1 = workbook.CreateSheet("Sheet1");

    sheet1.AddMergedRegion(new CellRangeAddress(0, 0, 0, 10));
    var rowIndex = 0;
    IRow row = sheet1.CreateRow(rowIndex);
    row.Height = 30 * 80;
    row.CreateCell(0).SetCellValue("this is content");
    sheet1.AutoSizeColumn(0);
    rowIndex++;

    var sheet2 = workbook.CreateSheet("Sheet2");
    var style1 = workbook.CreateCellStyle();
    style1.FillForegroundColor = HSSFColor.Blue.Index2;
    style1.FillPattern = FillPattern.SolidForeground;

    var style2 = workbook.CreateCellStyle();
    style2.FillForegroundColor = HSSFColor.Yellow.Index2;
    style2.FillPattern = FillPattern.SolidForeground;

    var cell2 = sheet2.CreateRow(0).CreateCell(0);
    cell2.CellStyle = style1;
    cell2.SetCellValue(0);

    cell2 = sheet2.CreateRow(1).CreateCell(0);
    cell2.CellStyle = style2;
    cell2.SetCellValue(1);

    workbook.Write(fs);
}

Export Word

var newFile2 = @"newbook.core.docx";
using (var fs = new FileStream(newFile2, FileMode.Create, FileAccess.Write)) {
    XWPFDocument doc = new XWPFDocument();
    var p0 = doc.CreateParagraph();
    p0.Alignment = ParagraphAlignment.CENTER;
    XWPFRun r0 = p0.CreateRun();
    r0.FontFamily = "microsoft yahei";
    r0.FontSize = 18;
    r0.IsBold = true;
    r0.SetText("This is title");

    var p1 = doc.CreateParagraph();
    p1.Alignment = ParagraphAlignment.LEFT;
    p1.IndentationFirstLine = 500;
    XWPFRun r1 = p1.CreateRun();
    r1.FontFamily = "·ÂËÎ";
    r1.FontSize = 12;
    r1.IsBold = true;
    r1.SetText("This is content, content content content content content content content content content");

    doc.Write(fs);
}

More Repositories

1

FastGithub

github加速神器,解决github打不开、用户头像无法加载、releases无法上传下载、git-clone、git-pull、git-push失败等问题
C#
13,273
star
2

CAP

Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
C#
6,267
star
3

Util

Util是一个.Net平台下的应用框架,旨在提升中小团队的开发能力,由工具类、分层架构基类、Ui组件,配套代码生成模板,权限等组成。
C#
4,306
star
4

WTM

Use WTM to write .netcore app fast !!!
C#
4,234
star
5

FreeSql

🦄 .NET aot orm, C# orm, VB.NET orm, Mysql orm, Postgresql orm, SqlServer orm, Oracle orm, Sqlite orm, Firebird orm, 达梦 orm, 人大金仓 orm, 神通 orm, 翰高 orm, 南大通用 orm, 虚谷 orm, 国产 orm, Clickhouse orm, QuestDB orm, MsAccess orm.
C#
4,071
star
6

DotnetSpider

DotnetSpider, a .NET standard web crawling library. It is lightweight, efficient and fast high-level web crawling & scraping framework
C#
3,753
star
7

osharp

OSharp是一个基于.Net6.0的快速开发框架,框架对 AspNetCore 的配置、依赖注入、日志、缓存、实体框架、Mvc(WebApi)、身份认证、功能权限、数据权限等模块进行更高一级的自动化封装,并规范了一套业务实现的代码结构与操作流程,使 .Net 框架更易于应用到实际项目开发中。
C#
2,758
star
8

BootstrapBlazor

Bootstrap Blazor is an enterprise-level UI component library based on Bootstrap and Blazor.
C#
2,492
star
9

Magicodes.IE

Import and export general library, support Dto import and export, template export, fancy export and dynamic export, support Excel, Csv, Word, Pdf and Html.
C#
2,074
star
10

WebApiClient

A REST API library with better functionality, performance, and scalability than refit
C#
2,047
star
11

EasyCaching

💥 EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
C#
1,736
star
12

AspectCore-Framework

AspectCore is an AOP-based cross platform framework for .NET Standard.
C#
1,684
star
13

AgileConfig

基于.NET Core开发的轻量级分布式配置中心 / .NET Core lightweight configuration server
C#
1,483
star
14

Natasha

基于 Roslyn 的 C# 动态程序集构建库,该库允许开发者在运行时使用 C# 代码构建域 / 程序集 / 类 / 结构体 / 枚举 / 接口 / 方法等,使得程序在运行的时候可以增加新的模块及功能。Natasha 集成了域管理/插件管理,可以实现域隔离,域卸载,热拔插等功能。 该库遵循完整的编译流程,提供完整的错误提示, 可自动添加引用,完善的数据结构构建模板让开发者只专注于程序集脚本的编写,兼容 stanadard2.0 / netcoreapp3.0+, 跨平台,统一、简便的链式 API。 且我们会尽快修复您的问题及回复您的 issue.
C#
1,449
star
15

HttpReports

HttpReports is an APM (application performance monitor) system for .Net Core.
C#
1,260
star
16

sharding-core

high performance lightweight solution for efcore sharding table and sharding database support read-write-separation .一款ef-core下高性能、轻量级针对分表分库读写分离的解决方案,具有零依赖、零学习成本、零业务代码入侵
C#
1,142
star
17

SmartSql

SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
C#
1,098
star
18

FlubuCore

A cross platform build and deployment automation system for building projects and executing deployment scripts using C# code.
C#
907
star
19

Alipay.AopSdk.Core

支付宝(Alipay)服务端SDK,采用.NET Standard 2.0,支持.NET Core >=2.0,与官方SDK接口完全相同。完全可以按照官方文档进行开发。除了支持支付以外,官方SDK支持的功能本SDK全部支持,比如生活号、服务窗、行业合作等,且用法几乎一样,代码都可参考官方文档代码。
C#
778
star
20

SmartCode

SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!!
C#
572
star
21

CanalSharp

Alibaba mysql database binlog subscription & consumer components Canal's .NET client.
C#
559
star
22

aspnetcore-doc-cn

The Simplified Chinese edition of Microsoft ASP.NET Core documentation, translated by .NET Core Community and .NET China Community.
C#
521
star
23

Home

Home repo of .NET Core Community
299
star
24

mocha

Mocha is an application performance monitor tools based on OpenTelemetry, which also provides a scalable platform for observability data analysis and storage.
C#
142
star
25

Collections

Utilities and extensions for Collections includes Collections.Paginable and so on...
C#
88
star
26

EntityFrameworkCore.KingbaseES

Entity Framework Core provider for KingbaseES Database
C#
45
star
27

EntityFrameworkCore.GaussDB

Entity Framework Core provider for GaussDB Database
C#
32
star
28

FlubuCore.Examples

Examples for FlubuCore - a cross platform build automation tool for building projects and executing deployment scripts using C# code.
C#
32
star
29

wind-rises

25
star
30

Compile.Environment

When using the Roslyn library for dynamic compilation, you can introduce the library to provide a dynamic compilation environment.
10
star
31

SourceLink.Environment

Provide an inheritable NuGet package for the SourceLink feature.
7
star
32

projects

This repository is the site of NCC Projects include both Top-Level projects and Sandbox projects.
CSS
5
star
33

Natasha.Docs

The document for Natasha
JavaScript
4
star
34

DotNetCore.GaussDB

It's the foundation of DotNetCore.EntityFrameworkCore.GaussDB
C#
3
star
35

dotnetcore.github.io

.NET Core Community Official WebSite
HTML
2
star