Quantcast
Channel: NPOI
Viewing all 1621 articles
Browse latest View live

New Post: 64 bit support

$
0
0

Dear tonyqus,

May I know how to get pure NOPI 64bit NET Framework library?

thanks!


Commented Issue: npoi The maximum column width for an individual cell is 255 characters. [11182]

$
0
0
<p>npoi The maximum column width for an individual cell is 255 characters.</p>

Comments: ** Comment from web user: karldodd **

Hello, is there any particular reason to have this 'design'? For some users, this looks like a constraint anyway.
Thanks for your great work.

New Post: NPOI messages in Debugger Output tab on new XSSFWorkbook, Loading 'xxxxxxx'...

$
0
0

If you are asking me, I do not recognize the names that it prints.  I believe the names are changing each time I run.

New Post: How do I set the DataFormat for an entire column?

$
0
0

I'm having trouble setting the DataFormat on a column in a report.  I was hoping to use SetDefaultColumnStyle, but it doesn't appear to be working:

ICellStyle datetimeFormatStyle = workbook.CreateCellStyle();
datetimeFormatStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("m/d/yy h:mm");
sheet.SetDefaultColumnStyle(0, datetimeFormatStyle);

Unfortunately the dates are still appearing in the standard m/d/yy format.  The date date does have time stamps on it.  What am I doing wrong?  Or is it not possible to do this for an entire column?

New Post: use vb.net to create xls file from .net table using NPOI

$
0
0

Hi,

using asp.net/vb.net 2010

I have a .net datatable and I would like to create an excel (xls) file using NPOI.   While I am displaying most of the columns to the user, also I would like to format a couple of the columns so I can hide the columns but the value is still in the cell.

Essentially when the user clicks on the go button I want to take the .net datatable, create the excel file and then open the excel file so the user can see it and the do whatever with it, save it or edit it.

are there are any code samples of how to do this?  I just downloaded NPOI today and have not used it before.

thanks

Dave

New Post: Using NPOI.SS.UserModel to open both XLS and XLSX for reading

$
0
0

Using NPOI 2.0 Alpha

I am having an issue opening an Excel 2007 (xlsx) Workbook.  I receive the following error:

The supplied data appears to be in the Office 2007+ XML. You are calling the part of POI that deals with OLE2 Office Documents. You need to call a different part of POI to process this data (eg XSSF instead of HSSF)

The error is occurring on the following line (yes, VB.NET)

        Dim xlWBAs IWorkbook = DirectCast(WorkbookFactory.Create(New POIFSFileSystem(New FileStream(Me.solFilePath, FileMode.Open, FileAccess.Read))), XSSFWorkbook)

I know that NPOI is modeled after Apache POI, and I have used Apache POI's SS UserModel to read both xls and xlsx files in Java without having to change anything.  As you can see above, I tried to cast it to an XSSFWorkbook, but that didn't work either.  What am I doing wrong, or is the SS UserModel in NPOI not capable of reading both xls and xlsx?

New Post: Using NPOI.SS.UserModel to open both XLS and XLSX for reading

$
0
0

Nevermind.  I just figured it out.  Instead of using POIFSFileSystem, just supply the FileStream directly to WorkbookFactory.Create(...) and it seems to work just fine.

Dim xlWB As IWorkbook = WorkbookFactory.Create(New FileStream(Me.solFilePath, FileMode.Open, FileAccess.Read))

 Sorry for the false alarm.

New Post: 64 bit support

$
0
0

Does NOPI work with 32bit or 64bit processor on 64bit OS?


Updated Wiki: Home

$
0
0
This project is the .NET version of POI Java project at http://poi.apache.org/. 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
a. generate a Excel report without Microsoft Office suite installed on your server and more efficient than call Microsoft Excel ActiveX at background;
b. extract text from Office documents to help you implement full-text indexing feature (most of time this feature is used to create search engines).
c. extract images from Office documents
d. generate Excel sheets that contains formulas

To get the latest code from svn, please visit http://code.google.com/p/npoi/.
 
Donate NPOI
donatedonate2donate_btn
 
