NPOI | NET library for reading and writing Microsoft Office binary | SDK library
kandi X-RAY | NPOI Summary
kandi X-RAY | NPOI Summary
NPOI is the .NET version of POI Java project at POI is an open source project which can help you read/write xls, doc, ppt files. It has a wide application. For example, you can use it to.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of NPOI
NPOI Key Features
NPOI Examples and Code Snippets
Community Discussions
Trending Discussions on NPOI
QUESTION
I want to convert .xlsx file to html using NPOI. Is this possible? I know , xls to html conversion is available using NPOI. But not sure if NPOI provide option to convert .xlsx file to html also. Thanks
...ANSWER
Answered 2022-Mar-08 at 07:53You can use ExcelToHtmlConverter
. It has method ProcessWorkbook
which accepts IWorkbook
as a parameter. So it can be used to convert either HSSFWorkbook
(xls) or XSSFWorkbook
(xlsx).
QUESTION
I am trying to get a form that was created in visual studio WPF C# to submit to a new excel workbook will save onto a shared network drive. I have done a bit of digging trying to find the best solution and I have came across NPOI but all of the solutions seem pretty complicated compared to what I need to do. Is there some easy resource that I can reference to simply create a workbook and insert data into specific cells -- then save?
The two related packages I have seen in NuGet are DotNetCore.NPOI and NPOI which is the one I should be using?
What I have tried so far is:
...ANSWER
Answered 2021-Dec-08 at 18:58I have figured it out like this:
QUESTION
Below are my code, I'm stuck with can't append the contents in the excel, When first time load the program, the excel can output normal But at Second time load the program, the excel will crash badly(can't open). I'm using the FileMode.Append, FileAccess.Write, but still can't works Is there have some step I missed it? please help me to solve this issue, thanks a lot!
...ANSWER
Answered 2021-Nov-05 at 15:00As already commented… I can confirm from a few tests that …
QUESTION
I write in C#
, and use NPOI.SS.UserModel
to write a program to get value from the cell on Excel.
The problem is the cell with formula. I am trying to get the result value from the formula cell, but I can't do it properly.
The formula is:
...ANSWER
Answered 2021-Oct-21 at 04:18Let me get straight to the point, this issue was solved by changing the module from ClosedXML to NPOI for the process of editting the Excel file .
I'll explain what happened:
- Prepared a template Excel file(hereinafter referred to as TEMP). TEMP has a cell which has the Lookup formula that I explaned in OP.
- Copied the TEMP and create new Excel file(hereinafter referred to as NEW). Editted some cells on the NEW by ClosedXML.
- Read the NEW by NPOI. Couldn't read the cell value of the cell with Lookup formula properly. (This is the OP.)
- Changed the program for the process of the step 2. Made the process done by NPOI not by ClosedXML.
- With new modified program, created NEW file and read the NEW file. Read cellvalue successfully from the cell with Lookup formula.
The reason that ClosedXML and NPOI was mixed up in the program. It used to use only ClosedXML module for both editing and reading Excel files. But, when "another" issue(couln't read the cellvalue from the cell with Lookup formula) than this OP occurred, I changed the module for ClosedXML to NPOI only for the process of reading Excel files. Because I found the article pointing out on the internet that there are un-supported formulas by ClosedXML and Lookup formula is so. But, for the process of editting Excel files, it looked it doesn't have any problem, so I continued using ClosedXML for editting Excel files.
However, in the issue this time, when you use ClosedXML to edit Excel file that has a cell with un-supported formula like Lookup formula, somehow the formula hasn't been calculated or evaluated. And when you read it, you can't read the calculated cellvalue properly.
QUESTION
I'd like to add horizontal grid lines to a bar chart (IChart) I created using NPOI. I can't find anything in the documentation about adding grid lines to a chart, and I'm wondering if I'm missing something. My code is shown below:
...ANSWER
Answered 2021-Sep-14 at 06:02Displaying minor and major gridlines for chart is not supported.
I would suggest to create a ticket for an enhancement.
QUESTION
I'm using NPOI in my .net core library to do some operations in my excel sheet.
I'm now want to get the used rang in the worksheet. Is there any way to achieve this target? For some reasons, I cannot use Microsoft.Office.Interop.Excel
COM component.
ANSWER
Answered 2021-Sep-11 at 15:00I've solved this question by using the LastRowNum
and LastCellNum
property.
For example, If I have got a ISheet instance like the following:
var sheet = workbook.GetSheetAt(0);
Then, I can get the range by the LastRowNum
and LastCellNum
property.
QUESTION
I was trying to use NPOI to create a word document from a template.Inside the document I was trying to insert a table in a table cell.The table cell has two paragraphs, I was trying to insert a table between the two paragraphs.
...ANSWER
Answered 2021-Aug-30 at 07:38Here is my solution: In the template, create a table between the two paragraphs to replace.
QUESTION
I'm building an Excel to .bin console app using NPOI, what I'm looking to do is compare read data to to the class one, let me explain better...
If I have an Excel file : Sample.xlxs
_valueOne _valueTwo 0.0f testStringThen with my app I'll convert it into a Datatable (then serialize it) but I'll check for any error on the Excel file before I'll write the Datatable, for example in the final class that will be:
...ANSWER
Answered 2021-Jun-07 at 13:49If you are using visual studio: you need to go to your project, go to reference > Right Click > Add reference. In the window that appears select Project, and then select the project that contains classes. Then save.
EDIT: if you want to add it in a dynamic way, then, as @Romka suggested use something like this:
QUESTION
[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:
ANSWER
Answered 2021-May-12 at 15:23In the end doing this was the solution.
QUESTION
class Program
{
static void Main(string[] args)
{
EditExcel();
}
static void EditExcel()
{
string path = @"test.xlsx";
XSSFWorkbook workbook = new XSSFWorkbook(path);
var sheet = workbook.GetSheetAt(0);
var row = sheet.GetRow(4);
var cell = row.GetCell(3);
cell.SetCellType(CellType.Formula);
cell.SetCellFormula("SUM(E4:F4)");
FileStream fs = new FileStream(@"newTest.xlsx", FileMode.Create, FileAccess.Write);
workbook.Write(fs);
}
}
...ANSWER
Answered 2021-Apr-02 at 08:43It's a bug in NPOI 2.5.2. I was facing the same issue in my app and only workaround for now is to downgrade to 2.5.1. It should be fixed in the next release 2.5.3.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install NPOI
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page