Questions tagged [npoi]
.NET version of the Apache POI (Java) project
618
questions
0
votes
0
answers
19
views
Cannot get a text value from a numeric cell NPOI
I am trying to Read/Write an Excel spreadsheet using NPOI. I have an existing Template Excel spreadsheet that I am trying to open, read, update certain cells. I am able to go through all of the code ...
0
votes
0
answers
21
views
setcellvalue in excel not updating the file
I am using NPOI and could not make it set value work for me. I am using 1 stream for both my read and write but could not make it to save into disk . Please help
using (var fs = new FileStream(v, ...
0
votes
0
answers
22
views
NPOI reads wrong Formula value inside sheet data validation
For some reason, NPOI returns "A65535" instead of "F9" in Formula1 field inside data validation. I read all validations from sheet using sheet.GetDataValidations() method, and then ...
0
votes
0
answers
39
views
Excel : We found a problem with some content (NPOI C#)
I am creating a file Excel using NPOI and C#.
Everything works fine when writing the workbook to filestream;
I can open the file just created and read it with no problems.
Instead, I got "We ...
0
votes
0
answers
21
views
Find the location of a specific value in Excel using NPOI
I have an app that I wrote using the Excel Interop library but my bosses want me to use an non-Excel library so I am trying to use the NPOI library. I look for a specific value in the spreadsheet to ...
0
votes
0
answers
39
views
NPOI Word: How to clone row and insert it at the specified index?
I have a table in a Word document with 3 rows: 1st for Header, 2nd for Data placeholder, and 3rd for Summary. I want to clone the second row right after it - before Summary row. What I tried to do ...
0
votes
0
answers
31
views
Blank Cell with Celltype: String is throwing FormatException trying to parse as an int with NPOI
I have been getting such a bizarre bug in my C# application. I am going through an xlsx file, and saving it to a List<List>, each string representing a cell. Inexplicably, some but not most ...
0
votes
0
answers
50
views
Closed memorystream. cannot find the error
Please take a look at this:
Controller:
public IHttpActionResult GetExcel(InputSimpleString supplierNo)
{
var stream = handler.GetExcelOld(supplierNo.input, true);
if (stream != null)
{
...
0
votes
0
answers
30
views
Not able to generate Dual Y-axis chart report in excel using NPOI 2.6.2 & C#
Am not able to generate chart report excel with Secondary Y-Axis below is the code I have already developed for Primary Y-axis but my requirement is to create secondary Y-axis as well which is am not ...
-1
votes
1
answer
32
views
How to set up conditional formatting iconsets in Excel using C# NPOI? (C#, NPOI, Excel, MultistateFormatting, IconSet, IconSet Thresholds)
I wanted to add conditional traffic light iconsets to an Excel-file using C# NPOI, which would change depending on the value in a cell. But there are, unfortunately, no good guides on this ...
0
votes
0
answers
10
views
NPOI check if a cell is erroneous (upgrading from 2.0 to 2.6)
I'm upgrading NPOI from 2.0 to 2.6, and i found a bit retrocompatibility problem (for my app).
In 2.0, this (simplified) code throws a generic exception (System.Exception) with the message "...
0
votes
0
answers
33
views
Updating existing excel book in npoi won't update existing formulas
I'm modifying an existing excel file using NPOI. When I edit an cell and give it a value using NPOI, it sets the value correctly. However, existing formulas in the spread sheet are not updated to ...
0
votes
0
answers
47
views
Print Excel Sheet in NPOI
I am using NPOI in wpf project To write an excel File
I want to print it directly into landscape A4 After that, that means I want to write the excel and printit correctly Directly , How to do that,I ...
0
votes
0
answers
23
views
NPOI 2.5.6 Page Breaks
I have generated an xlsx file using NPOI(2.5.6) and I want to print it. I have took a look on the examples on github pages but none of the examples gave the result expected.
my goal is to print xlsx ...
1
vote
0
answers
235
views
Using ExcelMapper to convert Excel to Object with Index and headerRow is true
I using ExcelMapper to convert Excel to Object. Currently, I need to use mapping with index and the index can be dynamic. This one can be achieve by using AddMapping. However, I cannot get the data if ...
0
votes
0
answers
67
views
Print xlsx file using NPOI without using Interop
I have generated an xlsx file using NPOI(5.6.0) and I want to print it. I have took a look on the examples on github pages but none of the examples gave the result expected.
my goal is to print xlsx ...
0
votes
0
answers
104
views
Create total row in xlsx file using NPOI
I'm trying to create a Table inside xlsx with a Total row. I am using this solution as an example.
https://stackoverflow.com/questions/65178752/format-a-excel-cell-range-as-a-table-using-npoi
The ...
0
votes
0
answers
171
views
NPOI SetColumnGroupCollapsed not working with SetColumnWidth
Using C# and NPOI, I try to create an xlsx spreadsheet that groups a number of columns. The group should be expanded when the spreadsheet is opened. This worked, until I added custom column widths. If ...
0
votes
0
answers
69
views
Using NPOI to open Excel worksheet with pivot chart produces XML error
I have 4 sheets in an excel, the 4th sheet has the data which referenced in the other 3 sheets to populate a pivot table.
1st one is chart sheet which contains pivot chart.
2nd sheet contains pivot ...
0
votes
0
answers
23
views
AddCarriageReturn not working as expected in NPOI
In c# program, I am trying to add 3 lines in, but it looks more gap between 2 lines
XWPFParagraph paragraphTwo = document.CreateParagraph();
paragraphTwo.Alignment = ParagraphAlignment.LEFT;
...
0
votes
0
answers
221
views
NPOI C# populate table in Excel spreadsheet containing an XML Map
Using C# and NPOI, I'm trying to import data into an existing Excel spreadsheet that contains a table and an XML Map as below.
When I try to save and close the spreadsheet at end of process I get a ...
0
votes
0
answers
48
views
Accessing a textbox in word document using NPOI library
Help me please
In short, I need to change textbox text inside word document, but I can't access textbox because inside XWPFDocument object there are only paragraphs and tables. I'm working on ASP.NET ...
0
votes
0
answers
79
views
Failed to open excel(.xlsx) with NPOI(2.5.6) with too many graph
Currently I'm trying to open the excel (workbook) which contain many sheets and each of the sheet contain multiple graphs. Unfortunately, I cannot open the file and it throws error, but the error is ...
0
votes
1
answer
107
views
NPOI XSSFRichTextString/XSSF Hyperlink Excel with hyperlink for part of text
I want to create a cell in excel where only part of the text is a hyperlink.
Something like this
"Click here"
It seems like I can only make the whole cell a hyperlink and not a part of the ...
0
votes
1
answer
156
views
How to center an image using NPOI with c#?
I'm developing on a .net6.0 project and I have to generate and .xslx file using NPOI library and I need to add an image on a cell an center it.
So first of all I create a XSSFWorkbook, add a worksheet,...
1
vote
0
answers
96
views
Row content height is only adjusted after clicking on a cell NPOI
I am using NPOI to export some data to excel, inside a cell I am inserting 3 items with 2 lines breaks so I am adjusting the row height accordingly:
var row = sheet.CreateRow(1);
row.Height = 900;
...
0
votes
1
answer
139
views
Place an image and let it align right in a merged cell using NPOI
As title. My goal is to put a company logo on my excel so it can be shown at the lower-right corner of a paper. Assume that the CompanyImageRawData stores the byte array of the company logo, and ...
0
votes
0
answers
67
views
C# how to find a specific cell value and get (row,col) with NPOI?
C# and npoi,
did npoi have the find method that return a cell location (row,col) with a given value?
any better way than read every cell in the sheet and compare?
0
votes
1
answer
70
views
Why is there missing data when importing Excel sheet to DataTable in WPF (using NPOI)? [duplicate]
I'm trying to import an Excel sheet into a DataTable using NPOI, use the first row of the Excel sheet as headers, then bind the DataTable to a DataGrid in WPF. However, the first two columns of data ...
0
votes
0
answers
93
views
NPOI copy and insert column between columns
How can I use NPOI to copy a column and insert it as new column between existing columns -just like in excel?
For example, I have excel cells with value,
| A | B | C | D |
I want to copy the whole ...
1
vote
1
answer
602
views
c# NPOI read large Excel file (> 8224 ytes)
I am using .net 7.0 and the Nuget NPOI package to read different types of excel files in an api.net project.
Problem is this package only supports excel files upto 8224 bytes.
Is there a way to read ...
0
votes
0
answers
56
views
What Causing Invalidate Data Validation Error in NPOI
I,m using NPOI to generate excel file from table and then add data validation to some condition in cell, everything is good, but when i open the generated file it show an error
i have 2 data ...
0
votes
1
answer
150
views
NPOI: Iterate all bookmarks of a docx
I need your help to find a way to browse all the Bookmarks in a docx with NPOI in C# .NET 4.7.
At the moment I'm doing it this way, but I can't reach the bookmarks that would be in a table for example....
1
vote
0
answers
51
views
read from docx by NPOI , get Exception" SettingsDocument parse failed"
using (FileStream readStream = File.OpenRead(filePath)){
bool test = readStream.CanRead;
document = new XWPFDocument(readStream);
I want to read many docx by NPOI , but when i read some docx ,...
0
votes
0
answers
290
views
Excel File Error After Download in C# Using NPOI
I have an excel file template, and then add dropdown data to excel using C#, everthing is fine in my local machine, i can download it but when i put it in server is always getting error
and actually, ...
0
votes
0
answers
67
views
Editing excel with npoi breaks buttom with macro
I have excel template that I copy and populate using npoi. I take a copy of original. This works fine but after I put set cell values the button that has macros breaks
Is there something that can be ...
0
votes
1
answer
260
views
NPOI Enable Filtering on Protected Sheet
I have problem with generating excel with autofilter on, in protected sheet with NPOI.
I got an excel template that look like this:
What we need to achieve is, enable filter in every header, and ...
0
votes
0
answers
81
views
How to repeat column headers for each page using NPOI
I need to repeat my column headers on each page of excel spreadsheets. I'm using the NPOI XSSFWorkbook class to generate the spreadsheet. Is there a way to specify rows that should be repeated for ...
0
votes
1
answer
170
views
Null reference exception stops the code execution inside of try block
So I have a code segment where I am expecting a method that is repeatedly called from inside a loop to return null at one point - null is returned because the table cell that this method tries to read ...
0
votes
0
answers
126
views
NPOI Insert a new row like excel to extend chart data
I am trying to insert a new row in Excel to fill in some data to populate a chart from an Excel template.
My first attempt was using worksheet.CreateRow(index);, but it creates an empty row without ...
0
votes
1
answer
282
views
NPOI Parallel.ForEachAsync Write to Same File
So I have a Parallel.ForEachAsync loop like so:
await Parallel.ForEachAsync(batchSysIds, parallelOptions, async (batchSysId, _) =>
{
await GenerateListWriteFile(batchSysId);
});
So basically I'...
0
votes
0
answers
66
views
Do C# NPOI support phonetic text (japanese/chinese text)?
I am converting excel file .xlsx with phonetic text (Japanese text) but the output file gives out warning that there are unreadable contents, and the data are missing from the file.
It seems that the ...
0
votes
0
answers
93
views
Application seems to be searching the wrong version of Assembly
I'm developing a .net APP using NPOI library to read excel files, but I'm having problems when its referencing ICSharpZipLib.
I added NPOI in nuget and its referencing version 1.3.3 or greater of ...
-2
votes
1
answer
489
views
Can NPOI in API use Excel file in memory without saving to disk?
Using the NPOI package, can an API receive an Excel file (xlsx), use that file in memory to process, then return a second Excel file as the response, all without saving either file to disk, or do the ...
0
votes
1
answer
332
views
NPOI 2.6.0-rc-3 with .net framework 4.8.1 for updating .xlsx - losses charts in excel file
I use NPOI 2.6.0-rc-3 with .net framework 4.8.1 for updating .xlsx file. Excel file includes charts with it. excel file get crashed and after saving. After recovering the same file it losses charts in ...
1
vote
0
answers
47
views
NPOI How to add key/value paragraph with underlined value?
how i can add specific paragraph (XWPFParagraph) like this:
"Address" is key, value is underlined.
3 lines for value are required
0
votes
0
answers
46
views
Getting dropdown selected cell reference in another sheet - NPOI
I am using NPOI package in C#.
My excel document have 2 sheets.
First sheet has 3 dropdowns, second sheet has the sources for those dropdowns.
For each selected dropdown value, I need to get the ...
2
votes
1
answer
151
views
How to programmatically evaluate Excel data validations using NPOI?
I would like to programmatically check if cell value is valid using data validations already added to .xlsx template. There is a way to do that in Java using Apache POI DataValidationEvaluator class, ...
0
votes
0
answers
406
views
NPOI C#: best way from Workbook to byte[]
We have done an utility method to return a byte[] from an IWorkBook (NPOI).
public static byte[] WorkbookToByteArray(IWorkbook workbook, bool flush = false)
{
using (var ms = new MemoryStream())
...
0
votes
1
answer
1k
views
Npoi: We found a problem with some content (C#)
I am using NPOI to generate excel file from Sql table. Everything works fine but when i tried to open the file it give me following error.
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore....