Dear tonyqus,
May I know how to get pure NOPI 64bit NET Framework library?
thanks!
Dear tonyqus,
May I know how to get pure NOPI 64bit NET Framework library?
thanks!
Hello, is there any particular reason to have this 'design'? For some users, this looks like a constraint anyway.
Thanks for your great work.
If you are asking me, I do not recognize the names that it prints. I believe the names are changing each time I run.
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?
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
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?
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.
Does NOPI work with 32bit or 64bit processor on 64bit OS?
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...
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?
Have you tried 1.2.5?
jwhwang wrote:Dear tonyqus,
May I know how to get pure NOPI 64bit NET Framework library?
thanks!
There is no pure 64bit version.
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.
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.
If that's the case, please ask the third-party for help. They are making mistakes while creating the file instead of NPOI.
What's the detailed exception?
No workaround for now. We will try to optimize this issue in NPOI 2.1 or later version.