Advantage of NPOI
a. It's totally free to use
b. Cover most features of Excel (cell style, data format, formula and so on)
c. Professional support service (even 24*7) from NPOI team (not free)
d. Support xls, xlsx, docx.
e. Designed to be interface-oriented (take a look at NPOI.SS namespace)
f. Support not only export but also import
g. .Net 2.0 based even for xlsx and docx (though we also support .NET 4.0)
h. Successful cases from all over the world
i. huge amout of basic examples

NPOI on SNS
QQ群: 20144214(新500人群), 189925337
NPOI教程: http://tonyqus.sinaapp.com/

System Requirement
VS2010 with .NET 4.0 runtime
VS2005 or VS2008 with .NET 2.0 Runtime (SP1)
vs2003 with .NET 1.1
medium trust environment in ASP.NET
 
Latest News
NPOI 2.0 alpha is released. It supports Excel 2007 and Word 2007. You can download it fromhttp://npoi.codeplex.com/releases/view/92382.


Commented Issue: Could not load file or assembly 'NPOI.OpenXmlFormats.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1' or one of its dependencies. The system cannot find the file specified. [11158]

$
0
0
<p>Hi, </p>
<p>&nbsp;</p>
<p>I have the following error : Could not load file or assembly &#39;NPOI.OpenXmlFormats.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1&#39; or one of its dependencies. The system cannot find the file specified.</p>
<p>&nbsp;</p>
<p>This happens at runtime when trying to open an XSSFworkbook : </p>
<p>&nbsp;</p>
<p>NPOI.SS.UserModel.IWorkbook workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(fs);</p>
<p>&nbsp;</p>
<p>I have references to NPOI, NPOI.OOXML, NPOI.OpenXml4Net and NPOI.OpenXmlFormats</p>

Comments: ** Comment from web user: AriasFelipe **

Hello

I'm having the same problem, but I can not solve it, this is the error log I have...

Managed Debugging Assistant 'BindingFailure' has detected a problem in 'c:\MyWork\Projects\exes\DataAnalysis.exe'.
Additional Information: The assembly with display name 'NPOI.OpenXmlFormats.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'NPOI.OpenXmlFormats.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1' or one of its dependencies. The system cannot find the file specified.
File name: 'NPOI.OpenXmlFormats.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1'

=== Pre-bind state information ===
LOG: User = xxx\xxx
LOG: DisplayName = NPOI.OpenXmlFormats.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL
(Fully-specified)
LOG: Appbase = file:///c:/MyWork/Projects/exes/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: NPOI.OpenXmlFormats.XmlSerializers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL
LOG: Attempting download of new URL file:///c:/MyWork/Projects/exes/NPOI.OpenXmlFormats.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///c:/MyWork/Projects/exes/NPOI.OpenXmlFormats.XmlSerializers/NPOI.OpenXmlFormats.XmlSerializers.DLL.
LOG: Attempting download of new URL file:///c:/MyWork/Projects/exes/NPOI.OpenXmlFormats.XmlSerializers.EXE.
LOG: Attempting download of new URL file:///c:/MyWork/Projects/exes/NPOI.OpenXmlFormats.XmlSerializers/NPOI.OpenXmlFormats.XmlSerializers.EXE.

This is my code...

using namespace NPOI::HSSF::UserModel;
using namespace NPOI::XSSF::UserModel;
using namespace NPOI::SS::UserModel;
using namespace NPOI::OpenXmlFormats;
...
IWorkbook^ book;
book = gcnew XSSFWorkbook(stream);

And I have all the DLLs referenced including NPOI.OpenXmlFormats.dll, I tried with the Alpha 2.0 release. My project is being compiled with .Net 3.5 using Visual C++ Express version.... as reference, I tried other library and also complains with the XML libraries (not using this one) so, there may be an issue with some XML patch or security setting....

When I try to list all members in the NPOI.OpenXmlFormats.dll I only see the namespaces:
Vml
Wordprocessing
Noting like XmlSerializers... as if this namespace or class were not included in the library...

Regards...

Created Issue: Couldnot delete worksheet [11376]

$
0
0
I am trying to delete first sheet from excel file like below
_Worksheet _wsh = (_Worksheet)shs.get_Item(1);
_wsh.Delete();
But it throws error. Am i doing something wrong pls guide.

