Questions tagged [npoi]

.NET version of the Apache POI (Java) project

This project is the .NET version of the Apache POI project (the Java API for Microsoft Documents). POI is an open source project which can help you read/write xls, doc, and ppt files, so it has wide applications. For example, you can use it to generate an Excel report without Microsoft Office suite installed on your server and it is more efficient than calling Microsoft Excel ActiveX in the background; you can also use it to extract text from Office documents to help you implement full-text indexing feature (most of time this feature is used to create search engines).

Latest stable version: 2.6.0 / 17 November 2022

Latest actual source code: https://github.com/nissl-lab/npoi

612 questions
5
votes
0 answers

How To Import and Display Excel (.xlsx) File to Blazor WASM Client Side (Without Uploading to Server)

Like the title says. Lots of examples online for uploading files to backend but I'm after verification client side/offline followed by an upload of data only (no files). In theory, anything that runs on .Net5 should be able to run in WASM at a close…
Waleed Al Harthi
  • 705
  • 9
  • 25
5
votes
2 answers

NPOI insert row like excel

How can I use NPOI to insert a row like excel? The excel insert command copy the format for the upper row Thanks!
Rodrigo Juarez
  • 1,745
  • 1
  • 23
  • 38
5
votes
2 answers

Npoi ICell.DateCellValue return NullReferenceException

I have this Excel column: Formatted as date data format: And I get NullReferenceException if I try to read the DateTime value. Do you know what is wrong here and how to fix it? Is it possible to convert the number into DateTime somehow? For…
Muflix
  • 6,192
  • 17
  • 77
  • 153
5
votes
1 answer

Trying to edit cell value of existing Excel file using NPOI

I have written the following code to edit an Excel file using C# and NPOI library. There are no errors, but after running the code if I open the file, the value of the cell is not edited. What am I doing wrong? namespace Project37 { class…
manvitha
  • 163
  • 5
  • 17
5
votes
2 answers

How can I set the RGB Color in font Using xssfworkbook npoi

How can I set the RGB color in cell backgroudn using class xssfworkbook using npoi? byte[] rgb = new byte[3] { 192, 50, 90 }; XSSFCellStyle HeaderCellStyle1 = (XSSFCellStyle)wb.CreateCellStyle(); HeaderCellStyle1.SetFillForegroundColor(new…
PParmar
  • 95
  • 2
  • 9
5
votes
1 answer

Update the existing cell value in an excel file using NPOI

I created an excel file and inserted a new value in (0,0) [row,cell] as Hello. Second time I opened the same excel file, same sheet and updated the same (0,0) cell with an another string value. The code is running successfully without any errors but…
Ashok kumar Ganesan
  • 1,098
  • 5
  • 20
  • 48
5
votes
0 answers

Copy sheet from one workbook to another using NPOI in C#

I need to copy a sheet from one workbook to another. I am trying with the below code, but it is not working: ISheet newSheet = wb.GetSheetAt(0).CopySheet("WeeklyReport"); string filePath = "billing_template2.xlsx"; XSSFWorkbook…
CodeZila
  • 919
  • 2
  • 14
  • 31
5
votes
1 answer

Is there a way to convert a HTML table to xls / xlsx-file using NPOI/C#?

my main goal is to dynamically create a xls containing a html table on serverside in my .NET-Application. The Datamodel of my HTMLtable is pretty complex, though, but I managed to create the Model using dotliquid for another use case - the export to…
getoverit-DE
  • 161
  • 2
  • 10
5
votes
1 answer

NPOI writing to XLS but not XLSX

Having a difficult time with this one... Everything worked 100% with XLS (I'm using NPOI on my ASP.NET app): using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; private MemoryStream ms = new MemoryStream(); private IWorkbook workbook; private…
notAnonymousAnymore
  • 2,637
  • 9
  • 49
  • 74
5
votes
1 answer

How to save in excel 2010+ with NPOI 2.0

I use NPOI for a long time and it always works but now I need to make it work with .xlsx and at least Microsoft Office 2010. It works but when I try to open the file it says that it's corrupt and I can not repair it. Here's the error I get…
VinnyG
  • 6,883
  • 7
  • 58
  • 76
5
votes
1 answer

Add Image to Word Docx using NPOI Library C#

I was already using the NPOI Library for creating Excel Documents(which is the .NET version of POI Java project), but now I also want to create a Word (Docx document). I want to add an image to the document, but somehow it won't work. It looks like…
Vincent Hogendoorn
  • 700
  • 1
  • 7
  • 23
5
votes
3 answers

CellStyle applied to all cells in the Worksheet unexpectedly - NPOI?

I don't understand why this can happen, first I tried applying a bold text to my column headers in the first row, then I want to set my header cells' borders to MEDIUM, but this MEDIUM border style is applied to all cells in the sheet. There are…
King King
  • 61,710
  • 16
  • 105
  • 130
5
votes
1 answer

Border for created cell with npoi

I have an Excel File which serves as a template for my Excel work and I want to programatically fill this template with data. When I create a row and an accompanying cell and set a border for the newly created cell, the whole sheet is assigned this…
Bahar
  • 93
  • 1
  • 1
  • 5
4
votes
3 answers

how I can place an image just in one cell using npoi

I'm using npoi to generate excel docs. I have a requirement to add images to cells. Using the following code i can insert images into my doc. However the image span many cells. How can i ensure that the image just fits inside once cell. public…
frosty
  • 5,330
  • 18
  • 85
  • 122
4
votes
2 answers

How to get NPOI Excel RichStringCellValue?

I am using DotNetCore.NPOI (1.2.1) in order to read an MS Excel file. Some of the cells are of type text and contain formatted strings (e.g. some words in bold). How do I get the formatted cell value? My final goal: Retrieve the cell text as HTML. …
Ingmar
  • 1,525
  • 6
  • 34
  • 51