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

Commented Issue: NPOI doesn't work with a Excel template with macro [3804]

$
0
0
Since there is no documentation one can refer to, let me ask the author whether NPOI supports Excel files with macros?
 
Probably I did something wrong, but each time I try to open such a file, fill it with data and save it via NPOI, the resulting file gets corrupted. Excel opens it but is unable to save. Once macros are eliminated, everything goes smooth. Could you please tell me where the problem is?
 
Thank you.
Comments: ** Comment from web user: christ4125 **

can the current version of NPOI now support VBA programming ?


Commented Issue: Npoi 2 error in NumericCellValue (XSSFCell) [11083]

$
0
0
double.Parse(this._cell.v)
this._cell.v == "55,6" - error
this._cell.v == "55.6" - ok
 
change:
double.Parse(this._cell.v) -> double.TryParse(this._cell.v, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out d);
Comments: ** Comment from web user: malkav1977 **

Hi, i´m sorry but i downloaded the laste beta version 2.0 beta 1 released on march 6, and i´m still having the same problem, cell with a value like 155,000 where the "," char is the miles separator, are readed like only 155 instead of 155000.

In fact, the real cell value is "155,000 L" wich i expected to be a string value (so i can parse the base unit liters and the actual number 155000), but instead it´s readed like a number.

Maybe i´m doing something wrong, can u help me?

New Post: Picture Line Border in Excel using HSSF UserModel

$
0
0
Is there a way to add a picture line border to a picture that has been inserted into an anchor tag on a given worksheet? If so, how would this be done?

New Post: Reading Specific Columns or other ideas?

$
0
0
At the moment I need 3 specific columns from an xls file and have been loading the whole sheet into a datatable. From there I am deleting rows and columns I do not need. It is sort of working but also beginning to get sloppy I feel.

Does anyone have an idea for me to pull those columns directly or possibly another way to approach this? Thanks!

New Post: Format as Table

$
0
0
Guys, can I populate an excel file (xlsx) with that 'Format as Table' feature? I haven't found a way to create it through code, neither putting it on my template.
Is there some class that helps me with it?.

Thanks anyway!

Created Unassigned: npoi.xssf.usermodel [11874]

$
0
0
Hi all,

I wanna use npoi to manipulate .xlsx files in VS2012/2010. To do so I should import NPOI.XSSF.UserModel, but when I add the npoi.dll and try to import that, there is no XSSF type of NPOI at Using part. I mean that there is no "Using NPOI.XSSF"
Any help?

Reopened Issue: Access issue creating worksheet [11383]

$
0
0
The following error occurs when we try to create a worksheet. The issue is resolved by setting IIS 7.0 LoadUserProfile to true. We are trying to understand why this is needed and teh secruity implications and if there is a workaround to make this work without having to change the default IIS settingSystem.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.CodeAccessPermission.Demand() at System.Environment.get_UserName() at NPOI.HSSF.Model.InternalWorkbook.CreateWriteAccess() at NPOI.HSSF.Model.InternalWorkbook.CreateWorkbook() at NPOI.HSSF.UserModel.HSSFWorkbook..ctor() at ....The action that failed was: Demand The type of the first permission that failed was: System.Security.Permissions.EnvironmentPermission The first permission that failed was: version="1" Read="UserName"/> The demand was for: version="1" Read="UserName"/> The granted set of the failing assembly was: version="1"> version="1" Access="Open"/> version="1" Allowed="ApplicationIsolationByUser" UserQuota="512000"/> version="1" Flags="Execution"/> version="1" Window="SafeTopLevelWindows" Clipboard="OwnClipboard"/> version="1" PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010095CCD95AF3B39D8BC20544D3F47FD24B53EBC5CCB693EAED116290629F8CD882C827EBD511AD59449224F0718D3F9D03B64945A6C8B6644266001B8C8426185330E3D96DA70AE16D4ACC21B8D4D480F1385C7E924273179375AA88F81380A72FB115712A313379D16AED4AA36208EE3B4A5DD785B06A07B2D868E3227F4495B5" Name="NPOI" AssemblyVersion="1.2.5.0"/> version="1" Url="file:///c:/xxx/web/bin/NPOI.DLL"/> version="1" Zone="Internet"/> version="1" Level="SafePrinting"/> The assembly or AppDomain that failed was: NPOI, Version=1.2.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1 The method that caused the failure was: NPOI.HSSF.Record.Record CreateWriteAccess() The Zone of the assembly that failed was: Internet The Url of the assembly that failed was: file:///c:/xxx/web/bin/NPOI.DLL --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args) at ...

Reopened Issue: [HSSF]Comment is not saved correctly while using a xls template with comment [11169]

