Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use NPOI Library to read and write Excel Files in C #

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, I would like to share with you how to use the NPOI library to read and write Excel files in C#. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.

Step 1: add program reference: right-click Project Project-manage NuGet package-search NOPI-install

Manipulate the file Excel

Read excel file

Private IWorkbook wk; private FileStream fs; private void OpenExcel (string path) {StringBuilder sbr = new StringBuilder (); try {using (fs = File.OpenRead (path)) / / Open the myxls.xls file {wk = new XSSFWorkbook (fs) / / write the data from the xls file to wk for (int I = 0; I < wk.NumberOfSheets; iTunes +) / / NumberOfSheets is the total number of tables in myxls.xls {ISheet sheet = wk.GetSheetAt (I); / / read the current table data for (int j = 0; j)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report