New Post: HSSFCellStyle.UserStyleName always returns NULL in 1.2.4

$
0
0

I am using NPOI 1.2.4 and have noticed that I cannot retrieve a custom cell style by name as the UserStyleName property always returns null.

Having looked through the NPOI source, it appears that a newly create HSSFCellStyle object (created using HSSFWorkbook.CreateCellStyle) will always have an internal StyleRecord that has its IsBuiltin flag set to true.  When this is the case, the get for UserStyleName will always return null, even though it is not a built in style.

A workaround for this might be to change the get to:

get
            {
                StyleRecord sr = workbook.GetStyleRecord(index);if (sr == null)
                {returnnull;
                }//if (sr.IsBuiltin)if (sr.IsBuiltin && sr.Name == null)
                {returnnull;
                }return sr.Name;
            }

However, for objects created with HSSFWorkbook.CreateCellStyle, would it not be more sensible for the default for IsBuiltin to be false, as you've just asked for it to be created?

Or, am I missing something obvious?

Updated Release: NPOI 2.0 beta 1

$
0
0
  • fix reading template with comment issue - comment will lost before this fix
  • read xlsx with br
  • fix decimal seperated by comma instead of dot
  • Excel2Html is officially included in this release
  • Implement partial chart feature in XSSF

New Post: HSSFCellStyle.UserStyleName always returns NULL in 1.2.4

New Post: 64 bit support

$
0
0
jwhwang wrote:

Dear tonyqus,

May I know how to get pure NOPI 64bit NET Framework library?

thanks!


There is no pure 64bit version.


New Post: How do I set the DataFormat for an entire column?

$
0
0

I'm not sure what's going on with SetDefaultColumnStyle. But I suggest you create a shared cell style with the dataformat and assign it to each existing cell in the column. I'm thinking maybe SetDefaultColumnStyle is only for creating new cell while you are in Excel UI.

New Post: Can XSSF open Excel 2003?

$
0
0

Please use NPOI.SS.UserModel.WorkbookFactory. It will automatically determine which type of Excel files are you importing and return you the correct object(HSSFWorkbook or XSSFWorkbook). Actually, it will return you IWorkbook, which hides the details of real object.

New Post: Exception when loading a specific xls file (1.2.5)

$
0
0

If that's the case, please ask the third-party for help. They are making mistakes while creating the file instead of NPOI.

Commented Issue: Couldnot delete worksheet [11376]

$
0
0
I am trying to delete first sheet from excel file like below
_Worksheet _wsh = (_Worksheet)shs.get_Item(1);
_wsh.Delete();
But it throws error. Am i doing something wrong pls guide.
Comments: ** Comment from web user: tonyqus **

What's the detailed exception?

Commented Issue: NPOI 2.0 Unable to Export 70k Rows [11160]

$
0
0
<p>Hi,</p>
<p>&nbsp;</p>
<p>I am using NPOI 2.0 Alpha to export data from a work system as we wanted to get round the Excel 97-2003 65K row limitation. </p>
<p>&nbsp;</p>
<p>I have implemented it today but it seems to be unable to export 70k rows and falls over with an OutOfMemory exception.</p>
<p>&nbsp;</p>
<p>The file is only 70k rows by around 20/25 columns of text - no formatting is present.</p>
<p>&nbsp;</p>
<p>I understand XML requires large amounts of memory but the limitation doesn&#39;t seem to be down to my machine (it has plenty of RAM spare), instead it seems to be down to one of the internal structures that NPOI is using (memory stream or byte array perhaps?).</p>
<p>&nbsp;</p>
<p>I have attached a stack trace to demonstrate.</p>
<p>&nbsp;</p>
<p>Could someone advise if there is a way round this? Alternatively, where can i find the NPOI 2.0 source code for download so i can step through and try and find a solution myself?</p>
<p>&nbsp;</p>
<p>If this can be solved it&#39;d be a real bonus as this will likely be a common problem.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Thanks in advance,</p>
<p>&nbsp;</p>
<p>u33db</p>

Comments: ** Comment from web user: tonyqus **

No workaround for now. We will try to optimize this issue in NPOI 2.1 or later version.

Viewing all 1621 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>