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
4
votes
2 answers

NPOI - Conditional Formatting not working when create new excel from template

Code: private static void CreateExcel(string filename) { var workbook = new XSSFWorkbook(); try { var sourcebook = AppDomain.CurrentDomain.BaseDirectory + "" + "\\App_Data\\Copy of…
King_Fisher
  • 1,171
  • 8
  • 21
  • 51
4
votes
2 answers

C# changing backColor of a cell using the NPOI library

Hi I am trying to write an .xls file using the c# library NPOI, I have been able to create the file but when I tried to change the back color of some of the cells of my sheet I don't know why all the cells of the sheet change color it's driving me…
Ale61268967
  • 107
  • 2
  • 10
4
votes
1 answer

NPOI Excel / C# Need formula to programatically change background for conditional formatting

I'm using NPOI to programatically create an Excel file. One of the requirements is that it needs to be able to change the background of cells based on values - green for good numbers, red for bad, etc. I have everything working perfectly and can…
Jimmy Genslinger
  • 557
  • 3
  • 21
4
votes
2 answers

NPOI support CSV/TSV?

I'm using the NPOI library with a C# application. What I'm creating is a reporting system that automatically reads, and extracts data from an excel sheet. I was given a spec, informing me that all reports I needed to ingest in my system were in .xls…
109221793
  • 16,477
  • 38
  • 108
  • 160
4
votes
2 answers

How to apply border styles to NPOI workbook cells

I didn't find this information anywhere on the internet so thought I would post here as I found the answer myself. I want to create cells in a spreadsheet, using NPOI, that have borders, and it isn't obvious how to do that.
tekiegirl
  • 1,229
  • 5
  • 17
  • 30
4
votes
3 answers

How set height row in excel with NPOI?

How set height row in c# with NPOI? To specify the width of the columns I'm using XSSFSheet.SetColumnWidth, but what does the command for the height of the cells look like?
Garrus_En
  • 161
  • 1
  • 5
4
votes
1 answer

C# NPOI set cell style to Text / string 1-19 is formatted as a date / disable any formating

I am creating an excel, when i write some values example 1-19, when I open the excel doc, i see 1-19, but if i click on it then excel tries to format it as a date IS THERE A WAY to force the sheet to not use any formulas or formatting? I have…
China Syndrome
  • 953
  • 12
  • 24
4
votes
1 answer

NPOI - Writing to file corrupts .xlsx workbook

I have a piece of code that is currently writes to a .xls workbook (HSSFWorkbook) with no issue. However when I try to use the same code to write to a .xlsx workbook (XSSFWorkbook) the archive becomes corrupted and cannot be opened in excel. The…
James C. Taylor IV
  • 599
  • 10
  • 24
4
votes
0 answers

Namespace NPOI.POIFS.Crypt

I installed NPOI from NuGet, version 2.1.3. I want to read encrypted excel file. By this goal according to this thread i need use class EncryptionInfo from namespace NPOI.POIFS.Crypt. But my assembly not contain this namespace. If you look at the…
Roman Yakhmenev
  • 101
  • 1
  • 8
4
votes
0 answers

Does NPOI support Pivot charts?

I am trying to create spreadsheet from template. Template is having 3 sheets: 1st one is chart sheet which contains pivot chart. 2nd sheet contains pivot table which is used as data table for pivot chart in 1st sheet. 3rd sheet contains…
4
votes
2 answers

'OutOfMemoryException' reading 20mb XLSX file

I'm using NPOI to deal with Excel files. Here's how I'm reading files: using (FileStream stream = File.OpenRead(excelFilePath)) { IWorkbook wb = WorkbookFactory.Create(stream); ... } However, for any XLSX file larger than a few megabytes,…
Saeb Amini
  • 23,054
  • 9
  • 78
  • 76
4
votes
0 answers

Formula evaluation not working in NPOI 2.1.3.0

I am creating an Excel workbook in code behind and save it as both XLSX and PDF. I use a template workbook for this that has formatting and formulae to be evaluated after the generating is done. When I open the Excel file, the formulae evaluate only…
LeonidasFett
  • 3,052
  • 4
  • 46
  • 76
4
votes
2 answers

Using NPOI, how do I return a cell value as it has been formatted by Excel?

Using NPOI, is there any buildin possibility to format a cell value (especially numeric and date values) as it has been formatted by Excel? If not what would be the best way to implement it? I thought of a formatstring converter from…
Samuel
  • 85
  • 1
  • 1
  • 10
4
votes
1 answer

Unable to set FillBackgroundColor

I'm using NPOI 2.0.6.0 in a C# project and I'm running into difficulty changing the styling. While I can affect font and cell borders I cannot change the background color. private void buildSheet(HSSFWorkbook wb, DataTable data, string…
mitchellJ
  • 734
  • 3
  • 9
  • 32
4
votes
1 answer

Insert Image to Excel File Using NPOI

I'm writing a program in Visual Studio 2010 using C#, and I'm using the NPOI library. I'm trying to insert an image to the excel file. I tried 2 different methods and neither of them works. //Method 1 HSSFPatriarch patriarch =…
sora0419
  • 2,308
  • 9
  • 39
  • 58