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
1 answer

NPOI - Determine heading before a paragraph

I'm attempting to write a parser to extract details from a word document using NPOI. I'm able to retrieve details from each table in the document but I need to be able to identify which section of the document the table comes from in order to…
Wax_Lee
  • 13
  • 3
0
votes
0 answers

IRow all cell merage

I am using NPOI and I want to merge all cells in a single row. example: NPOI.SS.Util.CellRangeAddress crart = new NPOI.SS.Util.CellRangeAddress(rowindex, rowindex, 2, columnCount >= 2 ? columnCount : 2 + columnCount); sheet.AddMergedRegion(crart);
0
votes
1 answer

NPOI. Expand width of excel file when it opens

Could you explain me, I make excel file from datatable using npoi. Could I expand columns when file opens to header content lengths. using (FileStream fs = System.IO.File.Create(FileName)) { workbook.Write(fs); }
0
votes
0 answers

How to run excel macro using NPOI

I have to run excel macro using npoi in c sharp. i dont know how to do it in code behid. Please let me know how to fix this one. Thanks
0
votes
1 answer

NPOI image resizing

I'm trying to change resize the inserted image in Excel sheet using NPOI. Here is an example of code: IWorkbook workbook; if (useOldExcelFormat) workbook = new HSSFWorkbook(); else workbook = new XSSFWorkbook(); ISheet sheet =…
0
votes
1 answer

DotNetCore.NPOI & .Net Core 2 MVC Web App

I am using DotNetCore.NPOI V1.0.2 in my .NET Core 2 MVC web app. I have been researching for instructions or examples to create .docx document with header and footer without any success. Does anyone know how to create two lines header and footer…
0
votes
2 answers

How to color specific row in excel table?

I create excel file using NPOI dll's. I have this code that create excel table from List : IWorkbook workbook = new XSSFWorkbook(); ISheet sheet1 = workbook.CreateSheet("Sheet 1"); IRow header =…
Michael
  • 13,950
  • 57
  • 145
  • 288
0
votes
1 answer

Trying to send blank excel doc to user using Web Api / NPOI

It says the stream is closed. I am just trying to figure out how I send back a blank .xls file. ObjectDisposedException: Cannot access a closed Stream. System.IO.__Error.StreamIsClosed() [Produces("application/json")] [Route("api/Report")] public…
punkouter
  • 5,170
  • 15
  • 71
  • 116
0
votes
1 answer

Creating new rows with NPOI

I have a table in an excel document (.xlsx), which serves as a report template. I'd like to create a specific number of new rows in that template, at a specific row index, and also copy the format/style of the row before the new rows. I tried…
TheAptKid
  • 1,559
  • 3
  • 25
  • 47
0
votes
2 answers

cell formatting not applied after formula

I'm using NPOI. I read in an Excel workbook with two sheets that acts as a "template" for the result workbook I'll be generating. Sheet 0 is empty aside from some header rows and sheet 1 has a number of rows of formulas. The formulas generally…
Buzz
  • 512
  • 1
  • 4
  • 11
0
votes
1 answer

NPOI protect sheet XSSF excel workbook

I have to protect only one row (example the rowNum 0) in a xssf Excel generated in this way (using library NPOI version 2.2.1.0) ISheet sheet_for_dropdown_list = Workbook.CreateSheet("DropDownList"); Actually the protect command is used only to…
0
votes
2 answers

NPOI - Add image to excel header

Can someone please help me out with how i can insert an image into the header of an excel document? I am using NPOI to generate my excel,i am able to insert text data in the header, however the documentation does not point out on how i can insert…
aditya
  • 343
  • 2
  • 14
0
votes
1 answer

NPOI Excel file download corrupt

I am trying to export data from a data table to excel using NPOI, angular2 and web API. The steps I am following are - 1. Write data from data table to XLSX and store the file temporarily on the server, 2. Read this same and into a memory stream and…
aditya
  • 343
  • 2
  • 14
0
votes
2 answers

NPOI GetZoom of Worksheet

I am using NPOI library to read in an existing workbook, and create a new one. When creating an HSSFSheet. I see that there is a method called SetZoom. What I don't see is a GetZoom method, or a Zoom property, in order to tell what that Zoom level…
David P
  • 2,027
  • 3
  • 15
  • 27
0
votes
1 answer

NPOI Core - Formula Issue

I am trying to create a simple formula of SUM(E1:E6) but keep getting a Value cannot be null. Parameter name: stream. I have put an = in front and even made it lower case with no success. A formula I was able to get to work was 1 + 3 + 8. I then…
Grandizer
  • 2,819
  • 4
  • 46
  • 75