In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian introduces in detail "how to use NPOI to achieve Excel import and export function in C#", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to use NPOI to achieve Excel import and export function in C#" can help you solve your doubts.
Excel Import
Use the OpenFileDiolog control and button to select the file to import and display the path in the text box
Set the button click event to assign the file path to textBox.Text
Private void Department_SUM_Click (object sender, EventArgs e) {OpenFileDialog open = new OpenFileDialog (); open.ShowDialog (); textBox1.Text = open.FileName;}
Implement excel import and obtain the file path through textBox1.Text
Private void button_Excel_Click (object sender, EventArgs e) {FileStream fs = null; IWorkbook workbook = null; ISheet sheet = null; IRow row = null; String txtpath = textBox1.Text; fs = File.OpenRead (txtpath); workbook = new XSSFWorkbook (fs) If (workbook! = null) {sheet = workbook.GetSheetAt (0); / / get the first sheet if of the excel table (sheet! = null) {/ / the LastRowNum of the row is 0~N-1 / / the LastCellNum of the column is 1N int rowCount = sheet.LastRowNum If (rowCount > 0) {IRow firstrow = sheet.GetRow (0); int cellCount = firstrow.LastCellNum; for (int I = 0; I 0) {IRow firstrow = sheet.GetRow (0) Int cellCount = firstrow.LastCellNum;for (int I = 0; I
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.