$
0
0
If you read an existing xls template with comment in it and then save it as a new xls, the comment will be lost and Excel will say 'file data lost' in some cases. This is confirmed as a bug in all previous version of NPOI. It's plan to be fixed in NPOI 2.0.

Reopened Issue: Issue with 2.0 Beta: Get an non-Closing Element error [11085]

$
0
0
I have a situation where I have to open several XLSM files. Only about 50% of them work with the NPOI 2.0.
 
I get a failure similar to the following: The 'br' start tag on line 19 position 12 does not match the end tag of 'font'. Line 20, position 9.
 
The relevent stack trace is as follows:
 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Xml.XmlException: The 'br' start tag on line 19 position 12 does not match the end tag of 'font'. Line 20, position 9.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowTagMismatch(NodeData startTag)
at System.Xml.XmlTextReaderImpl.ParseEndElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at NPOI.XSSF.UserModel.XSSFVMLDrawing.Read(Stream is1)
at NPOI.XSSF.UserModel.XSSFVMLDrawing..ctor(PackagePart part, PackageRelationship rel)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct& signature, RuntimeType declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(IRuntimeMethodInfo method, Object[] args, SignatureStruct signature, RuntimeType declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at NPOI.XSSF.UserModel.XSSFFactory.CreateDocumentPart(POIXMLDocumentPart parent, PackageRelationship rel, PackagePart part)
--- End of inner exception stack trace ---
at NPOI.XSSF.UserModel.XSSFFactory.CreateDocumentPart(POIXMLDocumentPart parent, PackageRelationship rel, PackagePart part)
at NPOI.POIXMLDocumentPart.Read(POIXMLFactory factory, Dictionary`2 context)
at NPOI.POIXMLDocumentPart.Read(POIXMLFactory factory, Dictionary`2 context)
at NPOI.POIXMLDocument.Load(POIXMLFactory factory)
at NPOI.XSSF.UserModel.XSSFWorkbook..ctor(Stream is1)
 
I found that the EPPlus Excel library is able to read all the files without issue. I prefer NPOI but have to have a working solution by the next 2 weeks. Hope there is an easy fix for the Alpha release.
 
For proprietary reasons I cannot attach the XLSM file. Thanks!

Reopened Issue: Npoi 2 error in NumericCellValue (XSSFCell) [11083]

$
0
0
double.Parse(this._cell.v)
this._cell.v == "55,6" - error
this._cell.v == "55.6" - ok
 
change:
double.Parse(this._cell.v) -> double.TryParse(this._cell.v, NumberStyles.Any, NumberFormatInfo.InvariantInfo, out d);

Reopened Issue: Error when running NPOI with Mono C# compiler version 2.0.1.0 [4547]

$
0
0
Dear developers,
 
I get an error when running applications using NPOI under mono:
 
Unhandled Exception: System.ArgumentException: Encoding name 'UTF-16LE' not supported
Parameter name: name
at System.Text.Encoding.GetEncoding (System.String name) [0x00000]
at NPOI.Util.StringUtil.PutUnicodeLE (System.String input, System.Byte[] output, Int32 offset) [0x00000]
 
Thank you for help,
h2o

New Post: Format as Table

$
0
0
This looks to be a new feature in Office 2007 or above because the file format is xlsx. I'm afraid it's not supported so far.

Commented Unassigned: problem with ExcelSheet 2010 [11880]

$
0
0
I want to fetch the data from the excel Sheet provided to the user and i am using NPOI from nuGate Package.

If my excel sheet made in the MSOffice2007 then it is working fine. but if file made in 2010 then it it throwing an error related to hssf

Help me in that
Comments: ** Comment from web user: tonyqus **

HSSF is not the correct class for xlsx files. Instead, you have to use XSSF. But XSSF is only available in NPOI 2.0.

New Post: Dose NPOI support WinRT and WindowsPhone

$
0
0
Hi,

I just want to know that, dose NPOI support WinRT and WindowsPhone?
if not, what can be other alternatives

Thanks

JZ

New Post: Format as Table

$
0
0
That's what I thought. I spent some time researching on poi too, but nothing came out of it.
If anybody is going through that pass, I suggest the same approach I worked on, using an Excel Macro. Any help needed with that, mail me.

Aside from that issue, NPOI has been a great tool to use when dealing with Excel. Thanks tony!

Created Unassigned: xlsx Insert second picture error [11892]

$
0
0
Hi all,
When I insert secord picture in Xlsx file, it always replace first one.
Any help?

IWorkbook workbook = new XSSFWorkbook();
ISheet sheet1 = workbook.CreateSheet("PictureSheet");

IDrawing patriarch = sheet1.CreateDrawingPatriarch();
//create the anchor
XSSFClientAnchor anchor = new XSSFClientAnchor(500, 200, 0, 0, 2, 2, 4, 7);
anchor.AnchorType = 2;
//load the picture and get the picture index in the workbook
XSSFPicture picture = (XSSFPicture)patriarch.CreatePicture(anchor, LoadImage("../../image/HumpbackWhale.jpg", workbook));
picture.Resize(); //Note: Resize will reset client anchor you set.


XSSFClientAnchor anchor2 = new XSSFClientAnchor(500, 200, 0, 0, 12, 2, 14, 7);
anchor2.AnchorType = 2;
XSSFPicture picture2 = (XSSFPicture)patriarch.CreatePicture(anchor2, LoadImage("../../image/pic2.jpg", workbook));
picture2.Resize();

FileStream sw = File.Create("test.xlsx");
workbook.Write(sw);
sw.Close();

New Post: NPOI makes a mess of my .XLSX file when writing to existing file

$
0
0
Hi folks,

When I wrtie to an .XLS file there is no problem, it works correct. But when I write to a .XLSX file the file is messed up. Mu code is ±

private IWorkbook wb;

// Class and code
                FileStream file = new FileStream(bestand, FileMode.Open, FileAccess.Read);

                string ext = Path.GetExtension(bestand).ToLower();

                if (ext == ".xls")
                {
                    wb = new HSSFWorkbook(file);
                }
                else if (ext == ".xlsx")
                    wb = new XSSFWorkbook(file);

                ISheet ws = wb.GetSheet(Maanden[maand-1]); // The month sheet

                ws.GetRow(colum).GetCell(rij++).SetCellValue(huidigedatum);
                                ws.GetRow(colum).GetCell(rij++).SetCellValue(Datarow["Factuurnummer"].ToString());
                                ws.GetRow(colum).GetCell(rij++).SetCellValue(Datarow["Omschrijving"].ToString());

                                ws.GetRow(colum++).GetCell(tbBank-1).SetCellValue((double)totaal);
It this the way to write? to an .XLSX file.

Regards rinaldo

New Post: EOF In Header exception when reading .xlsm

$
0
0
I'm getting an EOF in Header exception when opening a XLSM file and initializing a XSSFWorkBook(Stream) object with the 2.0 beta version of NPOI. Below is a stack trace. Has anyone seen this before?

Stack trace:
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.ReadLeByte()
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.ReadLeShort()
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.ReadLeInt()
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.GetNextEntry()
at NPOI.OpenXml4Net.Util.ZipInputStreamZipEntrySource..ctor(ZipInputStream inp)
at NPOI.OpenXml4Net.OPC.ZipPackage..ctor(Stream in1, PackageAccess access)
at NPOI.OpenXml4Net.OPC.OPCPackage.Open(Stream in1)
at NPOI.Util.PackageHelper.Open(Stream is1)
at NPOI.XSSF.UserModel.XSSFWorkbook..ctor(Stream is1)
at Magnolia.FileUtilities.ExcelWrapper.openWorkbook() in C:\Development\Magnolia\Magnolia\FileUtilities\ExcelWrapper.cs:line 109
at Magnolia.FileUtilities.ExcelWrapper..ctor(String pathAndFile) in C:\Development\Magnolia\Magnolia\FileUtilities\ExcelWrapper.cs:line 91
at DocumentManager.MBGFE.ImportVBT.importVBTFile(String pathAndFile) in C:\Documents and Settings\tclaaso\my documents\visual studio 2010\Projects\DocumentManager\DocumentManager\MBGFE\ImportVBT.aspx.cs:line 454
at DocumentManager.MBGFE.ImportVBT.onImportButtonClicked(Object sender, EventArgs e) in C:\Documents and Settings\tclaaso\my documents\visual studio 2010\Projects\DocumentManager\DocumentManager\MBGFE\ImportVBT.aspx.cs:line 486

Created Unassigned: NPOI will throw exception when clone sheet With template file .xlsx​ (office 2007) have image in header [11899]

$
0
0
With template file .xlsx​ (office 2007) have image in header, NPOI will throw exception when clone sheet or only read and write file. But with .xls format (office 2003) NPOI work well.

Created Unassigned: problem with formula SUMIFS in german excel [11905]

$
0
0
HI All

i can insert Sumifs with beta version but only sum or sumif work german version of excel2010.
The functionnames are different in german is called "SUMMEWENNS".
When i go in excelto cell and change manually SUMIFS to SUMMEWENNS it works.

Why Excel checked sum and sumif automatically but sumifs not?

with best regards

mike
Viewing all 1621 articles
Browse latest View live




Latest Images