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
0
votes
0 answers

Is it possible to use NPOI to read an .xls/.xlsx as a stream?

I'm trying to use NPOI to read large excel files. However I have only been able to find examples in which an entire workbook is read into memory at once. using var stream = new FileStream(src, FileMode.Open); XSSFWorkbook wb = new(stream); The…
0
votes
1 answer

How to create pivot table and save it using NPOI C# package?

I am struggling for creating and saving a pivot table, I ran the code below with no error, but failed to open the excel file. Here is my code: public void Execute() { IWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet =…
Tien Dang
  • 41
  • 2
  • 3
0
votes
0 answers

How to convert html tags and inline css when export to MS Word? [Still not resolve]

My project have some input to let user type in. And one of the input is textarea using ckeditor, as we know when using ckeditor we can let our input text be like change color or change the font size. Like first, my text is "Hello" and I want it to…
Tony Hu
  • 1
  • 2
0
votes
1 answer

How to create a table of contents using NPOI?

I can barely find stuff for npoi when I do its for poi and its lacking. I found this for poi: CTP ctP = p.getCTP(); CTSimpleField toc = ctP.addNewFldSimple(); toc.setInstr("TOC \\h"); toc.setDirty(STOnOff.TRUE);enter code here`enter code here` And…
0
votes
1 answer

Change Excel cell color from C# script

I have some cells cached in the C# script that I want to change their font color from code to diferentiate their values, there is any way in C# to do this? I am already using the libraries NPOI and DocumentFormat.OpenXml, but I do not find how to…
0
votes
2 answers

Class with CellStyle static values for NPOI

[Update at the bottom] What I want to do: Have a class with static readonly values for the CellStyles so I can have my code that builds the excel file be like this: ICellStyle headerStyle1 = workbook.CreateCellStyle(); headerStyle1 =…
Amy
  • 9
  • 5
0
votes
1 answer

Cell.SetCellFormula() Throw Exception System.ArgumentNullException

class Program { static void Main(string[] args) { EditExcel(); } static void EditExcel() { string path = @"test.xlsx"; XSSFWorkbook workbook = new XSSFWorkbook(path); var sheet =…
david.gao
  • 41
  • 8
0
votes
0 answers

How to use NPOI library to select data in c#

I have an excel sheet with three column (Name, Gender, Email, Salary), I want to write a console application using NOPI library to select all male data with highest salary I use this code to read file from xl using System; using System.IO; using…
0
votes
0 answers

How do we write code in c# to show insert symbol dialogbox of word and select specific check box symbol?

From MS Word application, I can insert those symbols from "Wingdings" font, How can I achieve the same, while accessing any word document from C# code. Any help is appreciated! Thanks In Advance, Narsingrao Manda
0
votes
1 answer

Upload Excel file whose column data is dateTime but C# could not figure out NPOI

My Excel has column data like When I get the data in my asp.net api using below code, I get the data 01-1月-2021 instead of 2021-01-01 then I get the error in line entity.startTime = Convert.ToDateTime(row[0].ToString().Trim()); for (int j = 0; j…
Ryan
  • 19,118
  • 10
  • 37
  • 53
0
votes
0 answers

Is it possible to write macros into the excel using NPOI

I am creating an excel using NPOI. In this I want to call an exe(notepad++) when the user clicks a cell. As far as I know this behavior can be achieved only through macros. So is there any possibility that I can write macro into the excel? Or is…
prabhakaran
  • 5,126
  • 17
  • 71
  • 107
0
votes
1 answer

How to set cell value by id NPOI ,C#

Please help me. I have a question for npoi c# Generally to set value in npoi is sheet = workbook.GetSheetAt(0); IRow row = sheet.GetRow(0); ICell cell = rowA.GetCell(0); cell.setvalue("Sometime"); but, Can I set value by cell name from excel? …
pawaqma
  • 21
  • 3
0
votes
1 answer

NPOI XWPF set table column width not working

I've been trying to set the column width for my table, but it won't budge. I'm using NPOI from this git https://github.com/nissl-lab/npoi. Currently, my code is: FileStream stream = new FileStream(reportPath, FileMode.Open); XWPFDocument doc = new…
Lex
  • 63
  • 5
0
votes
0 answers

NPOI CopyTo not work and show NPOI.XSSF.UserModel.XSSFSheet.CopySheetImages Exception

I have a problem that I cannot use NPOI CopyTo. My Code var path = @"C:\Users\Wei\Downloads\Book2.xlsx"; var tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xlsx"); File.Copy(path, tempPath); using (var fs =…
Wei Lin
  • 3,591
  • 2
  • 20
  • 52
0
votes
1 answer

NPOI: change font color of some (not all) text in cell

When using C# NPOI, is there a way to change the font color of only some of the text within a cell? I know you can change the font color for the entire cell. But I would like to only change the color of the last 4 character in that cell. I know…
Fractal
  • 1,748
  • 5
  • 26
  • 46